Many years ago, when digital dinosaurs roamed the world and small rodent like computers were starting to peek out of their evolutionary holes and I was still in my programming nappies I used to write code in a god module.
I didn’t know any better.
But as I grew up and started coding for a living, I learnt about global variables and god modules. Now in case you haven’t come across the phrase before I will give a very brief explanation (please stop yawning, it’s not very polite you know!).
As I’m sure you have guessed a god module is one module that has all the code in it. Every function that your piece of software carries out goes through the god module. Now there is not a problem with having god modules per se. But they lend themselves to poor design. In a god module if you have a bug to fix and the easy route is to add a global variable, then that is what is likely to happen. Soon the god module has turned into a Big Ball of Mud and then it becomes impossible to fix.
Finding bugs, as you can imagine was easy. Fixing them not so.
So why I am telling you this? Just to send you to sleep maybe? No, No my friend.
The point I am trying to make is that there is a sweet spot. A place between the god module and the confetti.
Separation of Concern is Good. Each code module should do one thing and do it well, I am signed up to that. But there are times when two code modules are so closely linked that they belong together. Like swans partnered for life. Breaking them up would be a crime.
What coding style do you have? Have you written a god module or a confetti like system? I would love to know your experiences so why not leave a comment.