Large classes and functions 

Does class size really matter? What's the problem with having a large method or function? Large classes and functions often scream complexity. Remember the SOLID principles and what each letter in the acronym represents. A large class or method is likely violating one or more of the principles.

We want our classes and functions to be small and have only one reason to change (Single Responsibility Principle). A large class is likely hiding logic that can and should be broken into two or more separate and distinct classes. A large method or function likewise often hides two or more methods. Look for ways to keep your methods simple and keep an eye out for possible logical boundaries with which to break out smaller helpers, classes, and utilities.

Classes and functions should be divided and grouped logically. The purpose of a system should be easily understood by the names and groupings of the files associated with the application. The structure of the system should be simple and make sense to those in charge of enhancing and maintaining the application.

..................Content has been hidden....................

You can't read the all page of ebook, please click here login for view all page.
Reset
3.22.51.241