DEV Community

Cover image for Code Smell 38 - Abstract Names
Maxi Contieri
Maxi Contieri

Posted on • Edited on • Originally published at maximilianocontieri.com

1

Code Smell 38 - Abstract Names

Avoid too abstract names. Names should have real world meaning

Problems

  • Implemental Naming

  • Meaningless names

  • Broken MAPPER and Bijection to real world entities.

Solutions

  1. Choose meaningful names.

  2. Find metaphors.

  3. Avoid words like abstract, base, generic, helper etc.

  4. Use rules for naming.

Sample Code

Wrong

<?
final class MeetingsCollection {}
final class AccountsComposite {}
final class NotesArray {}
final class LogCollector {}
abstract class AbstractTransportation {}

Right

<?
final class Schedule {}
final class Portfolio {}
final class NoteBook {}
final class Journal {}
final class Vehicle {}
view raw realNames.php hosted with ❤ by GitHub

Detection

We can set up policies and rules warning for certain words like base, abstract, helper, manager, object etc.

Tags

  • Naming

Conclusion

Finding names is the last thing we should do on our designs. Unless we have a clear business understanding, good names emerge at the end after defined behavior and protocol boundaries.

Relations

More info

what is in a name

Credits

Photo by Rodion Kutsaev on Unsplash


There are only two hard things in Computer Science: cache invalidation and naming things.

Phil Karlton

AWS Q Developer image

Build your favorite retro game with Amazon Q Developer CLI in the Challenge & win a T-shirt!

Feeling nostalgic? Build Games Challenge is your chance to recreate your favorite retro arcade style game using Amazon Q Developer’s agentic coding experience in the command line interface, Q Developer CLI.

Participate Now

Top comments (0)

Scale globally with MongoDB Atlas. Try free.

Scale globally with MongoDB Atlas. Try free.

MongoDB Atlas is the global, multi-cloud database for modern apps trusted by developers and enterprises to build, scale, and run cutting-edge applications, with automated scaling, built-in security, and 125+ cloud regions.

Learn More

👋 Kindness is contagious

Explore this practical breakdown on DEV’s open platform, where developers from every background come together to push boundaries. No matter your experience, your viewpoint enriches the conversation.

Dropping a simple “thank you” or question in the comments goes a long way in supporting authors—your feedback helps ideas evolve.

At DEV, shared discovery drives progress and builds lasting bonds. If this post resonated, a quick nod of appreciation can make all the difference.

Okay