I'm unsure whether this post is allowed, considering it may be subjective. However, I have seen many posts concerning naming conventions (on programmers, as well as on StackOverflow - where I'm a more active member) so I think it should be valid. (Though it seems that sometimes topic with naming conventions are quickly closed and sometimes they aren't, so we'll see.)

I'm currently working on a JAVA project, though the problem would arise in basically any functional language. In my programme, I create a fictional world. This means that I'd like to create characters, objects, entities, and what not, with many classes extending the other. For example: entity would be a super class which only knows whether an element is moveable or not, and where it's currently located (i.e. its coordinates). In another class, this could be refined to characters that also contain a name and a gender. Another class would then distinguish as objects, in that they could hold a "type" (e.g. tree, car and so on). For this latter type, it seems overhead to create Class for each type, considering there are many possible types in the world, with which I mean "typical objects in the world, not further defined by any hierarchy".

Starting from Entity as a class, I'd go down to Character and Object classes. However, I've been told a couple of times that I definitely should not use Character and Object as name classes, because they are inherent to Java's collections. The question I ask then is:

  1. Shouldn't we do so, because it's confusing for us as a programmer, or does it have programmatical consequences?
  2. Is this discouraged in all programming languages? Or are there any languages in which this isn't such a big deal?
  3. My IDE (Eclipse) doesn't throw any errors, not even a warning - so is it really that big of a deal?
  4. Are there any conventions to represent persons, or objects (the referents in the real world) with a class name? For the life of me, I can't figure out a good synonym for "Object". Character can be replaced by Person I guess, but for Object it's much harder.

I wouldn't want this question to get labelled as "not a real question" or "subjective" because of that last question. My main questions are 1 & 2 & 3. An answer on 3 is optional, and could also be posted as a comment. It's the one I'm least interested in.

closed as primarily opinion-based by Scant Roger, Ixrec, user40980 Nov 21 '15 at 16:23

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • Considering all the meta commentary in this question I suppose I should try to explain why this still isn't a great question. 1) Asking multiple questions in one question is discouraged, as it usually makes the question too broad or really awkward to answer. 2) Asking a question about "all" or "which" programming languages is usually too broad and/or an open-ended list question. 3) As you said, #4 is purely subjective. Acknowledging that it shouldn't be there doesn't change the fact that it shouldn't be there. – Ixrec Nov 21 '15 at 15:38
  • But there is an answerable question in here, namely "If I defined classes called Character or Object, would anything break?". I believe that would fit well on StackOverflow (assuming it hasn't already been asked there). – Ixrec Nov 21 '15 at 15:40
  • Thing, Item, WorldObject pops up in my mind; having a class called Object is akin to redefining false to true (e.g. in python) – Thanos Tintinidis Dec 18 '15 at 12:45
up vote 0 down vote accepted
  1. It is not a problem in a language with different namespaces as java, it may be confusing thought.
  2. Same as 1.
  3. Same as 2.

A real problem would arise only in languages with a global namespace for some kind of objects, as function in C: in C functions are all in the same global namespace and are not overloadable, so you can not declare two functions with the same name or there would no way to distinguish between the two versions. It is for this problem that usually libraries use some prefix/suffix. In Java there is no problem if they are in different namespaces: if there is a conflict in names you can always use the full name.

Not the answer you're looking for? Browse other questions tagged or ask your own question.