Modular design is where functionality has been separated into independent interchangeable chunks(modules). Modules are more readable and maintainable.
There are some important concepts to understand to design your modules correctly:
- High cohesion and Low coupling
- Encapsulation and Public interfaces
- Explicit dependencies
High cohesion and Low coupling
Modules should not be tightly coupled to one another, so that it is easy to swap and change modules without interfering with other modules. In order to incorporate high cohesion and low coupling, you have to have a good understanding of the SOLID principles, more specifically of Single Responsibility Principle and Dependency Inversion Principle
Encapsulation and Public interfaces
David Lorge Parnas developed the concept of information hiding in modular programming. Each module should hide their inner workings and only expose what needs to be public in a fashion which makes it's use easy. Having a well thought out public interface will save you a lot of trouble. Encapsulation is one of the principles of Object-Oriented Programming which you should take a look at as a refresher.
Each module may or may not have dependencies on other modules or libraries. Make sure that the dependencies are well defined and explicitly mentioned so that it is very clear what the modules require to run. Hidden dependencies can make any form of change to modules very difficult. Dependency injection is one way to make dependencies more explicit, because you can't create and use the modual without injecting its dependcy.