Stack Exchange Network

Stack Exchange network consists of 175 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

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.

11
votes
5answers
3k views

What's the idiomatic name for a throwaway variable? [closed]

Velocity Template Language's set directive requires a variable on the left hand side. This doesn't work. #set ( $entries.add("d") ) Even though I have no use for the return value of add("d"), I have ...
11
votes
8answers
9k views

Variable naming conventions? [closed]

I've just started using ReSharper (for C#) and I kind of like its code smells finder, it shows me some things about my writing that I meant to fix a long time ago (mainly variable naming conventions). ...
11
votes
7answers
1k views

What is more standard shortening for “regular expression”, “regex” or “regexp”? [closed]

I want to know what is more standard way to call regular expression in short way. I have seen both, regex and regexp. Google says regex has almost 2 as much hits that regexp, but it depends on way I ...
11
votes
6answers
1k views

Naming: Should you sacrifice briefness for clarity?

For example, the following function loops through an array which contains the name and errors of an input field. It does this by checking the name of the validating field and then pushing the error ...
11
votes
6answers
7k views

Do variable names affect the performance of websites?

Do variable names affect website performance? I know this will going to be very low number, but still can any one provide the reasons for not choosing a long variable name in aspect of performance?
11
votes
6answers
2k views

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 ...
11
votes
6answers
33k views

Naming conventions used for variables and functions in C [closed]

While coding a large project in C I came upon a problem. If I keep on writing more code then there will be a time when it will be difficult for me to organize the code. I mean that the naming for ...
11
votes
4answers
1k views

Stored procedure Naming conventions? [closed]

One of our senior developers has stated that we should be using a naming convention for stored procedures with an "objectVerb" style of naming such as ("MemberGetById") instead of a "verbObject" type ...
11
votes
7answers
832 views

What is a good alternative to the name variable for a language that only has immutable references or labels?

For example, in functional languages, variables are single assignment and their values are immutable once assigned. So they have two states unbound and bound, once bound they can't be changed. Is ...
11
votes
3answers
11k views

Use of “this” in Golang

On the closest thing Golang has to a style guide found here, under Receiver Names this is written: The name of a method's receiver should be a reflection of its identity; often a one or two letter ...
11
votes
1answer
4k views

What does `Resolving` mean in programing? [closed]

