How do you name your classes/objects?
I see a lot of different approaches, some using verbs, some is using nouns, or a combination of both(?)
What do you use, and why?
A few examples:
s the better naming? Maybe its just personal preferences, or?
Personal Preference, just remain consistent.
Just pick the naming convention that you like and stick with it.
So it`s not considered bad practice ending class names with “er”? e.g. FileDownloader, PdfReader and so on?
And yep, one could argue it
s just personal preference, but doesnt proper OOP has some “do’s and don’ts” on this topic?
The “-er-er” principle. Challenge any class name that ends in “-er.” If it has no parts, change the name of the class to what each object is managing. If it has parts, put as much work in the parts that the parts know enough to do themselves.
Thanks for the replies.
There is no such thing as “proper” OOP. There are some helpful hints and guides for effective managing but in truth it is all personal preference.
Hum, okey, so naming one class User and one ProfileUpdater is kind of, bad, then? User and UpdateProfile could be cool too, but sometimes I prefer naming some of my classes with an “er” ending.
The name of the class should describe what the object does. Having a “User” object and a “ProfileUpdater” object is not back. Both labels are clear. The part about being consistence is when it comes to when using verbs to name a “DOING” object. If you are using Updater, Reader, Writer as verbs, using them for all those cases. Don’t have “UpdateProfile” if you are using Verbs.