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.

Filter by
Sorted by
Tagged with
-1
votes
0answers
35 views

Naming conventions for entities in Clean architecture for Android

I was investigating Clean Architecture, more specifically applied to Android development. When using this kind of architecture for a common app case one (possibly) ends up with multiple entities: ...
2
votes
1answer
118 views

What should I call an internal casting function that may fail

(Almost) all numbers in my program are parsed and treated as complex numbers. There is one corner cases, that specifically needs an integer. Unfortunately my programming languages does not allow to ...
-3
votes
0answers
28 views

How can I name UI element significatively/concisely?

I'm working on a UI framework consisting of graphical elements such as buttons, lists, text inputs and the like, organized in an HTML-like tree structure. So far I've named these elements "Components"...
1
vote
5answers
86 views

Succinct and explicative way to name “cooldown” variables

I am struggling with naming 3 variables defining the following concept: An action, after being performed, is not available for an amount of time and then is available again. The concept comprises 3 ...
1
vote
1answer
42 views

Tips for module naming and criteria for grouping files in a directory

It appeared, that I have in my pet project two abstractions: asset loaders and drawing tasks. For each abstraction I have some classes representing them (currently a single class for drawing task ...
1
vote
2answers
93 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 ...
7
votes
1answer
277 views

Why is Assembly Language called “Assembly”?

Why is assembly language called "assembly"? I was just watching the 1st video in the "Crockford on JavaScript" series. In it, Douglas says, ". . . the first program to make programming easier was ...
-1
votes
1answer
45 views

Naming my classes and class folders in PHP project

I am working on an (PHP) application where users have so called workspaces. A workspace is a folder with a specific structure and bunch of specific files - user information and some workspace metadata ...
3
votes
2answers
164 views

When to use third-person verb? (PlayOnAwake or PlaysOnAwake)

First a couple of examples: var val = obj.GetValue(); var can = obj.CanPlay; var has = obj.HasValue; var val = obj.RequiresConstantRepaint(); // From Unity var val = obj.PlayOnAwake; // From Unity ...
23
votes
3answers
5k 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 ...
39
votes
7answers
7k views

Should I use AND in a function name?

I am in a predicament. I am working in a repository that makes a lot of database changes within its functions. The function I am dealing with returns responseids (but from a transformation, not from ...
2
votes
3answers
148 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
votes
2answers
104 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()): ...
1
vote
1answer
62 views

Using define in a conditional expression in Scheme

In Scheme, the general form of a procedure definition is: (define (<name> <parameters>) <body>) where <body> accepts a sequence of expressions, allowing this kind of procedure ...
1
vote
3answers
196 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', ...
4
votes
3answers
280 views

How should I go about naming when modeling a sport that can be between either individuals or teams?

Tennis is played as singles or doubles. I considered making my tennis scoring model logic refer to "teams" throughout its naming since "player" wouldn't take into account doubles. However, seeing ...
23
votes
4answers
4k views

Why is the norm of a complex number in the C++ complex library actually the square of the norm?

In the C++ complex library, the method norm() of a complex number actually returns the square of what I have learned is usually called the "Norm". Reference: std::norm For example, std::norm() of (3,...
0
votes
3answers
236 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
1answer
73 views

Operand ordering for matrix multiplication with assignment

If you have a matrix class with overloaded operator*=, which order should the operands be placed for the interface to be useful and intuitive. One can choose A *= B to be equivalent to either A = A*B, ...
0
votes
1answer
35 views

Appropriates names for Api implementation and Api Client Library

Suppose I have a big project, called Northwind. It's a website in front of a database. Now management want me to create a public API for this. I create a new ASP.NET Core project called Northwind.Api ...
1
vote
2answers
122 views

What is the rationale for naming the code module differently to the class name

For class Foo, what is the rationale for calling the physical code module something different e.g. FooBar.cs Is this just a style thing, or does it serve some other purpose/intent? It is accepted ...
11
votes
1answer
591 views

Why was “self” chosen over “this” for the name of the first parameter of python methods?

What was the rationale for choosing the name self instead of this when defining class methods in Python? Yes, of course, you can name it whatever you want - but the widely agreed-upon name for the ...
1
vote
1answer
332 views

Java package naming conventions (in maven modular project)

Until now I have been using simple strategy for packages naming in my maven-modular projects. Each package name contains name of the module in which it is placed. For example, simple project would ...
3
votes
5answers
312 views

Naming classes representing multiple values - Singular or Plural?

So we've got the following class: public class BudgetAmounts { public readonly int BudgetFk;//Foreign key to Budget public readonly int ItemSalesGroupFk;//Foreign key to the type of product ...
1
vote
3answers
140 views

Term for “IP address or DNS name” [closed]

We have a column in a database table that can hold either an IP address or a DNS name, and we're struggling to name it without leaning one way or another. Is there a "standard" term that means "IP ...
2
votes
1answer
95 views

Naming a software which allows communication between two independend 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 ...
-1
votes
1answer
120 views

Domain Driven Naming is too long and verbose [closed]

we are tackling the domain of https://en.wikipedia.org/wiki/Factoring_(finance)[factoring][1]: Factoring is a financial transaction and a type of debtor finance in which a business sells its ...
-3
votes
1answer
305 views

Why do people keep reusing superclass names in their subclasses?

In my project, I found one of the project's classes reusing the same name as an official one. For example: from django.db import models class Model(models.Model): class Meta: abstract =...
5
votes
3answers
237 views

Word order for names [closed]

I'm working with a team of non-native English speakers and I'm struggling to come up with a rule that explains why a method should be called getFilePath and not getPathFile. Examples of this bad ...
1
vote
2answers
60 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 ...
-2
votes
2answers
105 views

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

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 ...
-1
votes
2answers
114 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?...
-3
votes
2answers
56 views

Naming lower and upper threshold of a metric [closed]

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
358 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 ...
-1
votes
1answer
250 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 ...
1
vote
1answer
59 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 ...
1
vote
1answer
74 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
4answers
325 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 ...
2
votes
5answers
287 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
3answers
228 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, ...
98
votes
6answers
19k 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
128 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
83 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
5answers
138 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 ...
0
votes
1answer
50 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
2answers
185 views

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

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 ...
2
votes
1answer
198 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
100 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
92 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
1answer
108 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-...

1 2 3 4 5 12