Abstract Classes
Naming Conventions
Object-Oriented Programming
Software Development
Programming Best Practices

Naming conventions for abstract classes

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

Introduction

Good abstract-class names describe the role the type plays in the domain, not just the fact that the class happens to be abstract. That is why there is no single universal prefix such as Abstract or Base that you must always use. The best convention is the one that makes the class’s purpose obvious and stays consistent with the rest of the codebase.

Name the Abstraction, Not the Mechanism

If an abstract class represents a meaningful concept, prefer naming that concept directly.

java
public abstract class PaymentProcessor {
    public abstract void process(int amountInCents);
}

This is usually better than naming the same class AbstractPaymentProcessor unless the project specifically uses that style everywhere.

A reader should understand what the type models before worrying about whether it can be instantiated.

When Abstract or Base Can Help

Prefixes such as Abstract and Base are not wrong. They are useful when the abstract class mainly exists as a shared implementation layer rather than as a standalone domain concept.

java
1public abstract class AbstractMessageHandler {
2    protected void logStart() {
3        System.out.println("starting");
4    }
5}
java
1public abstract class BaseController {
2    protected String currentUser() {
3        return "demo-user";
4    }
5}

These names communicate that the class is infrastructure or a helper superclass, not a first-class business concept.

Prefer Consistency Over Style Debates

Different teams choose different conventions:

  • direct domain names such as PaymentProcessor
  • 'Abstract... names such as AbstractPaymentProcessor'
  • 'Base... names such as BaseController'

None of these is automatically best in every project. What matters is that similar abstractions are named similarly.

If one package uses AbstractRepository, AbstractHandler, and AbstractValidator, introducing BaseCache in the same layer may create unnecessary inconsistency.

Avoid Redundant or Misleading Names

Some naming patterns create more confusion than clarity.

Poor examples:

  • 'AbstractInterfaceManager'
  • 'BaseAbstractService'
  • 'IAbstractParser'

These stack multiple conventions without adding meaning. They tell the reader about inheritance mechanics but not about responsibility.

A name should answer “what is this class for?” before “what language feature does it use?”

Separate Abstract Classes from Interfaces Clearly

If you have both an interface and an abstract helper, give them names that show the relationship without being verbose.

java
1public interface CacheStore {
2    void put(String key, String value);
3}
4
5public abstract class AbstractCacheStore implements CacheStore {
6    protected void validateKey(String key) {
7        if (key == null || key.isEmpty()) {
8            throw new IllegalArgumentException("key must not be empty");
9        }
10    }
11}

Here the interface owns the conceptual name, and the abstract helper makes its supporting role obvious.

Let Usage Patterns Guide the Name

If subclasses are expected to be extended by framework code only, a supporting name such as Abstract... often helps. If the abstract type is part of the public domain model that other developers read first, the plain domain name is often clearer. In other words, name it the way people will talk about it in design discussions.

That is often the deciding factor in API design. A class that appears in public extension points benefits from a name that communicates intent immediately, even to developers who never inspect the inheritance tree.

Common Pitfalls

  • Naming every abstract class with Abstract... even when the domain name alone would be clearer.
  • Using Base... for classes that are really domain abstractions, not implementation scaffolding.
  • Mixing several naming styles in the same architectural layer.
  • Creating names that describe inheritance mechanics instead of responsibility.
  • Reusing interface-style prefixes on abstract classes and making the type hierarchy harder to read.

Summary

  • Name abstract classes by their role first, not by the fact that they are abstract.
  • Use Abstract or Base only when that improves clarity in your codebase.
  • Stay consistent within the same project or layer.
  • Avoid redundant names that stack multiple conventions.
  • The best abstract-class name is the one that makes the class’s purpose obvious to the next reader.

Free course
Beginner
7 lessons
2 hours
Tackling System Design Interview Problems

A short course that equips you with the skills to approach system design interviews methodically.

Start the free course
Track what you have practised

A free account saves your progress, solutions and study plan across every problem on Codemia.

Interview Questions practice on Codemia

Over 8,000 real interview questions from top companies, searchable by company and role.

Browse interview questions

All Rights Reserved.