devxlogo

Avoid Gigantic Classes

Avoid Gigantic Classes

Several small and specialized classes are preferred to a single bulky class that contains hundreds of member data members and member functions. More than once I’ve seen programmers extending a class with additional member functions and data members instead of using more plausible object-oriented techniques such as derivation. As a rule, a class that exceeds a 20-30 member function count is suspicious. Gigantic classes are problematic for at least three reasons: users of such classes rarely know how to use them properly; the implementation and interface of such classes tend to undergo extensive changes and bug-fixes; and they are less than ideal base classes.

See also  Why ChatGPT Is So Important Today
devxblackblue

About Our Editorial Process

At DevX, we’re dedicated to tech entrepreneurship. Our team closely follows industry shifts, new products, AI breakthroughs, technology trends, and funding announcements. Articles undergo thorough editing to ensure accuracy and clarity, reflecting DevX’s style and supporting entrepreneurs in the tech sphere.

See our full editorial policy.

About Our Journalist