Coding is Three Dimensional

We program in three dimensions. And no, I don’t mean the X, Y and Z axes. Well, not entirely. Nor am I talking about 3D modeling or specifically about building physics engine.

I’m talking about the three dimensions that are contained in every programming project we work on. We progress through these three dimensions in ascending order as we learn how to code, yet the best programmers I’ve met are the ones who have achieved mastery in the Third Dimension.

That being said, you need the first two dimensions just as much. So don’t just try to skip to the Third Dimension. That’s just no fun.

The First Dimension

The first dimension is the place all of us start when we decide to learn to code. Similar to 1D graph, the First Dimension is a single horizontal line. But in our case, it’s not a line on a graph, it’s a line of code.

For example, when a Ruby on Rails programmer decides to use

Post.all.map(&:name)

instead of

Post.all.map { |p| p.name }

they are operating in the First Dimension. In this dimension, syntax rules all. A programmer who exists only in the First Dimension does not stop to think about other lines of code, how they interact with the one they’re currently working on or how changing one line might break another.

It’s an important dimension to start with. If you don’t know the syntax of the programming language you’re working with, you cannot build as quickly.

But it’s also a dangerous dimension, because some programmers never leave it.

Between those two code examples above, the first one is much prettier. If you are following the unofficial Ruby style guide, it’s also the “correct” way. But they both result in the exact same thing.

If you program only in the First Dimension, you will constantly be the thorn in your fellow programmers’ sides. Your pull requests will be denied again and again because you haven’t stopped to think: “What else uses this line of code? What might I be breaking here?”

The solution for this issue lies within the Second Dimension.

The Second Dimension

The Second Dimension is a collection of lines of code. In the common tongue, we refer to them as “files”. If you take a series of 1D graphs and plot them along a vertical axis, you are now operating in two dimensions.

These 1D lines are the First Dimension lines of code, and stacked along the line numbers of a file they form a file of source code, or our Second Dimension.

Here’s what the Second Dimension of programming looks like:

def second_dimension
puts 'I am a second dimensional programmer.'
true
end

As you can see, in the Second Dimension you are still using the First Dimension in the sense that you are writing lines of code, but you are constantly thinking about how each of them interact. Changing this function to return `false` could cause another part of the code to break or behave unexpectedly.

When you program in the Second Dimension you are making note of where the source you are writing is used and where functions or variables are called. Most importantly, you are cognizant of the fact that every change you make might break something.

While a programmer who operates only in the First Dimension might make a change by going through their source code line by line and is likely to miss renaming a variable, a Second Dimension programmer will immediately sense the nonsense in this approach and learn how to use their programming tools to rapidly modify multiple parts of a file at ones (for example, Sublime Text’s multi-line editing capabilities). This is because they are aware of how the various parts of their code works together instead of just thinking of their code one line at a time.

But to truly master the craft of coding, there is one more dimension you need to excel in.

The Third Dimension

In the Third Dimension, a programmer breaks through the source code and begins to think about what they are building not in terms of the syntax, file imports, or directory structure and starts to visualize what is going on behind each line of code.

Every line of code you write does something. Nowadays it seems we can be extremely sheltered from this and this makes it easy to remain stuck in the First or Second Dimension.

A true Third Dimensional programmer uses program syntax the way we use words to express ideas. We can convey the same idea using varying combinations of words ― some far more effective than others ― but at the end of the day, the words are not what matter. They’re just a communication medium.

The Third Dimension is everything that goes on behind the scenes. No, not necessarily back-end programming, even front-end programming has this Third Dimension. The Third Dimension is by far the most complex and wide-spanning dimension, but in my opinion also the most important one.

In the first two dimensions you might write a line of code and stop to think “how can I improve this syntax” and “what other code might I break here”, but in the Third Dimension you are also asking questions like:

  • “Is this going to be a slow AJAX request?”
  • “Is this database query going to take forever to complete?”
  • “Am I creating a security vulnerability?”

and so on.

The best part of the Third Dimension is that the things you learn here are portable to multiple First and Second Dimensions. If you have a good understanding of how things are working behind the scenes, you can easily layer on top of this new programming languages and their corresponding syntax.

But don’t get me wrong: you need the first two dimensions as well. Only understanding how databases work but not being able to write decent code (although possibly effective if you want to be a DBA) won’t get you far as a programmer. It’s like having a bunch of great ideas, but no way to speak and thus share them with others.

Conclusion

Coding is a fascinating subject, and I think being aware of these multiple dimensions is an important part of growing as a programmer. You don’t have to master them all at once, and getting a firm grasp of them all takes time.

But you should cover them all eventually. Don’t get stuck in the First or Second Dimension!

I hope you’ve enjoyed the post. I rant about coding a lot ― a few other posts you might be interested in if you’ve made it this far are:

Cheers!