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
The results are in! See what nearly 90,000 developers picked as their most loved, dreaded, and desired coding languages and more in the 2019 Developer Survey.

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.

-2
votes
7answers
2k views

C++ namespace name isolation

It's been considered for a reason, that using for namespaces/names is side-effect-prone, and generally, fully qualified names should be preferred. I've come up with an approach on that, which I ...
0
votes
1answer
55 views

Need help with naming substate

I'm designing an application which accepts a command, processes it and produces a result. Application will maintain the status of the input command as 'new', 'processing' and 'completed' as it ...
28
votes
7answers
7k views

Is hungarian notation a workaround for languages with insufficiently-expressive static typing? [closed]

In Eric Lippert's article What's Up With Hungarian Notation?, he states that the purpose of Hungarian Notation (the good kind) is to extend the concept of "type" to encompass semantic information ...
1
vote
1answer
70 views

What should I call a flag to maybe disable some behaviour? [closed]

Say I have a function: def foo(x): if x % 2: do_something_with(x) return x And I want to make the doing of something opt-outable: def foo(x, maybe_do_something_with_x=True): if ...
98
votes
16answers
33k views

What is the benefit of not using Hungarian notation?

One of the things I struggle with is not using Hungarian notation. I don't want to have to go to the variable definition just to see what type it is. When a project gets extensive, it's nice to be ...
21
votes
7answers
3k views

Why is XML not called EML?

From Wikipedia Extensible Markup Language (XML) is a set of rules for encoding documents in machine-readable form. It is defined in the XML 1.0 Specification[4] produced by the W3C, and several ...
50
votes
4answers
72k views

What's the dominant naming convention for variables in PHP: camelcase or underscores? [closed]

The consensus seems to be that one should follow the convention of the platform they're developing for. See: Underscore or camelcase? Naming conventions: camelCase versus underscore_case? However, ...
2
votes
4answers
2k views

Should I avoid using spaces in my filenames?

