Questions tagged [naming]

Give meaning and explanation with the fewest number of characters in a form that is most accepted by your team or community at large.

Naming applies to areas like the following:

  • Naming convention for code (objects, routines, etc.)
  • Processes (projects, version numbers, etc.)

There are existing standards from which you can choose, for example Hungarian.

This area can be filled with strongly held opinions. Be mindful of Stack Overflow's view of subjective. Keep in mind employers might set the standard and this tag is for those who need to better understand those set standards.

656 questions
70
votes
22 answers

Naming conventions: camelCase versus underscore_case ? what are your thoughts about it?

I've been using underscore_case for about 2 years and I recently switched to camelCase because of the new job (been using the later one for about 2 months and I still think underscore_case is better suited for large projects where there are alot of…
poelinca
  • 353
67
votes
7 answers

How to name something when the logical option is a reserved keyword?

Occasionally, the most logical name for something (e.g. a variable) is a reserved keyword in the language or environment of choice. When there is no equally appropriate synonym, how does one name it? I imagine there are best practice heuristics for…
29
votes
6 answers

In what language should I name my business classes?

I'm requesting best practice with this question. This is only an issue if the customer company is strictly national has a native language other than English, I think. If the customer has a lot of mainly very domain specific (say, German)…
Zeemee
  • 411
  • 3
  • 7
29
votes
5 answers

Why it is called "hash table", or "hash function"? Hash doesn't make any sense to me here

It's now about 4 years of development that I'm using, hearing, talking about, and implementing hash tables and hash functions. But I really never understand why it's called hash? I remember the first days I started programming, this term was kind'of…
Saeed Neamati
  • 18,210
28
votes
8 answers

Meaningful concise method naming guidelines

Recently I started releasing an open source project, while I was the only user of the library I did not care about the names, but know I want to assign clever names to each methods to make it easier to learn, but I also need to use concise names so…
000
  • 4,575
24
votes
13 answers

Are short abbreviated method/function names that don't use full words bad practice or a matter of style?

Is there nowadays any case for brevity over clarity with method names? Tonight I came across the Python method repr() which seems like a bad name for a method to me. It's not an English word. It apparently is an abbreviation of 'representation' and…
Alb
  • 3,359
17
votes
1 answer

What does "flatten" mean?

If I had a tree, would "flatten" intuitively imply get a list of all items in the tree, traversing from left to right? If i have a linked list, would "flatten" intuitively imply get a list of all items, starting with this one For example, a…
GregC
  • 311
  • 1
  • 2
  • 9
16
votes
3 answers

Multiple classes with the same name, but different namespaces?

I've run into some code (C# if it matters) that has classes which have the same name, but differ in their namespaces. They all tend to represent the same logical thing, but often are different "views" of the same object. The different namespaces are…
Telastyn
  • 109,398
14
votes
9 answers

What do you do when your naming convention clashes with your language?

Okay, this is one of those little things that always bugged me. I typically don't abbreviate identifiers, and the only time I use a short identifier (e.g., i) is for a tight loop. So it irritates me when I'm working in C++ and I have a variable that…
Jon Purdy
  • 20,547
14
votes
4 answers

Word for the superset of files and folders

I'm trying to come up with a name for a class that can represent both files and folders. Anyone know a word for this?
13
votes
3 answers

How to name arrays or list when the nouns are both singular and plural?

Generally variables are named in the singular Car car; and arrays and list with the pluras: List cars; or Car[] cars; But what about nouns like fish or media* that are already plural? *already lost the battle to have the class called Medium.
Sled
  • 1,868
  • 3
  • 17
  • 24
11
votes
6 answers

How do early version numbers work for new products?

I'm currently writing a small desktop application for a friend, but I'm doing it primarily as a learning experience for myself. In the spirit of getting educated and doing things The Right Way, I want to have version numbers for this app. My…
Pops
  • 4,113
9
votes
7 answers

Use of past tense (passive voice) to connote immutability? (E.g. Array.Transposed vs. Array.Transpose)

[Note: The below is a bit C# heavy in its syntax and conventions, such as citing FxCop rules, because this is my background, but the intent of this discussion is to be language-agnostic and the code examples used should generally be regarded as…
8
votes
2 answers

How to deal with libraries that use different naming conventions?

I'm working on a personal project that uses a few different libraries, such as GLFW, glm and Bullet. How are different naming conventions usually dealt with in this context? Working with C++ I always used the same convention the standard library…
Luke B.
  • 191
7
votes
4 answers

Is it bad practice to use the same name for arguments and members?

Sometimes I write constructor code like class X { public: X( const int numberOfThingsToDo ) : numberOfThingsToDo( numberOfThingsToDo ) { } private: int numberOfThingsToDo; }; or in C# class X { public X( int numberOfThingsToDo ) …
stijn
  • 4,138
1
2 3 4