I see in many places where the word Resolve is used, in Dependency Injection (resolve an implementation to an interface), Package Managers (ex: Resolve packages dependencies), Web (ex: Resolve a ...
11
votes
3answers
5k views

C project avoiding naming conflicts

I'm struggling to find pragmatic real-world advice on function naming conventions for a medium sized C library project. My library project is separated into a few modules and submodules with their own ...
10
votes
6answers
10k views

What do you call classes without methods?

What do you call classes without methods? For example, class A { public string something; public int a; } Above is a class without any methods. Does this type of class have a special name?
10
votes
5answers
768 views

How to refer to ByRef and ByVal in a dropdown label? [closed]

The MSDN page on ByRef and ByVal keywords isn't very helpful; unless I somehow skipped it, they're simply being referred to as "keywords" everywhere. One of the main contributors of the Rubberduck ...
10
votes
2answers
4k views

Java class version specific naming conventions

I have to create an Adapter between two software (mech. simulation, non-cs). Assuming we have a class named ThatThing. I have to handle various vendor specific implementations. These versions don't ...
10
votes
6answers
7k views

Is the term “web portal” obsolete?

My boss uses the term "portal" for the project I work on all the time. To me, the word makes me think of Yahoo in the late 90s. Does the word "portal" have old-school connotations, or is it just me? ...
10
votes
3answers
974 views

What's the reasoning behind the “I” prefix naming convention for interfaces in .NET?

I know the "I" convention has been around since COM, but I've never understood why it hasn't been reconsidered like every other naming convention before .NET has. Consumption wise, the only thing ...
10
votes
4answers
673 views

What is the name of the functional argument in fold

In the higher order function fold/reduce what is the name, if any, of the functional argument? I am working on a monadic tabular processing library where rows are folded to produce simple analyses (...
10
votes
4answers
580 views

How to avoid general names for abstract classes?

In general it's good to avoid words like "handle" or "process" as part of routine names and class names, unless you are dealing with (e.g.) file handles or (e.g.) unix processes. However abstract ...
10
votes
3answers
2k views

In Java 8, is it stylistically better to use method reference expressions or methods returning an implementation of the functional interface?

Java 8 added the concept of functional interfaces, as well as numerous new methods that are designed to take functional interfaces. Instances of these interfaces can be succinctly created using ...
10
votes
3answers
2k views

Struggling not to use Hungarian notation

I've seen arguments for and against Systems Hungarian. For some years I've been working on a legacy project that uses this system by naming every variable, function with a prefix of the variable type ...
10
votes
4answers
13k views

Naming boolean field that is a verb

In Java, by convention getter and setter for boolean fields will be isField() and setField(). This works perfectly fine with field names that are adjectives like active, visible, closed, etc. But how ...
10
votes
3answers
684 views

Which is better for small bug fixes and small features - naming branches by ticket number or naming them by feature description?

I am in the middle of a disagreement (cordial, of course) with my lead about proper branch naming. This applies to bug-fix and small feature branches, not long-running feature branches. For long-...
9
votes
4answers
8k views

Java abstract class naming

Example: You create an abstract class for Ajax actions. Different Ajax actions will all extend this class. Problem: Do you name the class AjaxAction or AbstractAjaxAction? When you create ...
9
votes
5answers
6k views

Is having C++ header files without extension a good practice?

I have an argument with a collegue of mine regarding the C++ guidelines to follow. He currently designs all his libraries that way: He uses inconsistently uppercase and lowercase letters in his ...
9
votes
1answer
660 views

Naming of related classes and interfaces

I have created an ObjectParser class which parses data into strongly typed objects using an IObjectParserDataSource as the data source (the data could be an Excel file, text file, array, query string, ...
9
votes
4answers
362 views

File naming convention for images stored in version control?

My application has an icon file which is stored in version control. Now tomorrow I might decide to change the icon. I'm debating between two possible naming conventions for the icon file: Keep the ...
9
votes
7answers
4k views

What do you call a customer's customer in a specification document, use case, or scenario?

My team and I develop software that our customers will use to interact with their customers. Additionally, we also eat our own dogfood and use the software ourselves to interact with our customers. ...
9
votes
3answers
17k views

How to deal with Classes having the same name (different packages)

Me and my R&D team maintain a large codebase. We've divided our business logic into multiple packages. some of which have classes with identical names. As you can guess, the names conflict when ...
9
votes
4answers
489 views

Naming classes becomes debilitating [closed]

I'm not sure if this is an OCD trait or not, but I find that sometimes I get completely blocked unable to continue what I am doing when naming a class (or function, or namespace etc) that I believe is ...
9
votes
3answers
12k views

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" ...
9
votes
4answers
6k views

Choosing names for integration tests

With unit tests the domain is quite small, so it's easy. I used Osherove's methodName_conditions_result() scheme and found it very clear. But with integration tests I feel like it would make a very ...
9
votes
5answers
353 views

How do you avoid name similarities between your classes and the native ones? [closed]

I just ran into an "interesting problem", which I would like your opinion about: I am developing a system and for many reasons (meaning: abstraction, technology independence, etc) we create our own ...
9
votes
3answers
4k views

Why is Quicksort called “Quicksort”?

The point of this question is not to debate the merits of this over any other sorting algorithm - certainly there are many other questions that do this. This question is about the name. Why is ...
9
votes
4answers
433 views

Word for the superset of files and folders [closed]

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?
9
votes
1answer
7k views

What should be done with class names that conflict (common) framework names

What should be done exactly when the most obvious class name for a component is taken by a framework? In my case, I need to make a class that describes an HTTP request. Of course, the most common name ...
9
votes
1answer
7k views

Naming convention for test packages

We're actually naming our test packages just like their to-test counterparts. So we end up with this structure: src/main/java com.hello.world helloWorld.java src/test/java com.hello....
9
votes
5answers
379 views

How to make it obvious that a function is being accessed from the outside?

This is a C specific question. I am trying to keep everything possible inside the translation unit boundaries, exposing only a few functions through the .h file. That is, I am giving static linkage to ...
8
votes
2answers
18k views

Naming convention: field starting with “m” or “s”

I saw lot of code (for example some Android source code) where fields name start with a m while static fields start with s Example (taken from Android View class source): private SparseArray<...
8
votes
7answers
2k views

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 ...
8
votes
2answers
4k views

Should APIs be in en_US or en_GB or both? [closed]

Should I write APIs in US spelling or British spelling? Or should I provide with mapping both of them to a single one and internally using anyone which I like so that both of them works ? At present ...
8
votes
3answers
2k views

Naming convention for functions which have side effects? [closed]

I heard somebody say their language has a convention where the names of functions which mutate state must end with an exclamation point. I'm trying to write more functional code and I like the idea of ...
8
votes
2answers
138 views

What do you do when working with multiple languages with different capitalization schemes?

I'm making a webapp using Django. The Python convention for naming variables is lowercase_with_underscores, but the Javascript convention is camelCase. In addition, I've seen many people use ...
8
votes
3answers
4k views

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

Generally variables are named in the singular Car car; and arrays and list with the pluras: List<Car> cars; or Car[] cars; But what about nouns like fish or media* that are already plural? *...
8
votes
1answer
3k views

Should methods that return boolean be named after a question or an assertion? [closed]

Many naming conventions recommend that methods returning a boolean (also called predicate methods) should be named after a question. My question is: don't they really mean the methods should be named ...
8
votes
6answers
10k views

What naming conventions do you use for php classes? [closed]

I really like using ClassNames and memberNames as convention but I am not sure how I would name the file containing a class. I like making my classes defined in a file with the exact same name as the ...
8
votes
9answers
1k views

What do you call the test suite developers run before checkin? [closed]

I'm working on a project where we're adding automated testing to an existing project. We're starting with a central component, and setting up both unit tests at the code module level, and tests that ...
8
votes
2answers
5k views

How should I name functions that return values in Python?

I'm confused about choosing names for my functions in Python. Sometimes Python built-in functions are imperative such as: print function and string method find. Sometimes they aren't such as: len its ...
7
votes
10answers
9k views

Variable names: underscores, no underscores, or camel case? [closed]

Variable names can be written in many ways, but the most common that I'm familiar with are: thisisavariable, this_is_a_variable, and thisIsAVariable. Which of these are preferred, and why?
7
votes
4answers
637 views

Is it a good practice to end a function's name with a preposition?

I have seen examples of methods whose name ended with a preposition applying to the first (and most often only) parameters. But other examples don't use this kind of naming convention. Which do you ...