I sometimes find experienced programmers who will actively avoid using spaces in their filenames, opting to use underscores or camelCase instead. (i.e. /org map/attach jobs.cpp vs /org_map/...
22
votes
6answers
4k views

What are the benefits of prefixing function parameter names with p*?

I often see projects (in Java projects and teams using Eclipse) that prefix function parameters with p. For example public void filter (Result pResult) ... I personally don't see any benefit in ...
3
votes
4answers
276 views

Is a constant name related to its current value an anti-pattern? [closed]

For example, suppose I have a string constant like this: const TITLEBAR_MESSAGE="Welcome back, %USERNAME%!"; I think it is more readable when it is named as const WELCOME_BACK_USERNAME="Welcome ...
0
votes
5answers
132 views

Does a server send a client a ServerMessage, or a ClientMessage

Suppose I have a server and a client. When I send a message to the client, would I be sending a ServerMessage, or a ClientMessage? The other way to think about it - when I receive a message, it is a ...
2
votes
5answers
274 views

Is it a good practice to use method names that flow properly when spoken? [closed]

For example, suppose if I had a Character class and an inventory, before taking out a weapon to use it, it's probably a good idea to check if that weapon exists first, so I might have a method called ...
0
votes
2answers
126 views

How to understand coalesce in MySQL?

coalesce definition in Cambridge Dictionary: If two or more things coalesce, they come or grow together to form one thing or system. to combine into a single group or thing But in MySQL, ...
-1
votes
1answer
155 views

For use once only functions extracted from a longer function, should the name be xxx1(),xxx2,… or relate to its task?

According to Is it OK to split long functions and methods into smaller ones even though they won't be called by anything else?, I should split long functions into smaller functions even if they ...
95
votes
6answers
18k views

What is a term for a function that when called repeatedly, has the same effect as calling once?

(Assuming a single-threaded environment) A function that fulfills this criterion is: bool MyClass::is_initialized = false; void MyClass::lazy_initialize() { if (!is_initialized) { ...
-3
votes
1answer
127 views

How to name the function of a thing differently than the thing itself?

A sensor identified by the serial number “ABC1234” fulfills a measurement function identified by the name “Pressure sensor 7” in a production facility. Within the production facility, nobody cares ...
0
votes
1answer
82 views

Way to describe a coordinate system without external points of reference?

I'm writing an API for a JavaScript library to let my users offset an object from another. I have to provide my user with a way to describe a "vertical" and "horizontal" offset. My problem is that I ...
0
votes
2answers
87 views

Is this a proxy or bridge or something else?

I have an object that acts as a "bridge" between objects and I'm not really sure if it has a name. Unity (the game engine) lets me build a concrete object and then link those objects in the inspector ...
0
votes
1answer
44 views

Name for a library that provides an API for other libraries

I've been working on a library at work which provides a simplified API for a few underlying libraries (face recognition, text to speech, etc.). My boss asked me the best way to describe this concept ...
-1
votes
1answer
616 views

What to name package and their facade classes?

I'm using a some C++ Facade classes like this: Suppose that there is package named "SubSystem" with a lot of classes inside, like in the picture above. I cannot name the package of the facade ...
0
votes
2answers
157 views

What to name a class that acts as a container for a collection but isn't a collection itself?

I have an object that acts as nothing more complicated than a data store for a collection of items. I do this because it lets me bind the data to a single object, which I can store in the Unity (game ...
1
vote
1answer
152 views

Should “Impl” naming always be avoided?

When implementing interfaces, as a general rule, Impl is evil. Ok, but is it evil in the following case? I've a service that has (and probably will have) only one implementation. In such case, ...
0
votes
2answers
57 views

How to name and organize unit tests with combinations of multiple parameters?

I am new to unit testing, but finally getting started. I have been running into a situation where my unit test names apparently grow too long to readable due to the multiple parameters and ...
-2
votes
1answer
62 views

What is a common name for a module being tested?

When writing unit tests, I want to reduce the cognitive load of the reader as much as possible. One thing I've noticed that bothers me is that the variable names of the thing that is being tested are ...
2
votes
5answers
865 views

CamelCase issue (PList or Plist)

Ok, I understand what CamelCase is. This question is relating to how to CamelCase the shortened version of Property List (PList). I am asking this because I am working on a PList parser in C# and ...
2
votes
3answers
93 views

Convention for labelling coordinate axes in 3d graphics

When I recently started doing some 3d graphics, I carefully (tried to be careful, anyway) decided to use the conventional mathematical standard for labelling axes, which was much more convenient for "...
2
votes
1answer
94 views

Do we have distinct type of branches?

There is what we call feature branch in git. Imagine for example I am making a game and I need to add a Power-up feature. How I see my commits names with feature branches: Branch name: Adding Power-...
-2
votes
2answers
100 views

What would you call two elements in an array that are only related to each other through their positions? [closed]

I have an array that holds valuable data related to what I stored in a setup / onboarding process: $imported_headers = [ 'headers_2', 'headers_3' ]; Given the fact that these elements are from the ...
0
votes
5answers
226 views

Is using overly specific names for variable/class/component names a good or bad practice?

Let assume that we have a system in which the users can chat with each other and we are working on the backend. We can name the service which fetches the chats in one of the following ways: ...
34
votes
4answers
6k views

Is it enough for methods to be distinguished just by argument name (not type)?

Is it enough for methods to be distinguished just by argument name (not type) or is it better to name it more explicitly? For example T Find<T>(int id) vs T FindById<T>(int id). Is there ...
63
votes
11answers
7k views

Why are cryptic short identifiers still so common in low-level programming?

There used to be very good reasons for keeping instruction / register names short. Those reasons no longer apply, but short cryptic names are still very common in low-level programming. Why is this? ...
-2
votes
1answer
53 views

How do I name a service that adds a line item to the quote?

I have an object called LineItem, which can be added to an object called Quote. A Quote can have 0 or more of LineItem. I have a service, which is a class, whose purpose is to add LineItem to the ...
1
vote
1answer
142 views

Using “On” at the start of a method name

From what I've observed, methods that start with the word "On" fall into two categories: A base class that defines an event will expose a protected method whose name starts with "On" followed by the ...
3
votes
1answer
164 views

Application_Start() vs ApplicationStart()

Why is the method in Global.asax called Application_Start() and not ApplicationStart()? According to MSDN method names should be in Pascal case.
0
votes
1answer
57 views

Variable naming for collaboration between software engineering and data science

There exist lots of discussions on variable naming. However, I would like to address a specific aspect. I am a data scientist and deal with dozens of features/variables/columns — however you may call ...
-1
votes
1answer
152 views

What software pattern is one where I simply assemble things, such as create an array of certain type of data?

TL;DR: what do I call a section of code that is used to assemble a Graph object? I have a fairly large section of code that is duplicated in a few areas. I wish to extract it into its own class. ...
-2
votes
2answers
55 views

Interface name for time-based classes

I'd like to document that code encapsulated in a class is "time-based" in a Java-like language – the code behaves differently based on what time it is currently. To make it testable, it would read ...
9
votes
3answers
16k 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 ...
2
votes
1answer
46 views

Does any scale exist (e.g. naming convention to be used for sizes) that allows trivial insertions at any point in the scale?

Question probably sounds confusing so let me clarify. Let's say I have an object containing keys and values for my project's font sizes: { small: '8px', medium: '11px', large: '14px', } ...
3
votes
1answer
570 views

Why is Systems Hungarian commonly used in the VB world, and seemingly nowhere else?

Kind of as the title implies - I can understand why Apps Hungarian might crop up, but Systems Hungarian seems almost entirely pointless in a strongly-typed language. Why, then, is it so apparently ...
0
votes
0answers
55 views

Naming convention for string constants and string functions

I'm creating a react application, and I want to keep all my string constants in a single file like: export const STR_LOGIN = "Log in"; //h1 on a login page export const STR_USERNAME = "Username"; // ...
7
votes
4answers
621 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 ...
3
votes
1answer
298 views

Avoid smurf naming while wrapping a library

I'm programming against a API Library which provides classes like Document, Folder, ContentElement, Action... These classes are basically just their respective representation from the database. I'd ...
4
votes
3answers
381 views

Proper way to name a class which has just methods and not fields

GOAL: naming a class which has the responsibility to save data in Android database. The class structure is like this ClassName { public void saveSync(...){ /* implementation*/ } public ...
1
vote
1answer
97 views

Succinctly naming an Either object

I have an object that wraps an Either<T,T[]>. It can only be either a single instance of T or an array of T[] but I don't know at compile time. What do I name the class, and what do I name an ...
1
vote
0answers
182 views

What is a Function that Creates Functions Called?

Let's say I have the following function (in JavaScript, for sake of example): function foo() { var bar = function () {return 'lol';} return bar; } This function returns other functions. I had ...
0
votes
2answers
124 views

Nomenclature for object inspection functionality

I'm adding mod support for a game I'm working on. I parse a data file that looks something like this: "requirements": { "is_class": { "class": "warrior" }, "is_in_faction": { "faction": "...
1
vote
4answers
585 views

Why do people prefix property names with class names [closed]

Especially when working with some kind of ORM like Entity Framework I often see classes like: public class Foo { public int FooId { get; set; } } accessing the id will look like foo.FooId Is ...
1
vote
1answer
534 views

Naming a Domain Model project

This question follows on from my other question here: How does an isolated class (or group of isolated classes) fit into a Domain Model? I have looked at a few domain models online: https://github....
2
votes
1answer
357 views

Naming conventions for pure functions

Are there 'conventions' / best practices on naming pure functions? For example: adding numbers: add or sum? calculating the square root: calcSqrt or sqrt? reversing a list: reverse or reversed? ...