221: Be Careful Of Changes In Code Abstraction.

The code you write should follow a similar level of detail.

I mentioned level of detail in an earlier episode about how to start building a video game. And there I was talking about how to get your game idea or any project idea to a level of detail where you can begin working. This episode is more of a follow up to last week’s episode where I explained how to watch out for differences.

Imagine that you’re following a recipe to bake bread. And it explains how to mix the ingredients into a bowl. But when the recipe gets to the flour, instead of telling you to add 2 cups of all purpose flour, the recipe gives you the steps needed to harvest the wheat and the steps needed to grind it into flour.

Now these steps are definitely needed. But not when trying to bake bread. All the basic ingredients have to each go through their own production steps. And it makes a recipe completely unusable when it mixes levels of detail like this. In fact, the example I gave you is so ridiculous, that nobody would ever consider writing a recipe like this.
But why then do we write code like this? I see it all the time. Even in my own code. Yes, I have to be careful about this too. We all do.

Listen to the full episode for more examples and how to fix your code so that it’s more readable and understandable.

No comments yet.

Leave a Reply