Algebra has always been a favorite subject of mine. There's not much theory involved, just a toolbox of methods and the order of operations to solve in. If you reach back into high school, you'll remember (quoted from Math.com):
- First do all operations that lie inside parentheses.
- Next, do any work with exponents or radicals.
- Working from left to right, do all multiplication and division.
- Finally, working from left to right, do all addition and subtraction.
Here's the example from Math.com:
Applying this to development is pretty simple.
- Operations within the parenthesis equates to my page layout, in a simple HTML format. I begin with a blank page and steadily populate it until it has all of the elements I'm looking for. To ensure flexible user interface design, I always work with XHTML and CSS. Anywhere where there are expressions (ie. database or programmatic results), I comment the code and type in dummy text, images, or objects.
- Next, I work with any exponents or radicals. These are my programmatic or database functions that extracts, transforms, and loads (ETL) the data as I wish to display it in my completed page. I actually work on the steps in that order unless formatting in the actual query results in improved performance.
- Next is multiplication or division. This is where I simplify my code. Rather than one huge monolithic script, I abstract as much of the code I can into include files and classes. With web development, I tend to work from top to bottom, of course.
- Finally, working from left to right, all addition and subtraction. This step is the final process, applying the last tidbits of form validation, style components, error handling, etc. Again, I tend to work from top to bottom.
Good development is not any more complex than a great Algebra problem. You have variables, equations, functions… and a logical order of operations to get the best results. I see a lot of hackers that simply ‘get it to work' but you find (as I have) that if you don't plan out your methodology and take a logical approach, you find yourself writing your code over and over and over when problems or changes are needed.
Algebra has always been a lot like a jigsaw puzzle to me. It's always been challenging, fun, and I knew a simple answer was possible. All the pieces are there, you just need to find them and put them together correctly. Writing code is no different, but it's more enjoyable because your puzzle output is whatever you would like it to be!
I'm not a formal developer, nor am I even a great one. I have; however, received compliments on the code I've written throughout many projects. I believe much of it is because I do a lot of preplanning, whiteboarding, schema extraction, etc. before I even write that first script tag.