Questions tagged [naming-standards]

Naming standards is about defining rules about the use of symbols such as the name of namespaces, packages, modules, types, functions, or variables

Filter by
Sorted by
Tagged with
-1 votes
1 answer
72 views

Workaround for digits in beginning of identifier

Suppose I have a std::span-like type, that represents a matrix or an image, or a class modelling a 3d mesh. I would like to say template<class T> class 2d_span; class 3d_mesh; But that would ...
23 votes
5 answers
5k views

Best Practice - Avoid naming class and field the same?

When modeling classes I always have stumbled on the problem that the class has a field with the same name. Look at this example: class Name { string meaning; string language; string name; /...
  • 347
0 votes
2 answers
235 views

Can a UUID be called a constant?

From my understanding, a constant is a value which is assigned only once and cannot change at runtime, whereas variables have mutable values which are unpredictable by nature. My question is, to what ...
  • 53
3 votes
4 answers
245 views

Does it make sense to use the word 'Set' in a class as an umbrella term for both sets and individual items?

For instance, if I'm modeling a book collection and I want to be able to represent sets of books that come together (like an encyclopedia series), the sets may share a lot of properties that ...
0 votes
1 answer
135 views

Best way to name derived classes when extending its functionality [closed]

I have just recently joined a new company and one of the classes used to log information has not been written properly. So I have been asked to add new functionality to the logger. Rather than ...
1 vote
2 answers
2k views

Naming convention for Boolean arguments

In many languages, the convention for naming Booleans is typically to prefix them with "is", "has" or "can". This convention seems to be applied mostly to fields and ...
  • 121
2 votes
1 answer
966 views

Naming Conventions for microservices

We are currently splitting up our Intranet monolith into multiple (Micro)services. The layout in itself is already finished and we have decided to split them up in a way that there is only ever one ...
  • 249
2 votes
3 answers
1k views

Why would you have a different namespace for each folder in a C# project?

I can't see how having a namespace for each folder makes sense. As near as I can tell, the point of having namespaces is to avoid name conflicts. But, Microsoft, in their namespace naming conventions, ...
-2 votes
1 answer
89 views

Can a local application be called a "client"? [closed]

I'm developing an application that has no client-server connection by design, all of the work is done locally (no internet connection needed), so I'm wondering if I can call it a client? (I'm asking ...
10 votes
7 answers
1k views

Are there historical problems with non-ASCII identifier characters in code?

I frequently encounter recommendations to specifically keep to ASCII characters in field and function names in documentation, even though non-ASCII (modern Unicode) generally works perfectly. An ...
1 vote
1 answer
2k views

Appropriate naming for (GitHub) repositories belonging to the same project [closed]

I have some issues selecting an appropriate naming scheme for GitHub repositories that belong to the same project. The main package repo relies on additional repos to generate documentation or run ...
  • 137
3 votes
5 answers
2k views

Am I understanding the new C# naming conventions right?

A couple months ago, Microsoft updated their C# Naming Conventions (https://docs.microsoft.com/en-us/dotnet/csharp/fundamentals/coding-style/coding-conventions). As the developers of C#, I consider ...
  • 1,423
2 votes
3 answers
699 views

Versioning a function/method

While this might seem more like a piece of an easy task to others, it's honestly not easy for me. At this stage, I find myself wandering how best to version my functions/methods. What does this mean? ...
  • 141
-2 votes
1 answer
643 views

Git semantic commit versioning for file deletions

What commit type should I use when I'm deleting files from a repo? I have seen several types over the internet, but none talk about file deletions. Possibly the closest options that come to mind are ...
1 vote
1 answer
270 views

Naming for services/workers ect

I'm kind of new to this "separate your methods from models" (yes I was one of those developers). From what I understand I have to separate everything into models, services and factories. A ...
  • 121
6 votes
6 answers
4k views

Does using the word "base" in a class name indicate abstraction?

I'm wondering if there is a widely accepted convention for naming base classed in OOP. Does marking a parent class with "Base" indicate that it's abstract or that it's just an extended class?...
  • 169
2 votes
4 answers
410 views

Naming convention for functions that mutate arguments vs creating a new object

Take the following signature BigInt* addBigInt(BigInt* arg1, BigInt* arg2); Traditionally, the safest way to implement this function would be for it not mutate the arguments, and would necessarily ...
-2 votes
1 answer
53 views

How are methods called that prepare/alter some data and then pass it on

I am currently trying to name a method that prepares/alters some input data, then passes it on, and I'm wondering if there is a naming scheme for such methods. Concretely, I have a reusable UI ...
0 votes
0 answers
383 views

Spring boot, n-tier layer structure naming conventions

I am currently developing a huge project in my company with N-Tier Layer architecture using spring boot but I can not sure about the package and class namings. In our project, we have a complex ...
  • 9
5 votes
2 answers
683 views

Function naming: choosing the order of nouns / verbs in the name

I'm sometimes torn between two naming conventions defining the order of words that make up a function name. The first one is choosing the words in the same order we would natural use in a sentence, ...
-3 votes
1 answer
224 views

Standarized prefixes for naming REST POJO (Bad or good practice)? [closed]

We are building a software application for a client with a particular naming convention for REST services. For example if you use a POJO for your request or response in a REST service something like ...
4 votes
3 answers
257 views

Naming function with "proceed"

I am wondering if it is good practice to name function which does the main logic "proceed" + "functionName". I would use that name if there are some checks(if-s, try-catches, etc.) ...
  • 151
-3 votes
1 answer
67 views

What could be a better naming convention for the variable 'completeConfig'?

I have a feature in which the user can directly provide the entire nginx config inside the completeConfig variable in the config yaml. Like this: nginxConfig: completeConfig: > .... .... ...
0 votes
2 answers
188 views

Which approaches are exists for using of possessive case in variables/classes/methods naming?

In variables/classes/methods naming, sometimes "of" preposition is omitted and word order changing, for example: "Absolute path of source file of entry point" -> "...
4 votes
2 answers
211 views

Should the name of a method be less descriptive if its class/module alread is enough?

I have a module or class Random and in it there's a method called generate(). A client will always call it as res = Random.generate(). And from the inside, obviously, it can be called simply as ...
2 votes
3 answers
1k views

What is a good naming convention for Interface Adapters, Use Cases / Interactors, Entities?

I'm using MVVM + Clean Architecture in my app. And I sometimes don't have any idea if my namings are good enough for each Interface Adapters, Use Cases / Interactors, Entities. For View Models, it's ...
-3 votes
2 answers
403 views

Naming conventions for set/unset method parameter

I have some class MyClass which has two methods: Lock(){} Unlock(){} For some reasons, the two methods are to be unified into one, with an additional parameter for indicating the action. What should ...
  • 1,211
0 votes
1 answer
136 views

How to avoid messy code when working with different libraries

I'm planning to work with different libraries that use different conventions. One uses snake_case, another one uses camelCase. This leads to code that looks like I can't make up my mind: Some_Result ...
0 votes
6 answers
2k views

Naming boolean fields in classes

I have had hard times naming boolean fields. On the one hand, i've read that it is good to name them as affirmative statements, like hasAge, or canDance. It's not a problem when naming local ...
-4 votes
3 answers
691 views

Should I prefix keys of JS object with the object's name?

Let's get to an example. Suppose, I have a Course object with the following properties: (course' code, course's title, credit of course etc.). When expressing this as a JS object, I can do it in the ...
1 vote
2 answers
441 views

How to name two versions of the same object, where one has a smaller amount of data and one is the "complete" object

What is the best way to name two classes that describe the same object, but where one of those classes does not hold the complete information? And should I make one of the classes inherit from the ...
  • 161
10 votes
2 answers
2k views

What form of verb to use (imperative verb or third-person verb) in programming?

Here are a few examples: Imperative verb Initialize! InitializeWhenCreated! RequireValue! Third-person verb HasValue? RequiresValue? Are there some rules how to choose either imperative verb or ...
  • 267
24 votes
3 answers
7k views

Why are module-specific prefixes widely used for function names in C modules?

In some C projects, function names start with a common prefix indicative of the module name, for example: mymodule_do_this_stuff(); mymodule_do_that_stuff(); Is there a justification for doing so ...
2 votes
3 answers
883 views

Use prepositions in naming verb-phrase functions?

When writing a library, designing a class or extending some existing API, we often need to express actions or relations involving noun entities: "Place the ball in the bin" "Obtain the coat for the ...
  • 2,489
-1 votes
2 answers
999 views

Python function name convention for "convert foo to bar", e.g., foo_to_bar, foo2bar

I have a function that converts args given by argparse to a filename: def args2filename(args, prefix): filename = prefix kwargs = vars(args) for key, value in sorted(kwargs.items()): ...
  • 117
1 vote
3 answers
1k views

Should I give an object that holds multiple objects of the same type a plural name?

I have an object: const riders = { Dave: { gender: 'male', age: 13, }, Nina: { gender: 'female', age: 16, }, Mike: { gender: 'male', ...
  • 179
2 votes
2 answers
724 views

API naming for authentication API composed by many steps

I have an API which include a registration and login process. Both process have an authentication sub-process. This sub-process are many steps which API validate a client specific data. I have many ...
2 votes
3 answers
2k views

How to name functions with multiple return values

In many languages, it is common for a function to have multiple return values (as a tuple), such as: def foo(): return "Hello, World!", 0 I often do this when a computationally expensive (or an ...
1 vote
3 answers
918 views

How should I name output variables that are the same as the function?

What are some conventions for naming a variable in cases where the name of the variable ought to be identical to the name of the function? I'm using VB.Net. I often have this problem when writing ...
2 votes
1 answer
104 views

Naming a software which allows communication between two independent systems via internet [closed]

Probably a trivial question but I just don't know how that piece of software would be called correctly: I have a closed system (A) and an application on another system and location (B). The ...
  • 137
1 vote
2 answers
152 views

naming the classes for users of my app, and users who manage the app

Naming things is hard but naming them properly is really hard. We are working on an app, that analyzes the data of multiple apps and creates some reports. And we are hitting our heads against walls ...
  • 295
-1 votes
2 answers
254 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?...
4 votes
2 answers
3k 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 ...
  • 149
1 vote
1 answer
72 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 ...
  • 127
1 vote
1 answer
137 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 ...
3 votes
1 answer
443 views

Naming Convention [closed]

When we determine names for the variables, there are two important issues that the people mention: The variable names must be explanatory. For the sake of this, their names can be long.` The variable ...
  • 239
2 votes
4 answers
2k views

C# class naming convention for a single item in the item list [closed]

In my C# project, I have a domain class named 'User'. this class will contain user's id, firstname, last name, DoB, home address, phone, etc. And we also have a typical REST web api (i.e. api/users) ...
  • 131
1 vote
2 answers
1k 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 ...
  • 859
0 votes
1 answer
86 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 ...
  • 111
3 votes
1 answer
302 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.