Stack Exchange Network

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

3
votes
4answers
556 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
69 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 ...
-1
votes
1answer
155 views

For use once only functions extracted from a longer function, should the name be xxx1(),xxx2,… or relate to its 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 should split long functions into smaller functions even if they ...
2
votes
1answer
100 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
322 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
770 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
53 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
130 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
217 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
537 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
141 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
162 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
195 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
116 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
691 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
175 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
942 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
151 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
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 ...
3
votes
2answers
84 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
126 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
360 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 ...
0
votes
1answer
963 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 ...
5
votes
2answers
960 views

Avoiding conflicting namespace and class name

Say I am developing a Calculator application. It has one class called: Calculator. Therefore my namespace structure would look like this: MyCompany.Calculator.Core.Calculator Unfortunately, this ...
2
votes
1answer
116 views

Is it Pythonic to have a module named `functions`?

I have a Django project. All the apps are separated nicely. Each apps often have functions that are used across the apps. Currently I place them in module named wrappers (for wrapping django/built-in/...
2
votes
4answers
553 views

Naming similar variables [closed]

I need few related variables (for example I have the lengths of 3 lines given. I have to say whether they form a triangle). Which variable naming convention is preferable in Java? len0, len1, len2 ...
-3
votes
1answer
68 views

What to call a API and DB code layer [closed]

In a recent MVVM mobile app project I wrote a set of API classes and Database classes where there was a clear flow of logic between both api and db code. To enforce the way api and db interacted I ...
0
votes
1answer
92 views

What is the name or description of my technique for filtering items in array? [closed]

I've tried posting this question on StackOverflow but they told me to try it here since it's not so specific. I'd like to know the name of the algorithm or technique of following implementation. I ...
-1
votes
1answer
1k views

Tender Type vs Payment Method/Type

I'm designing the data model of a payment database. One of the domain requirement is to keep track of how the customer paid and, if applicable, what was used i.e.: Visa, Amex, etc. In the past I ...
2
votes
2answers
323 views

Giving multiple classes in a single library the same name

The project that raised this question is in C#, but it could apply to most languages that use namespaces. I've read many things on good naming practices: "Don't prefix your class names with their ...
-4
votes
1answer
108 views

Is it bad practice to give a directory and a file the same name?

I have a program that produces a command line tool called GetFood. The source code lives in a directory named GetFood/, and I have a main file that interacts with a class that gets the food. It seems ...
-2
votes
3answers
95 views

Adding qualitative information to function names

I started adding informations about the behavior of functions to their name recently. Two big examples: pure - this function has no side effects (besides the returned value), which I would use in ...
1
vote
2answers
159 views

Naming functions that do one or more things

I recently picked up 'Clean Code' by Robert Martin and have taken to refactoring my recent project. I'm realizing how important it is to name variables and functions in a way that clearly expresses ...
1
vote
3answers
368 views

Is Diff a well understood term, or should I name it Differentiate?

I have a class which checks for differences. I could call this class ViolationDiffer public IEnumerable<ViolationChange> Diff( IEnumerable<Violation> old, IEnumerable&...
2
votes
5answers
486 views

Is wrapping built-in functions with user functions ok?

As I was working with a friend on a project I noticed that he created custom functions such as: function is_empty($val){ return empty($val); } function is_not_empty($val){ return !empty($val); } ...
6
votes
2answers
2k views

What's the Java convention for names with a sequence of numbers, like “ISO 8859-1”?

If I'm creating a Java class for something that has a sequence of numbers in its name, e.g. “ISO 8859-1”, how should I name my class? Iso88591 seems wrong, since there's no boundary between the ...
3
votes
3answers
355 views

How to avoid confusion between services as in “service layer” and services as microservices?

If I have microservice architecture and one or more microservices have layered architecture that contain service layer, how can I avoid naming confusion between microservices and structural units of ...
2
votes
4answers
2k views

Should I avoid using spaces in my filenames?

I sometimes find experienced programmers who will actively avoid using spaces in their filenames, opting to use underscores or camelCase instead. (i.e. /org map/attach jobs.cpp vs /org_map/...
5
votes
2answers
725 views

Use of “my” prefix in object naming

I am refactoring a large code base, and noticing the author often uses "my" to prefix object names. For instance, using myThingy to identify an object of type Thingy. Is this generally considered a ...
1
vote
2answers
64 views

What's the standard term for removing data and embedded code modules from a database before publishing?

Hopefully this question isn't too application-specific; I'm thinking about it with regard to Excel, but I think it applies to any file-based database that includes embedded code. I'm working on an ...
0
votes
3answers
118 views

What to rename my order table? [closed]

I have a database table named order. It contains eCommerce orders. Problem is, that's a reserved word in MySQL, and while I can use back-ticks to prevent issues, it's probably a good idea not to use a ...
-3
votes
2answers
146 views

How to name the parameter that holds `next` middleware in the chain?

I am writing an implementation of middleware chain in Python. Here is how a middleware function looks like: async def logger(ctx, next): print(f"Started doing stuff with {ctx}") await next() ...
2
votes
4answers
215 views

Naming a class representing a collection of objects of another class

This is always a problem for me. Say, in a game, there's a class representing an enemy spacecraft named EnemySpacecraft and there's a class representing some collection of those, say all that exist in ...
75
votes
4answers
6k views

What's the difference between “to” and “as” method name prefixes? [closed]

What's the difference between "to" and "as" method name prefixes like toList(), asList(), etc... When to use which when designing a method?
1
vote
1answer
1k views

Python class naming: nested classes or composed names?

I encountered a scenario where I cannot decide on which is the best (or worst) naming strategy. The context is the following: a bracket (as in a tournament) made up of nodes, where is node is made up ...
1
vote
1answer
785 views

If I package by feature, but have many homogeneous classes, what is preferable?

I am wondering whether this is the correct way to handle my situation when packaging-by-feature. Use the following project structure as an example: com.foobar.web.Bootstrap.java com.foobar.web....
4
votes
2answers
188 views

Are there any grammatic conventions on naming functions?

For example, I have a Selenium WebDriver and as part of my initialization I would like to check if I am able to instantiate it and start up browser. I can't come up with a proper name. Is there any ...
0
votes
1answer
1k views

How to name a service that does CUD operations from CRUD tetrad?

There is a need to separate services working with data into two groups: ones that perform read-only operations and others doing Create(or Add) + Update(can also be called Modify) + Delete(Remove). ...
3
votes
1answer
62 views

Naming a view class

I'm a little hesitant on what to name a view class. I have a view class which I call ChooseImageView because that's what the user does in that view. After the user has chosen an image I display a ...