Quick revision
The short answer
I would agree a short set of naming rules with the team: names come from the business's own language, classes are named for the one job they do instead of vague suffixes such as Manager, Helper and Util, and technical suffixes like Controller and Repository are used only where they tell the reader something. Tests are named for the behaviour they prove. We write the rules on one page, apply them to new code and to old code as we touch it, and keep them alive through reviews and an automated ArchUnit check.
What to remember
In this answer, we saw that vague names such as Manager, Helper and Util let responsibilities drift and hide duplicated logic. The team takes its vocabulary from the business, names classes for the single job they do, keeps only the technical suffixes that tell the reader something, avoids Impl in favour of a distinguishing word, and names tests by behaviour. The rules fit on one page, apply to new code at once and to old code as it is touched, and reviews plus a frozen ArchUnit rule keep them from eroding.
Your turn
Answer it aloud as you would in the interview, or type your answer below. Then show one part at a time and compare.
I would agree a short set of naming rules with the team: names come from the business's own language, classes are named for the one job they do instead of vague suffixes such as Manager, Helper and Util, and technical suffixes like Controller and Repository are used only where they tell the reader something. Tests are named for the behaviour they prove. We write the rules on one page, apply them to new code and to old code as we touch it, and keep them alive through reviews and an automated ArchUnit check.
Why this question is asked
When a codebase has OrderManager, OrderHelper, OrderUtil, OrderServiceImpl and OrderProcessor side by side, nobody can guess where a piece of logic lives or where a new one should go. New engineers spend days learning the map, bugs get fixed in one class while the same logic lives on in another, and every new feature adds a sixth class because none of the five clearly owns it. Interviewers ask this at the ten-year level because the fix is not a clever rename; it is getting a team to agree and then making the agreement stick. In this answer, we will look at why the current names hurt, agree on where names should come from, decide which suffixes earn their place, name tests by behaviour, and then see how to roll the conventions out without a big-bang rename.
1Why Five Order Classes Are a Problem
A class name is the first piece of documentation a reader sees. It should answer one question: what is this class responsible for? Names like OrderManager or OrderHelper do not answer it. Manager could mean anything that touches orders, Helper means 'some methods that did not fit elsewhere', and Util usually means a bag of static methods. OrderProcessor sounds specific but does not say which processing step it performs.
When we open these classes in a typical service, we usually find overlap. OrderManager creates orders and also sends confirmation emails, OrderHelper computes totals, OrderUtil formats order numbers and also computes totals in a slightly different way, and OrderServiceImpl wraps OrderManager for the controller. The vague names are not just cosmetic. They let responsibilities drift, because a class named for nothing in particular can accept anything.
So the real goal is not shorter names. It is that each name states a responsibility clearly enough that a reviewer can say 'this method does not belong here'.
2Start From the Business's Own Words
The first rule I would propose is that domain classes use the words the business uses. Domain-driven design calls this a ubiquitous language: one vocabulary shared by product owners, analysts and engineers, used in conversations, tickets and code alike. If the warehouse team says an order is 'allocated' and then 'dispatched', our code should have allocate() and dispatch(), not process() and handle().
To get there, we sit with the product owner for an hour and list the nouns and verbs of the order domain: order, basket, checkout, allocation, shipment, refund. Where the business has two words for one thing, we pick one and write it in a short glossary. Where engineers invented a word nobody else uses, we drop it. The glossary lives next to the code, for example as docs/glossary.md, so it changes through the same review process.
The reason this matters is translation cost. Every time a ticket says 'allocation fails for split shipments' and the code calls it OrderProcessor.handleMulti(), someone has to translate, and translation is where misunderstandings and bugs come from.
3Name Classes by Responsibility
With the vocabulary agreed, each class is named for the single job it does. We go through the five classes, list what each method actually does, and regroup the methods around responsibilities. The table shows a typical result.
| Old class | What it really did | New name |
|---|---|---|
OrderManager | creates orders from a checkout | OrderPlacement (or PlaceOrderService) |
OrderManager | sends confirmation emails | OrderConfirmationNotifier |
OrderHelper + OrderUtil | computes totals, twice, differently | Order.total() on the entity itself |
OrderUtil | formats order numbers | OrderNumber value type |
OrderServiceImpl | thin wrapper for the controller | removed; controller calls OrderPlacement |
OrderProcessor | reserves stock in the warehouse | StockAllocator |
Notice that renaming exposed a real bug risk: totals were computed in two places in two ways. That is typical, and it is the strongest argument to give a sceptical team. A good name is also a test of design. If we cannot name a class without 'and' or a vague suffix, the class probably does two things and should be split.
4Which Technical Suffixes Earn Their Place
Some suffixes are useful because they tell the reader the role a class plays in the framework. In a Spring service, Controller tells us the class handles HTTP requests, Repository tells us it talks to the database, Configuration or Config marks a class that defines beans, and Properties marks a class bound to configuration values. We keep these, and we agree on exactly one spelling for each so nobody writes OrderRepo in one module and OrderRepository in another.
The Impl suffix deserves a specific rule. OrderServiceImpl exists only because someone created an interface OrderService with a single implementation. If there is only one implementation and no plan for another, we usually drop the interface; Spring can proxy classes without it. If there are several implementations, each should be named for what makes it different: JpaOrderRepository and InMemoryOrderRepository, or StripePaymentGateway and AdyenPaymentGateway. Impl says nothing; the distinguishing word says everything.
5Name Tests by the Behaviour They Prove
Tests deserve the same care, because a failing test name is often the first thing someone reads during an incident. A name like testOrder2 tells us nothing. A name that states the behaviour tells us what broke before we open the file.
We agree on one style, such as a sentence in camel case that starts with a verb, or JUnit's @DisplayName for readable sentences, and stick to it. When the build reports 'rejectsOrderWhenStockIsInsufficient failed', everyone on call knows what to look at.
6Writing It Down and Rolling It Out
The conventions go on one page, not twenty: where names come from, the suffixes we use and the ones we avoid, the Impl rule, the test style, and three before-and-after examples from our own code. A short page gets read; a long one gets ignored.
We do not rename the whole codebase in one sprint. That creates a huge, risky diff, breaks everyone's open branches and gives the business nothing. Instead, new code follows the rules from day one, and old code is renamed when we touch it for a feature, the boy scout rule of leaving code a little better than we found it. IDE rename refactorings make each rename safe and mechanical.
Reviews are where the rules live day to day: a reviewer can point to the page instead of arguing taste. For the rules a machine can check, we add an ArchUnit test so the build enforces them.
FreezingArchRule is the key detail for a legacy codebase. It records today's violations and fails only on new ones, so the rule can be switched on immediately without forcing a mass rename, and the recorded list shrinks as old classes are cleaned up.
7Follow-up questions
What if the team disagrees about a name?
We go back to the glossary and the business. If the product owner calls it an allocation, the code calls it an allocation. When the business has no word for a purely technical concept, the team picks one, writes it in the glossary and moves on; consistency matters more than finding the perfect word, and a short time box keeps the discussion from eating a whole meeting.
Are Util classes always wrong?
Not always. A small, focused class of pure functions, such as a set of string normalisers used across modules, can be fine, and the JDK itself has Objects and Collections. The problem is the catch-all OrderUtil that grows without limit. Often such methods belong on a value type, like OrderNumber.format(), where the data they operate on lives.
How do you handle a rename that crosses service boundaries, such as a JSON field or a database column?
Internal class names can change freely, but names in public contracts cannot. For an API field or column we treat the rename as a compatible migration: add the new name, keep the old one working for a while, move consumers, then remove the old one. Often we leave the external name alone and map it at the boundary, because the cost of the change outweighs the benefit.
8Conclusion
In this answer, we saw that vague names such as Manager, Helper and Util let responsibilities drift and hide duplicated logic. The team takes its vocabulary from the business, names classes for the single job they do, keeps only the technical suffixes that tell the reader something, avoids Impl in favour of a distinguishing word, and names tests by behaviour. The rules fit on one page, apply to new code at once and to old code as it is touched, and reviews plus a frozen ArchUnit rule keep them from eroding.
Open with
I would start by showing the team what the vague names cost us. When I listed what OrderManager, OrderHelper, OrderUtil and OrderProcessor actually do, I usually find overlap, for example totals computed in two places.
Then, if they want more
Then I would propose a few rules. First, domain names come from the business, so I would sit with the product owner, list the nouns and verbs of the order domain, and keep a short glossary in the repository.
Second, a class is named for its one responsibility, like OrderPlacement, StockAllocator or OrderConfirmationNotifier, and we avoid Manager, Helper and Util because they accept anything. Third, technical suffixes are used only where they tell the reader the framework role, like Controller, Repository, Config and Properties, with one agreed spelling.
I would drop the Impl suffix: if there is one implementation we often do not need the interface, and if there are several, each is named for what differs, like JpaOrderRepository. Fourth, tests are named for behaviour, like rejectsOrderWhenStockIsInsufficient, so a failing build explains itself. I would write all this on one page with examples from our code.
We would not do a big-bang rename; new code follows the rules, and old code gets renamed with IDE refactorings when we touch it. Reviewers can point to the page instead of arguing taste, and I would add an ArchUnit test, frozen so existing violations do not fail the build, to stop new vague names appearing.
About this answer
- Last updated
- 12 November 2026
- Checked
- Its structure and format are checked automatically. Use it as a carefully prepared study note: where a detail matters, confirm it against the official documentation for the version you use. What the checks cover
- Where the question comes from
- Written by Scrivio for practice. It is not taken from an interview.
Report an issue with this answer
Copy the line below and send it to the author with what you found. It carries the address of this page.
Issue with "Your team's Spring services use inconsistent names: OrderManager, OrderHelper...": https://scrivio-interview-library.netlify.app/java/clean-code/5b183024ad/