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.

47
votes
2answers
12k views

Naming of bool methods: Is vs. Can vs.?

Which is the better name for a method that returns a boolean? IsSupportContentType or CanSupportContentType
1
vote
1answer
131 views

Providing context in Class name, even though the namespace provides context

So I am reading Clean Code and I want to write my class names with the proper amount of context, but how does .NET namespaces play into the concept of Meaningful Names? Do I forego context in the ...
-7
votes
1answer
530 views

Class names with Verbs

So I am reading Clean Code. In the Meaningful Names chapter, they lay down a rule of no verbs in class names. However in the Adding Meaningful Context section of that chapter, on page 29, he uses a ...
1
vote
4answers
997 views

Naming procedure conventions - Where to place adjective in a verb followed by an object convention

I am reading on Coding Complete book the following statement: To name a procedure, use a strong verb followed by an object A procedure with functional cohesion usually performs an operation on an ...
4
votes
1answer
186 views

How do package managers generally deal with squatters?

How do package managers deal with packages that use a package name but then abandon it or from rogue package names that are similar that host malware in the hope that an unsuspecting developer will ...
0
votes
1answer
2k views

Project structure and folder naming

I have a cpp project which source code I want to split into 3 groups and want to define structure for these files by creating folders with nice name. First group are files related to socket ...
-3
votes
6answers
2k views

C++ namespace name isolation

It's been considered for a reason, that using for namespaces/names is side-effect-prone, and generally, fully qualified names should be preferred. I've come up with an approach on that, which I ...
101
votes
11answers
9k views

What's the name of the antipattern opposite to “reinventing the wheel”? [closed]

The "Reinvent the wheel" antipattern is a pretty common one - instead of using a ready solution, write your own from scratch. Code base grows needlessly, slightly different interfaces that do the same ...
-2
votes
1answer
507 views

Should objects be singular since arrays are plural?

Might be a silly question, but what is more logical: object.actions.bark() or object.action.bark()? Simply about plurality. I know arrays are usually pluralized. But if I were to be consistent; ...
1
vote
1answer
164 views

Is it good to include the type of a variable in its name? [duplicate]

This is a naming convention question. In C#, someone suggested that variables of type List<T> should be named as listBlah instead of just blah. Similarly for variables of type Dictionary<...
0
votes
2answers
148 views

How to name the classes that caries data to a different layer?

When I retrieve data from database I name the class as Model, for example UserModel. When I send data to the View I name the class as ViewModel, for example UserSettingsViewModel. How to name the ...
-1
votes
1answer
1k views

Do you name a dictionary by the key or the value? [closed]

Do you name a dictionary by the key or the value? I have a dictionary that will hold gradient data and the component: dictionary[gradient] = component; Do I name it gradientDictionary or ...
4
votes
7answers
609 views

How can I expand my vocabulary to improve my variable names? [closed]

There are two hard things in computer science: cache invalidation, naming things, and off-by-one errors. - Tweeted by Jeff Atwood Agreed. All software engineers can understand this. Choosing ...
5
votes
2answers
813 views

Complex variable name with plural nouns [closed]

It's a language agnostic question. Seems like a common problem, but I can't find answer anywhere. I need to pick a name for a variable to hold the values of one attribute of a list of objects, and I ...
0
votes
1answer
85 views

How would you name the function that takes a list of lists [L1, L2, L3] and returns a list of lists [l1, l2, l3] [closed]

