Stack Exchange Network

Stack Exchange network consists of 174 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

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.

0
votes
0answers
40 views

How to Handle Names That Might Change?

I work in an enterprise environment where most of our work involves adding custom integrations to a large, existing third-party system (purchased). Recently, we needed to attach a new attribute to an ...
-1
votes
1answer
62 views

Method naming conventions [on hold]

I am aware of the following well-known method naming conventions: valueOf(X), of(X), from(X), toX, getX, setX, isX Are there other method naming conventions that apply in specific situations?
2
votes
1answer
90 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
97 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 ...
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 ...
-2
votes
1answer
49 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 ...
0
votes
0answers
73 views

are dynamic variable names for readability a good practice

So recently I've been developing some simple stuff in C# to process data in an excel spreadsheet. I've had to create a nested map construct to represent the sheet of the excel document I want to work ...
1
vote
1answer
127 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 ...
-1
votes
1answer
51 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 ...
3
votes
1answer
141 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
5answers
221 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: ...
-1
votes
1answer
151 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
53 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 ...
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', } ...
0
votes
0answers
42 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"; // ...
8
votes
4answers
606 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
273 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
380 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
144 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
123 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": "...
2
votes
4answers
399 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 ...
2
votes
1answer
206 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? ...
0
votes
2answers
247 views

Is it necessary for a boolean to be “false” by default?

For example, to store whether sound is on, I have a boolean originally named "isSoundOn": private boolean isSoundOn=true; however, the default value of boolean is false, but I want my application to ...
0
votes
2answers
46 views

Should the key of locale text contain the actual context, or the meta information about it?

For example, suppose my app have some localized text, my question is , should the key contain actual context of text: { "WELCOME_TO_USE_THIS_APP":{ "en":"Welcome to use this app,...", ...
2
votes
3answers
90 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 "...
0
votes
3answers
110 views

Should the name in the codebase always match how users refer to it? (example inside)

We have an internal tool where our account management teams can say "whenever we send this type of SMS message, use this text I specify instead of the default text". They would call this 'configuring ...
0
votes
3answers
194 views

Naming variable which describes that something is currenty in use

I'm creating a variable which should describe that an object is currently in use. Lets say we have a form with a password input, and I want to describe the state when someone is using that input. Is ...
1
vote
0answers
48 views

Is this a misuse of locales (internal config name)?

I have a situation where a given object is named, but there are multiple formats that are reasonable for that name. internal: fully qualified human-readable: translatable name, meant to be used in ...
0
votes
1answer
60 views

How to name Groovy Traits?

Classes should be nouns and methods should be verbs. What about Groovy traits? Should they also be nouns? Or maybe should they be adjectives / ability words?
6
votes
3answers
305 views

Equal length variable names: tricks or alternatives? [closed]

This might be a super nerdy, OCD-like, silly question, but... I love it when related variables have names of equal length, such that when written below one another, it lines up nicely. Eg: min/max: ...
-1
votes
1answer
178 views

What's the difference between “foo.spec.ts” and “foo.test.ts"?

When I use Angular CLI to generate a component, the test linked uses the logic foo.spec.ts. I am reading a tutorial where the test linked uses the logic foo.test.ts. What's the difference between “...
6
votes
1answer
380 views

Is method with “ByXXX” suffix (eg:findUserById) redundant?

Sometimes I can see method definition like: public User findUserById(int id){ } But my justification is, isn't "(int id)" already include the information of "ById"? is it better to have naming just ...
-1
votes
4answers
98 views

Sending camelCase code to under_score code

I'm working with JavaScript and PHP right now. My JavaScript uses camelCase while my PHP uses under_score for variable/object/array naming. I often have JavaScript send data to PHP. In fact it's ...
0
votes
1answer
79 views

Co-ordination between technologies following different naming conventions [duplicate]

Javascript community generally follows camel case naming convention, whereas while writing REST api URLs follow snake case naming conventions. What would be the better naming convention for the ...
0
votes
3answers
3k views

Best way to naming classes and packages in Java

Apart of the code conventions to use camelCase, PascalCase etc., are there any conventions for naming packages and classes in Java? For example, I have an mvc project and the main package is com....
2
votes
1answer
325 views

How to name a Boolean variable that represents either of two options?

I'm developing an application with Python. I want to have a Boolean variable that represent whether something is buy or sell but I'm not sure how I should name it. Here are my current ideas: isBuy ...
3
votes
4answers
435 views

Method naming with an out parameter

What naming convention should use when I have a method with an out parameter. I want to do this using clean code principles. So is it a good practice to include the name of the out parameter in the ...
-3
votes
3answers
66 views

Naming: How do you call an interface that allows to retrieve items?

Let's say a client need to get a list of products from somewhere. He does not care if that list comes from a cache, from a remote database, from a local database, from the resources or from the remote ...
0
votes
2answers
97 views

Name of a class representing a 3d model

How would you name a class describing a 3d model? 3DModel, this is not a valid identifier ThreeDimensionalModel I do not like this Model to general AnimatedMesh to technical or close to ...
-2
votes
1answer
91 views

For use once only functions extracted from a longer function, should the name be xxx1(),xxx2,… or relate to there 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 can split long functions into smaller functions even if they are ...
2
votes
1answer
98 views

For a use once only button callback, should the name be more related to the button or the task of the callback?

Suppose I have UI like it: <script> var someFunction(){ //some code to validate and then send message } </script> Message:<br> <textarea></textarea><br> &...
2
votes
1answer
232 views

Method naming: to vs as vs get

Do the words to, as and get have any special meaning when used in method names? Examples to new Integer(4).toString() get Integer.getInteger("system.unknown.property",4) as Arrays.asList(...
5
votes
2answers
584 views

C# Names of Namespaces with version suffix

In official Microsoft docs: ✓ DO use a stable, version-independent product name at the second level of a namespace name. But in Reference Source, the following namespaces ends with Version: ...
0
votes
1answer
52 views

What's the correct word to refer to domain-specific entities?

I've been incorrectly referring to domain entities as DSL, and I want to know what's the correct word for it. Let me give you an example: In the system I'm working on, we have entities similar to a ...
1
vote
1answer
120 views

Naming standards or conventions for ecommerce

Naming things There are only two hard things in Computer Science: cache invalidation and naming things. -- Phil Karlton Naming things seems so trivial, before I read this quote, I would have ...
4
votes
3answers
210 views

Is there a name for iterating between refactoring and feature development?

I'm working on a personal project and I've found myself switching between doing some refactoring for a day or two and then some feature-adding for a few days. I like it, and I noted it was similar to ...
1
vote
1answer
420 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....
1
vote
1answer
123 views

What alternative name to give to controllers?

There are several posts and other contents in the internet that claims against naming classes ending with "er" (like manager, controller, helper...). I personally agree with that, but what ...
-3
votes
3answers
159 views

Ambiguous use of “User”

In one of my projects, I had to name some variables and functions that belong to the person using my app. I named them userCard, getUserInventory() and so on. I named them like that cause there were ...