Implicit coupling will stab you in the back!

There are many ways to create implicit coupling in your game project, including the codebase. For example, if you copy-paste some logic in your code, that's an implicit coupling. The easiest way to spot this kind of coupling in your project is to ask yourself this question: "If I change this, do I also need to remember to change something else somewhere else?". If your answer is yes, then there is an implicit coupling between these different parts.

The danger with implicit coupling is that it's not tracked by any system, such as a compiler; thus, we rely on the developer's memory or attention to maintain this relationship. The last thing we want to do in game development is to take away the developers' attention or fill their memories with unnecessary information. This reduces their productivity.

Also, relying on the developers' memory or attention is not a reliable approach for game development. Humans often make errors, and this is the root of many nasty bugs that are extremely hard to find and fix.  

On the other hand, it's unavoidable not to have implicit couplings in our project. Because to remove them, we need to change our code design, which means we have to spend extra time on it, and the longer it takes, the less time we spend on our actual game.

Instead of redesigning the code structure, we can make a tool to automate the changing process, or we can explicitly document the relationship, so at least we don't rely on our memory. 

There is no single solution for this issue, but the first step is to be aware of it. Because I've seen many people keep fixing bugs caused by this type of relationship without noticing the underline problem. Only if they knew, they could do something about it.

What I personally do to remove this type of coupling is often by redesigning my code structure. But before I do that, I first weigh the cost of redesigning and the value I'm going to get out of it. If the benefit doesn't justify the cost, I'll choose the documenting approach.

Comments

Post a Comment

Popular posts from this blog

Unity Project Folder Structure

Why this blog?