When almost every class has the same prefix. For example, when a user clicks on the button, a SmurfAccountView
passes a SmurfAccountDTO
to the SmurfAccountController
. The SmurfID
is used to fetch a SmurfOrderHistory
which is passed to the SmurfHistoryMatch
before forwarding to either SmurfHistoryReviewView
or SmurfHistoryReportingView
. If a SmurfErrorEvent
occurs it is logged by SmurfErrorLogger
to smurf/log/smurf/smurflog.log
.
org.acme.smurfs .SmurfAccountView .SmurfAccountDTO .SmurfAccountController .SmurfOrderHistory .SmurfHistoryMatch .SmurfHistoryReviewView .SmurfHistoryReportingView
Too many words in class name make it less readable, so if something can be assumed, known from the context, or just obvious, do not repeat it in the class name:
org.acme.smurfs .AccountView .AccountDTO .AccountController .OrderHistory .HistoryMatch .HistoryReviewView .HistoryReportingView
Don't be afraid to have potentially non-unique class names, especially if you employ proper packaging of classes and use package-accessible classes generously. And avoid similar code smell at the method level.
Discuss Downvote Upvote Votes: 0