Oct
22nd

How the Order of Operations prepared me for Programming

Thanks for stopping by my personal blog on Marketing Technology! Over 50,000 visitors a month find my content worth returning for, so don't forget to subscribe to the Marketing Technology Blog RSS feed or to the Marketing Technology Email to have new content sent directly to your inbox. You may also find my other business blog helpful, Social Media Domination.

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):

  1. First do all operations that lie inside parentheses.
  2. Next, do any work with exponents or radicals.
  3. Working from left to right, do all multiplication and division.
  4. Finally, working from left to right, do all addition and subtraction.

Here’s the example from Math.com:
Algebra Example from Math.com

Applying this to development is pretty simple.

  1. 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.
  2. 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.
  3. 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.
  4. 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.

You might also find these posts interesting:

RSS feed | Trackback URI

2 Comments »

Comment by no imageStephen (SezWho)
2007-10-23 00:33:25

This was a pretty neat post. I had never thought of applying the order of operations to something as abstract as development, but once you think of it, you see that they’re both abstract in the same way. I’ll have to bookmark this one and use it as a reference. ;]
Rate this:
2.9
Comment by no imageDouglas Karr (SezWho)
2007-10-23 05:36:55

Thanks Stephen! I’m working on a major project at work right now that spans multiple tables and many pages in a very logical order (all connected by one page utilizing Ajax) and I took notice in how careful I was being and decided to write about it.

Fun stuff!

Rate this:
2.9
 
 
Name (required)
E-mail (required - never shown publicly)
URI
Your Comment (smaller size | larger size)
You may use <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> in your comment.

My Comment Policy: I moderate comments. Please be patient:

  • Spam will happily be destroyed.
  • Use your real name, not some keywords. Otherwise it will be destroyed.
  • Mean comments aren't necessary. If I don't post them I will reply personally to let you know why.
  • Lewd comments will be edited, I don't want my readers leaving because of offensive content.
Great debate, criticism and colorful commentary is always appreciated and approved!