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.

-1
votes
0answers
15 views

Naming schemes for request model and interactor in clean architecture

In my current implementation of the clean architecture, the request model classes all have the Request suffix and the response model all have the Response suffix. The (pseudocode) function signature ...
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
34 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
590 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
261 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
366 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
142 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
119 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
375 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
169 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
240 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
45 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,...", ...
0
votes
2answers
59 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
109 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
189 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
47 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
302 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
98 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
363 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
92 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
78 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
2k 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
312 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
384 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
88 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
209 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
512 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
112 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
208 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
365 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
117 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 ...
5
votes
2answers
185 views

How should I name the fields in a class representing 2D and 3D sizes?

I'm working on a display library which in most cases works on a 2D plane but it has some components which display 2D projections of a 3D space. This domain has the notion of Position, Size, ...
3
votes
1answer
110 views

Should I avoid creating a variable with shorter name for a constant?

suppose I have code like this someFunction:function(userId){ var url=SomeClass.SomeNetworkConnector.SOME_URL; if(url !== undefined && userId !== undefined){ this.openURL(url+"?userid="...
7
votes
6answers
650 views

How to name a method which may or may not perform an action depending on a condition?

I stumble across this case somewhat often, and I'm surprised about finding so few similar discussions around the web. This question is very related, but my problem is that I want a method that does ...
3
votes
1answer
171 views

How to name two functions that could be named the same?

I have a node app with a queue for processing jobs in the background. I have a file that exports a function which when run, creates a job in my queue. In that file, I also have the handler for this ...
1
vote
1answer
446 views

What are TDD and integration test naming conventions?

I am building a small web API using .NET Core. I want to practice TDD and this is my first attempt at TDD. These are a few use cases of the API: Users in administrator role can create/edit/delete ...
1
vote
1answer
149 views

What do you call a process that will not complete? [closed]

As we know, some processes will complete. void func (var a) { Console.WriteLine(a) }; And some will not, void func (var a) { while (true) { Console.WriteLine(a) } }; What do we call the function ...
0
votes
0answers
73 views

Why is overloading called overloading? [duplicate]

I have problems with the term "method overloading". I know that overloading is the ability to create multiple methods of the same name with different implementations. My problem is however, that the ...
0
votes
1answer
84 views

Should the name of a new state variable reflect the original setter context or the intended usage?

I often face this problem when new requirements come along, but have never seen it discussed anywhere. In this case, I have an existing list of items (staves in a musical score). The requirement is ...
2
votes
2answers
77 views

Naming a contradictory wrapper

I have written a Monix Consumer that wraps a Kafka Producer and am at a loss about what to name the result. KafkaConsumer is already a class, which has essentially the opposite meaning which the ...
3
votes
1answer
124 views

Building a solid vocabulary when working in a specific domain

This question might be a bit vague and answers might come up quite opinionated but I don't know how to rephrase it so here it goes. How can a developer build a solid vocabulary when working in a ...
-3
votes
2answers
343 views

Writing readable code and not overdoing it with naming [closed]

I've been in an argument at work about writing readable code. It was mainly about variable and method names and the idea that comments are worthless if the code is readable enough. I would not like to ...
-2
votes
1answer
631 views

How to name different components in adapter pattern?

(example code in PHP, but this can apply to more languages) I have a scenario with an adapter pattern, where I have classes, interfaces and objects with different roles, like so: An original object ...