Code Modules
Learn what code modules are and the benefits of creating them.
We'll cover the following...
Code modules
If programs are used, they’re also updated, and if we’re the developer of a program, this means that we’ll need to edit the source code in order to add features and fix errors. If our code is not well organized, it’ll be hard to read and maintain because we’ll need much more time to find where to insert our new code or where that error might be.
One measure to make our code easier to handle is to distribute it into several logical blocks. But how do we decide what will go into such a block? There are no fixed rules for how this is done, but the language we use might give us some hints, depending on how it wants us to structure the code. In the end, it’s up to you, the developer to make the final decision.
The code we write is logically connected, so to be able to do something, we often need to do a couple of other things first. It’s as if when you wake up in the morning and, while still in bed, you remember that there is nothing at home to make breakfast with, so first, you need to go shopping. But before you can do that, you need to do several other things, such as get out of bed and get dressed. These tasks are done to enable you to go shopping. In a way, we can say that these things are related and, by that logic, belong together. We could also see this ...