From the course: Software Design: Code and Design Smells

Unlock the full course today

Join today to access over 22,700 courses taught by industry experts or purchase this course individually.

Vet class-level smells

Vet class-level smells

From the course: Software Design: Code and Design Smells

Start my 1-month free trial

Vet class-level smells

- [Instructor] Now that we've got a frame of reference for method-level smells, let's take a look at code smells that affect the construction and behaviors of classes. The two scenarios that probably come to mind immediately are when classes are too large or too small. Large classes, which you'll hear referred to as God objects, follow the same principle as the God line. They're just trying to do too much. The fix for this issue is simple, break them off into smaller, more efficient classes. On the flip side, if you find yourself with a class that really isn't doing much of anything, you might want to re-evaluate if its behaviors even warrant a class of it own. It might turn out that it's better suited as part of an existing class. The next two code smells you'll often find in the coding wilds both deal with classes needing information or behaviors outside of themselves which I tend to think of as a class not being…

Contents