Learn how to create a sustainable Software Architecture!
Why you should modularize the software you write?
Cut components to make them as self-contained as possible...
Hide as much from the component as possible...
Define an explicit interface for interaction...
Connect the components that need to be connected...
For larger systems build hierarchical components...
Your software can be changed in the long term by breaking it down into individual modules. It will be less prone to mistakes and teams remain efficient in maintenance.
The individual building blocks:
The more independent a building block is, the easier it will be to handle. Cut building blocks in such a way that they are as distinct from each other as possible.
Hide as much of the internal structure of a building block and the way it is implemented from the outside world as possible.
Design interfaces so that the interaction between the building block and its consumers is as smooth as possible.
By using an interface of another module, these two are dependent on each other. Plan explicitly between which modules there should be which kind of dependencies.
A modular structure can itself become confusing on one level of abstraction. Build systems of higher complexity by combining blocks of one level to a new block of a next higher level. The same maxims of action are still to be applied.