views:

161

answers:

10

With the exception of this site, what resources are out there that I don't know about for naming of things in your code?

We all know that a good name can really focus your understanding of something and aid communication within a team. How do you do it?

I'm not talking about naming conventions or what types of names are good or bad.

EDIT

By including a mildly humorous link in the question I seem to have diverted attention away from the actual purpose of this serious question. For the record, that is not my site.

There are many commonly used words in computing. Many of them are quite general and don't really convey any specifics of what something actually does. Many condemn the usage of suffixes such as Manager, but are terms such as Provider, Server, Client really that much better? In any application of significant scale there may be several different scenarios in which something could be considered a server, but for quite different reasons.

The English language is a far richer source of words than the average programmer apparently gives it credit for. And for all its richness, there are plenty of terms that are neither obscure nor confusing and could be neatly applied in the naming of program elements or even system components.

As programmers we comfortably use dozens -- even hundreds -- of terms that aren't in general daily usage outside of our field. Many of these words have been borrowed from the sciences or the depths of a dictionary, and they precisely describe something that we now take for granted.

So my question is, what do you use to uncover these terms?

Personally I find a thesaurus helpful but I didn't want to seed the discussion.

A: 

You don't need a resource to name a class or a method. Depending upon what functionality the class or the method is offering you define a name.

Bhushan
Often you don't need a resource, but sometimes I find a thesaurus can breathe some life into the code base's vernacular.
Drew Noakes
A: 

What is the class responsible for? Name it that.

Kramii
What if you spend some time and the best name you come up with doesn't really reflect what it does?
Drew Noakes
Then either:* You don't understand the problem domain well enough.or:* You should go with the best you have (even if you make up a word) and add comments to explain. You can always refactor the name later if you come up with something better.
Kramii
A: 

Its probably very difficult to give you a formula for naming. Arrive at some meaningful name. Here meaningful is intangible and cannot be measured. One thing ...

After you name something, just check if the name is short, simple and easy to understand for everybody.

Alphaneo
Thanks. I am not asking about process, I am asking about resources.
Drew Noakes
+1  A: 

Apart from the obvious answers already posted by others I'd say the only 'resource' that I use would be my coworkers. I hope they dont mind being called resources :) If you are struggling with a name you could always try and discuss it with someone else. Bounce a few ideas with them and another point of view is always useful.

willcodejavaforfood
A: 

My Brain.
Obviously.

shoosh
+1  A: 

I really recommend you read the book Code Complete Second Edition. It has its own section for how to name classes and variables ect. Really good literature, and after reading you wont need tools like "Name that class" again.

ChrisAD
A: 

When i was going to use an IDE years ago (coming from vi, now using Netbeans) that was one of the most important tools that i than found: Refactoring. Refactoring (apart of other things) allows you to change names in a hush. So maybe don't think too much at beginning of "good" names. With refactoring support you can change it at any time.

I, too, love refactoring tools. But they don't help you come up with the names.
Drew Noakes
It helps get over "coders block" if you know you can go back and fix poor names later.
Kramii
+1  A: 

I would recommend that you use this tried-and-true technique. Whenever you're ready to create a new class, stop and take your hands off of the keyboard. You should have a sensory-deprivation chamber handy. Enter the chamber after the usual preparations. Spend about 35-40 minutes in the chamber. While you're in the chamber, you need to picture yourself as the class. Ask yourself these questions: What do I want to do? What kind of contribution would I like to make to society? (That is, the other classes around me.) What name would make me happy?

It's important to do this for every class you create. If you create some classes without using this naming technique, you'll get a weird mish-mosh of class names, and your design won't make any sense.

Before using this technique, consult your personal physician. I'm not a doctor, but I've seen one on TV.

Don Branson
Nice. And if you could, what resources would you take into the sensory deprivation chamber with you, ignoring the fact that they'd defeat the purpose of sensory deprivation? I'd have a thesaurus handy myself.
Drew Noakes
@Drew - :) ____
Don Branson
+1  A: 

I ran into this one the other day, a small but insightful article about goal-oriented vocabulary, which got me thinking about this thread.

Marcus
Cheers Marcus. An interesting article. Actually Dan North is an old friend of mine. It's nice to have an organic link back to him :)
Drew Noakes
A: 

The original text on categorisation was written by Aristotle in 350 BC.

http://classics.mit.edu/Aristotle/categories.html

Worth a read if you wish to refine the definition of terms relating to categorisation.

Drew Noakes