cover-img

Code Smell 14 - God Objects

Don't take too many responsibilities.

13 October, 2022

2

2

0

An object that knows too much or does too much.

TL;DR: Don't take too many responsibilities.

Problems

Cohesion

Coupling

Solutions

Split responsibilities.

Follow Single Responsibility Principle.

Examples

Libraries

Sample Code

Wrong

Right

Detection

Linters can count methods and warn against a threshold.

Exceptions

Tags

Cohesive

Conclusion

Libraries were fine in the 60. In Object-Oriented Programming, we will distribute responsibilities among many objects.

Also Known as

Large Class

Relations

More info

Credits

This article is part of the CodeSmell Series.

cleancode

codesmell

2

2

0

cleancode

codesmell

Maxi Contieri

Buenos Aires, Argentina

🎓Learn something new every day.📆 💻CS software engineer 👷coding👨🏽‍🏫teaching ✍🏾writing 🎨Software Design 🏢SOLID 🌉TDD 👴Legacy 💩Code Smells

More Articles

Showwcase is a professional tech network with over 0 users from over 150 countries. We assist tech professionals in showcasing their unique skills through dedicated profiles and connect them with top global companies for career opportunities.

© Copyright 2024. Showcase Creators Inc. All rights reserved.