Sign in to follow this  

Fun with naming - what to call Wall/Ground/Ceiling class

This topic is 4532 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Recommended Posts

Hello, in the project I'm working on (2d sidescroller) I used to have separate Ground/Wall/Ceiling classes, but I rewrote the collision detection code so that it didn't need to have separate classes for all three. So, any ideas on what to call this Ground/Wall/Ceiling class? Best I could come up with so far is "Terrain".

Share this post


Link to post
Share on other sites
Yeh, "CollisionSurface" sounds fine.

The dirty little secret (well, one of them) of OOP, though: Trying to figure out "the perfect class name" is a quixotic goal. Give it the first (or second) name that comes to mind, and DOCUMENT IT INTELLIGENTLY. The name shouldn't be misleading, of course, but documentation is much more important than perfect naming.

Share this post


Link to post
Share on other sites
Funny. I had the same problem last week. The name I ended up using was barrier. Thesaurus.com is your best friend when it comes to these types of problems.

Share this post


Link to post
Share on other sites
Haha I thought I was the only one who checked the thesaurus for for class names ... Entity, CollisionSurface, CollisionObject, FreeBody, Terrain, any should do.

Share this post


Link to post
Share on other sites
I would suggest the name "Surface". I'm not sure if it is appropriate to use prefixes like "Level" or "World".. I think I would prefer to use namespaces if any ambiguity between different parts of the code occurs (as surface could represent many things).

Share this post


Link to post
Share on other sites
Well, you could try "Solid" or "Block"... All of the other good stuff is taken. *Looks accusingly at a mirror, right before it shatters*

Share this post


Link to post
Share on other sites
I would'nt worry too much about the class name anyway. You'll soon find out if there is something wrong with the one you chose and with a decent IDE it should'nt be difficult to change the name of the class later.

Share this post


Link to post
Share on other sites
Use inhertance and name is whatever you want, which also aid in the future when u may need to have distinctions between the types. Just remember than cObject can only communicate with cFloor via virtual functions but cFloor knows all of cObject.

class cObject;
class cFloor : public cObject;

CheckCollision(cObject *pObject);


But this is assuming ur using c++...

Share this post


Link to post
Share on other sites

This topic is 4532 days old which is more than the 365 day threshold we allow for new replies. Please post a new topic.

If you intended to correct an error in the post then please contact us.

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this