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
2answers
90 views

What's the proper name for code that tests another code? [on hold]

That seems like a stupid question, but I can't find a proper name for "code that tests another code". The most of literature names that kind of code just "tests" but it's way to general in my ...
0
votes
2answers
98 views

Is this a proxy or bridge or something else? [closed]

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 ...
-1
votes
2answers
103 views

Common way to name methods with same name as desired variable? [closed]

I frequently find myself pulling up helper methods in order to make my code better, but end up with duplicate method names. Is there a standard way to name such methods without getting duplicate names?...
0
votes
0answers
33 views

How to discern between 'set' present tense and 'set' past tense? [migrated]

I have a telegram convention, where whenever an action must be taken, it uses a verb in its name. I then use present tense for the request and past tense for the reply, e.g.: orderStart to start an ...
-3
votes
2answers
46 views

Naming lower and upper threshold of a metric [on hold]

I am creating an API that will expose a list of metrics data. Each metric data will contain the following: metricName lowerThreshold upperThreshold The defined thresholds here are what will ...
0
votes
2answers
104 views

Booleans Naming conventions : How to prefix a “show” boolean? [closed]

I've seen here that it was a dividing topic to use "should" as a prefix for a boolean because it could mean that we're unsure. Then how would you prefix a boolean such as "myButton.shouldShow"? I ...
0
votes
3answers
186 views

How to understand coalesce in MySQL? [closed]

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
44 views

How to name base classes so that it's most convenient for those extending a framework? [closed]

I'm designing a game engine that is supposed to be overridden. I have, for example, a class called Character. Should I prefix this with BaseCharacter or should I expect that whoever uses the framework ...
-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 ...
1
vote
1answer
58 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 ...
51
votes
4answers
73k 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
284 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
279 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 ...
-1
votes
1answer
157 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
1answer
46 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
637 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 ...
-1
votes
2answers
167 views

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

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
157 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
62 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
66 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
869 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
98 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
95 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
107 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
227 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 ...
64
votes
11answers
8k 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? ...
1
vote
1answer
153 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
174 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
59 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
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 ...
2
votes
1answer
47 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
593 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
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 ...
3
votes
1answer
317 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 ...