Code Jenga

Developing code is like a big game of Jenga. Fun for all the family, but difficult to master.

Even for an advanced developer (and that’s certainly not me), it can be difficult to estimate the true volume of work involved in building a new feature into a software platform. On paper, what may seem like an easy addition or a small adjustment can turn into a complex maze of code. And vice versa, although far less common – what seems like a major task can actually turn out to be a lot more straight forward than you’d originally expect.

This all comes down to dependencies. Let’s compare it to a big game of digital Jenga (but more fun if you happen to be a geek like me). Think of code as being divided into a series of Jenga blocks (classes, methods, functions, entities). On their own, each block is really quite simple, and bear similarities to each other. Stack a few blocks together, and you’ve got a program. A combination of functions whose combined power actually does something useful. As we build our Jenga tower, the interfacing of these blocks into more and more layers creates a highly logical but often intricate structure – becoming exponentially powerful, but highly reliant on the sum of its parts.

Every block is dependent on each other to varying extents; depending on its position and the forces applied from other blocks above and below. Does pushing a block out of a lower level of the Jenga tower always cause it to topple? Nope. Sometimes – surprisingly – blocks can be teased out quite easily without any real impact to the tower. In truth, it is nigh-on impossible to determine exactly how the blocks depend on each other from the get go. Slightly different shapes mean some blocks can be removed with nothing more than a soft touch. Others require jiggling. And some simply destroy the entire tower when you least expect it.

In this way, code is very similar. Adding a line of code to one ‘block’ may seem harmless – but if this function is the foundation for the rest of the application, the tower can quickly start to sway and even topple over completely. Entering a single digit of code incorrectly can cause an entire application to buckle. Adding a basic function without considering the impact on other parts of the system can result in havoc.

This isn’t to say that predictions cannot be made, and knowing the application is the first step in preventing a premature tower collapse. Not just reading the code; but really getting inside the application, understanding what makes it tick and examining every entity (object type) that resides within it. Proper procedures, testing protocols and consistent code writing can iron out these issues before they really become issues.

Sometimes things are surprisingly easy:

Stepping back 6 months, the prospect of adding Automatic Contract Generation to the system was weighing on my mind. Convinced by my fellow director that this was a necessary feature rather than a nice-to-have for our customers, I remember putting up a fight – fearing the huge development cost which we would need to offset. But once my defences had subsided and I examined what was really involved, the blocks of code we were pushing in and out of our Jenga tower weren’t dependent on others sitting above and below them. A standalone feature which actually posed minimal risk, and could be developed for half the cost I had anticipated.

…and other times, the simplest task can turn out to be a monster:

Just the other day, we were asked to add a simple filter into the system. At first glance, it seemed straight forward – and confidently I raised the requirement with our development team – I was sure of a quick turnaround. But once dependencies were examined, it became clear that a simple change this was not – and a fairly major re-factoring of code, additions to the database structure and potential risk for other system functionality would have been the reality. To implement, our Jenga tower would need a structural survey, reinforcement and possibly remedial repairs!

Rod’s industry experience stems from a decade working in business consultancy specialising in the global oil & gas industry. During this time, he has provided commercial and market expertise to support finance raising and equity investments totalling in excess of $10 billion for clients in more than 50 countries. His passion for technology & energy go hand in hand in the development of the UtilityClick software platform.