How the Order of Operations prepared me for Programming

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. If you reach back into high school, you’ll remember:
- First, all operations that lie inside parentheses must be done.
- 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 an example from Math.com:

Applying this to development is pretty simple.
- Operations within the parenthesis equate to my page layout in a simple HTML format. I begin with a blank page and steadily populate it until it has all the elements I want. I always work with XHTML and CSS to ensure flexible user interface design. Anywhere where there are expressions (i.e., database or programmatic results), I comment on 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 extract, transform, and load (ETL) the data as I wish to display it on my completed page. I 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 difficult 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 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 and fun, and I knew a simple answer was possible. All the pieces are there; you must find and put them together correctly. Writing code is no different, but it’s more enjoyable because your puzzle output is whatever you want 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.