Johan Broddfelt

Development phases of a software developer

First attempt at code

I wrote my first programs when I was about 16 years old, around 1994. One of the programs was a glossary training program, where I had to write the translations of words and every time I had spelled correctly two times in a row, the word was removed from the list. This continued until there were no more words on the list. It improved my average score from 10 to 18 out of 20 words at school. The second program was a worm game I wrote in Chipmunk Basic. The thing was that I did not know what an array was. So I just wrote variables for each element in the array, and then a long list of if-statements to check if the head of the worm had crashed into any of the elements of my worm.

if (aaX == abX and aaY == abY) { goto end_of_game; }
if (aaX == acX and aaY == acY) { goto end_of_game; }
if (aaX == adX and aaY == adY) { goto end_of_game; }
if (aaX == aeX and aaY == aeY) { goto end_of_game; }
.
.
.
if (aaX == bzX and aaY == bzY) { goto end_of_game; }

I also used the label and goto heavily and the code was a complete mess, but I got it to work in the end.

array[0...100]

When I started to learn more about programming I soon discovered arrays, and the magic they could perform. Now I could read any amount of data and just let the computer process it all. This made it a lot easier to build a game like knots and crosses where I just loop through all values in two arrays to see if any of the arrays have 5 in a row.

Manage more data

When I moved from static web pages and wanted to be able to store data for later sessions I knew that I probably should look at a database. I had some basic skills in SQL but I did not know how to configure a database nor how to connect and interact with one. And tripod.com did not provide any database for the free account I was using at the time. So, I settled for storing data in files using xml. But already at a hundred lines of data the file storage became a slow solution. But it was not until I had spent a year playing around with access that I decided to take the time to learn how to connect my web applications to a database. This opened an entirely new world of possibilities

functions and the 3x rule

As my applications grew they became quite hard to overview, each program was just a long file of code and some structures was reused over and over. This meant that if I needed to change the structure in one place I also must rewrite the same structure in other places. I found use for functions and implemented the rule of 3. If I were about to write the same code on a third place in my system I would make sure to move that code into a function and call the code from there instead. That way I only had to change the code in one place and it was a lot easier to reuse functionality. By overlaying classes and writing code in a more object oriented fashion I also manage to better structure the functions into relevant groups.

Classes and objects

I read about classes and objects at the university, but I never really got a feeling for when it was appropriate to use them. In some sense, I still feel that they sometimes provide a lot more flexibility then I'm asking for. But I have realized that they not only make a lot of the code easy to reuse in other projects, but they make the code easier to read and maintain. But sometimes I feel that I spend too much time thinking about where to put things and how to name them instead of writing solutions for clients. But when I have made some good choices I'm always happy about it when I get back, to make updates to the code later. I must admit that it is not time wasted. The time is just saved later, several times over. So make a habit of always thinking about the structure of your code.

Readable code

Now, the strategy of 3 might solve the issue of not having to rewrite code, but if you or someone else is supposed to maintain the code later, it would be nice if the code was easy to understand and get an overview of. I had times where I needed to print out about 10 pages of code lay it out on the floor and color mark different sections to get a good overview. Before making any modifications. This also is a driving force for developers to request larger screens, to get as many lines of code into the screen at the same time. So, what to do? The next step is to group code into different levels of abstraction, so that you get small and understandable functions.

function moveFoot(foot) {
	liftFoot(foot);
	moveFootForward(foot);
	lowerFoot(foot);
}

function walk(steps) {
	i = 0;
	foot = 'right';
	while (i < steps) {
		moveFoot(foot);
		if (foot == 'right') {
			foot = 'left';
		} else {
			foot= 'right';
		}
	}
}

walk(10);

Future hills to climb

I'm far from perfect at programming, even though I have come a long way. Currently I'm playing around with different ways to use JavaScript in combinations with web services. Because I want to move more of my code from the server and into the browser. But to manage object structures in JavaScript is a beast of its own. And the only way to learn is to dig in and write a ton of code an see what works and what will hit me in the head in a year or two.
And that is my final advice regardless of what you want to get good at. Never stop playing and testing. Trying out different ways of doing things is a sure way to acquire some new insights.

If you also feel that you have hills to climb, then check out my book "Next hill - Beginner's guide to business" where I have collected motivation and tools from some of the greatest leaders in business today.

- learn, develop, excel, software

<< A book to be, about business
Follow using RSS
The sacred idea >>

Comment

Name
Mail (Not public)
Send mail updates on new comments
0 comment