Alan Montgomery
Alan Montgomery's Blog

Alan Montgomery's Blog

Programming is like building Lego blocks

Programming is like building Lego blocks

Subscribe to my newsletter and never miss my upcoming articles

This may seem like a weird thing to compare programming or coding to, but it's so true, for a few reasons.

Building upon what you've done already

When you have a piece of code, you can stop and continue building upon your solution at any time - you're not forced to finish all of your code at once - you can pause and come back to it at any point - however if you stop at a point when your code isn't complete in working order then it'll obviously be broken / unfinished. The same goes for Lego - you can build something then come back to it and continue however it'll be unfinished if you leave it.

Multiple ways of building things

There are so many different ways to build certain solutions - more efficient ways, shorter ways (in terms of lines of code), modern ways, old school or "traditional" ways etc. They all have one thing in common - they all achieve the same end goal. However one solution or method may be better than another due to certain factors like efficiency, speed, performance etc.

Consistency and maintainability

Building and developing consistent code ensures the integrity of your website or product in the long term. If you continue to use proven working patterns and techniques then it's going to be future proof. It also keeps your code alot neater and makes it more readable. Looking at the maintainability factor - this means that you can continue to come back to your code and make easy and fast changes to the code without having to touch core functionality. This also applies to if another developer down the line comes on board and tries to maintain your code - the more consistent and maintainable your code is then the easier it's going to be to be picked up by someone else.

All of these points can be applied directly to Lego - and although it is slightly a weird comparison - it definitely does fit together. If you ever need to bring yourself back to basics for some scope or to realign your vision of a project then think of this post.

Can you build upon the code you're writing? Is your code consistent and maintainable? Have you figured out the best way to write the solution?

 
Share this