Modular code are maintainable and easy to understand. To develop modular code one needs to cast a thought on the essential attributes of the problem and the interrelationship between these attributes. similar behavior attributes or those are functionally related should be in same class and try to create dependency graph so that redundancy can be removed and code will be created with fewer resources.
Main idea to reduce components is re usability and inheritance.
I agree with Manas. Also note that modular code is optimized for humans, not computers. In other words, you are optimizing the program so it can be reused, but are (slightly) reducing its performance. This reduction is mostly negligible and quite acceptable because human time is worth more than CPU time.