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
3 votes
4 answers
223 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
91 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
479 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
392 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 ...
  • 239
1 vote
3 answers
564 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
86 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
1k 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
1k 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,414
2 votes
3 answers
455 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
352 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
146 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
5 votes
6 answers
2k 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?...
  • 159
2 votes
4 answers
300 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
314 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
4 votes
1 answer
349 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
188 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
239 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
155 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
319 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,171
0 votes
1 answer
124 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
1k 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
541 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
364 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 ...
  • 151
10 votes
2 answers
1k 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
23 votes
3 answers
6k 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
708 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,447
-1 votes
2 answers
733 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
870 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
412 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 ...
1 vote
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
741 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
101 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
134 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 ...
  • 285
-1 votes
2 answers
220 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
2k 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
71 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 ...
  • 27
1 vote
1 answer
85 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 ...
2 votes
1 answer
428 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 ...
  • 229
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
81 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
272 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.
2 votes
1 answer
84 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', } ...
  • 129
7 votes
4 answers
2k 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 ...
1 vote
2 answers
4k views

Is there a rule of thumb when it comes to the "name" attribute?

Since there is things like BEM in naming conventions for HTML class attributes, does the name attribute have anything of that sort?
  • 187