What would you call the function that takes a list of n lists of values, and returns a list of all the unique lists of length n where the ith element is chosen from the ith input list? For example: [...
4
votes
2answers
655 views

C# Possible method name conflicts with optional parameters - why it is not forbidden? [closed]

Let's have a simple class, and main method: using System; using System.Collections.Generic; using System.Linq; using System.Text.RegularExpressions; namespace Rextester { public class Program { ...
3
votes
1answer
250 views

Name of interface method “leak” implementation details

I have a class which implements an interface and have responsibility to create item and "maintain" collection of created items. Class have method GetOrCreate(int id) which return instance of ...
0
votes
6answers
157 views

How to name a method that fills in the blanks? [closed]

I have a method that checks a data structure for the presence of a thing that might be missing but is required. If it is missing, it adds it. Essentially it is this (although the method is much, ...
2
votes
3answers
366 views

Applying the label “Parent/Child” on inheritance vs composition

I just stumbled over an interesting problem with naming. I am writing automated tests for an Object-Relational mapper. This involves using super-generic classes that exist solely to exercise certain ...
-1
votes
1answer
113 views

What can we call a model, controller, and related views? [closed]

When developing an application using the MVC pattern, I often find myself adding a new model, a new controller, and a new set of views for the actions in the controller. These changes are pretty ...
2
votes
2answers
409 views

Is there a commonly accepted name for functions that are only called in one other function?

Is there a name that is commonly used for functions that are only called in one other function? (I'm not asking whether it's a good practice; I believe it can improve readability in some cases.) ...
23
votes
4answers
12k views

C# namespace and class naming convention for libraries

I'm building libraries with various small utility functions in C#, and trying to decide on a namespace and class naming convention. My current organization is like this: Company Company.TextUtils ...
4
votes
1answer
238 views

What is a term for iterating over many functions with the same input?

When we call the same function on a list of things, we call that "map". What do we call it when we call a list of functions on the same data? I don't mean pipe - not feeding the output of each ...
1
vote
4answers
373 views

How do you explain the importance of writing classes over writing procedural functions to a programmer? [closed]

I have an intern and he writes code fast. However, I have difficulty making him understand the importance of writing classes and follow the OOP paradigm. We recently had a discussion that went like ...
63
votes
7answers
7k views

How to name something when the logical option is a reserved keyword? [closed]

Occasionally, the most logical name for something (e.g. a variable) is a reserved keyword in the language or environment of choice. When there is no equally appropriate synonym, how does one name it? ...
-1
votes
1answer
98 views

method to check nested transaction

So I am writing a method to check and throw if a new transaction is being made in another transaction. I first came up with straight forward checkNestedTransaction, but this seems vague since I cannot ...
-1
votes
2answers
172 views

Naming software products and tools? [closed]

Instead of unintelligible names and acronyms for new products and services, is there any other way of naming software that could also say what it is and what it does? For example, instead of naming a ...
11
votes
6answers
1k views

Naming: Should you sacrifice briefness for clarity?

For example, the following function loops through an array which contains the name and errors of an input field. It does this by checking the name of the validating field and then pushing the error ...
2
votes
2answers
281 views

When should I use “value” as an argument name? [closed]

I'm building my own utility functions to master ES6: const contains = (array, value) => { return array.indexOf(value) > -1 } const keys = (object) => { return Object.keys(object) } ...
39
votes
7answers
7k views

Translating external data to the language you're programming in

I'm not sure what to do with the following: We take data from an external tool within our own tool. This data is written in Dutch. We are writing our Java code in English. Should we then translate ...
3
votes
1answer
875 views

How to name method specific DTOs representing the same entity?

I'm building a Web API. To give meaning to my controller methods I want classes that specify what properties are used for each particular operation. This would make the code easier to understand, and ...
2
votes
1answer
825 views

Is there anything wrong with my project structure and naming convention in ASP.NET MVC and Web API?

I wonder if project structure and naming convention which I use in ASP.NET MVC and Web API projects are ok. These technologies are quite new to me, so I don't have my own standards yet. I don't ...
-1
votes
1answer
144 views

How to name a class whose purpose is to hold related objects?

I am working in a wizard in WPF application. As the wizard gathers a lot of information I have designed separate view models for each step (view) in a wizard. But I have to hold all this information ...
5
votes
4answers
278 views

Variable name which sometimes refers to an object and sometimes to a string

Sorry for the confusing title - this is best illustrated by an example (hypothetical but hopefully illustrative). For 99% of my application a Zip Code is considered as a string, so I consistently use ...
4
votes
2answers
133 views

One function to produce a couple or a function per item?

I have a dilemma. Let's say I have an AST that describes some grammar, for instance. I can write a function to stringify this AST back into human-readable BNF form or generate a parser from it. I can ...
10
votes
3answers
2k views

In Java 8, is it stylistically better to use method reference expressions or methods returning an implementation of the functional interface?

Java 8 added the concept of functional interfaces, as well as numerous new methods that are designed to take functional interfaces. Instances of these interfaces can be succinctly created using ...
1
vote
1answer
193 views

Is using uncommon words as descriptive variable names acceptable?

I am implementing a finite state machine in Python 2.7, and I am considering using an English word that I don't commonly see in code: "stimulus". I have a transition function that accepts some kind of ...
2
votes
1answer
727 views

How to name Test Projects

Suppose I have some Modules that each are their own component I would now have different Testprojects spanning different modules. UnitB_UnitTest, UnitC_UnitTest, GUI_UnitB_ComponentTest, ...
8
votes
2answers
4k views

How should I name functions that return values in Python?

I'm confused about choosing names for my functions in Python. Sometimes Python built-in functions are imperative such as: print function and string method find. Sometimes they aren't such as: len its ...
0
votes
0answers
98 views

Qt Naming Schemes for returns of boolean member variables: enabled(); vs isEnabled(); ?

In building my classes, I have noticed that I have not been very consistent about naming my boolean returns. In Qt; I notice that many of their classes use the is prefix, but checking their coding ...
4
votes
1answer
199 views

Are there any scenarios where a JS function expressions would need to refer to its “name”?

Anonymous function expressions in JS bug me as they make stack traces and Chrome Dev Tools profiler output harder to use, so I've decided to name ALL my function expressions from here on in. The ...
0
votes
1answer
138 views

Is there a name for this kind of function?

I'm a data analyst, not a software developer, and I often find myself writing a function like this (shown in Python syntax here): def apply_many(arg, *funcs): return [func(arg) for func in funcs] ...
-2
votes
2answers
650 views

Java - is it bad to name variables starting with uppercase if they are vectors or matrices? [closed]

Often in math a vector or matrix will be denoted by a single capital letter. Would it be bad to have some variables such as this? Vector3 A = ... int Bx = ... int By = ... int Bz = .. I would ...
8
votes
3answers
2k views

Naming convention for functions which have side effects? [closed]

I heard somebody say their language has a convention where the names of functions which mutate state must end with an exclamation point. I'm trying to write more functional code and I like the idea of ...
0
votes
2answers
536 views

C# namespace and class naming

I have a small issue with namespace and class naming. Here is a practical example: ResourceLayer.cs - Public component that holds the manager and the map provider, implements an interface ...
2
votes
0answers
76 views

What sort of object represents a table row from a joined table query? [closed]

I have a conceptual problem here. When i query my database, i often do so with joins. So a result set row might look like +------------+--------------+------------+-------+----------+----------+------...
3
votes
3answers
139 views

Should I implement a obfuscated spec literally?

I'm tasked with implementing a spec for a simple simulated shopping system. The spec however uses strange abreviations everywhere (it has a 2 page long table of nonsense abreviations). For example the ...
0
votes
1answer
101 views

break down test class into multiple file naming convention

I have a test class with about 25 tests that are testing the different aspect of it. I wonder Should I break it down into smaller classes? If so, then what is the best naming/packaging convention? ...
1
vote
1answer
162 views

Name a predicate function that takes multiple objects [closed]

I have the following JavaScript code: function tokensOnSameLine(node1, node2) { return node1.line == node2.line; } What would the preferred name for this function be? I've considered the ...
3
votes
3answers
772 views

namespaces and header guards with naming conflicts

C++ has namespaces to prevent collisions of things with the same name. Header guards serve a different purpose. They prevent includeing the same header twice. However, they can suffer from the same ...