Naming In OOP And "ER/OR" Endings

We all heard that naming is one of the hardest problems in software development. Whoever did some HTML/CSS, OOP, etc. can attest to the struggle of coming up with good names for classes, functions, variables, etc.

Question is why do we need good names? Well we need good names so we are able to reason easier about the code which in turn makes modification and extension much easier.

Unfortunately, because it is a hard problem, we often get it wrong. One of the ways we get it wrong, in my opinion, is when we are giving fake nouns to things instead of proper nouns.

Without going into a big discussion and detail, I will just try to illustrate the issue in the shortest most obvious way and let you decide.

Let's take this example ...

If I gave you these boxes and told you "build me something", will you be able to easily reason about the boxes and very quickly be able to build something that makes sense using them?

Another example ...

Will you be able to easily reason about these objects and come up with ideas of how to build something that makes sense with them and also easily find what other objects might be needed?

My prediction is that the answers to the questions above is "Yes. I will be able to easily reason about and work with these objects"

Now let's look at another example ...

Now the same question, If I gave you these boxes and told you "build me something", will you be able to easily reason about the boxes and very quickly be able to build something using them?

My prediction is you will not be able to easily reason about these objects and you will have very hard and uncomfortable time building something that makes sense with them. There are, of course, some exception to this but I hope that I got the point across.

There you go. That's my beef with "ER/OR" classes in OOP.

There are many opinions and articles on this topic but I would say if you are interested and have some spare time on your hands you can read through this delightful article / story ...

Stevey’s Blog Rants: Execution in the Kingdom of Nouns
Adnan Mujkanovic

Adnan Mujkanovic

Full Stack Overflow Developer / YAML Indentation Specialist / Yak Shaving Expert
Gotham City