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
0
votes
2answers
209 views

Is there a name for being able to substitute a variable for the source code assigned to it?

Consider the following (python) code x = [1, 2, 3, 4] y = 2 + 3 z = x[0] + y Here, I can substitute the expressions for x and y verbatim in the expression for z, possibly by surrounding then in some ...
49
votes
2answers
18k 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
152 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 ...
-6
votes
1answer
630 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 ...
2
votes
4answers
2k 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
194 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 ...
1
vote
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 ...
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 ...
0
votes
1answer
616 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
169 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
154 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 ...
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 ...
0
votes
1answer
2k 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
720 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 ...
7
votes
2answers
1k 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 ...
3
votes
6answers
4k views

Naming functions that retrieve a value

I have this personal rule to start all function/method names with a verb. My verb of choice for functions or methods that get a value based on some data structure or object is get. I'm wondering if ...
3
votes
2answers
136 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 ...
0
votes
1answer
89 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
845 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 { ...
19
votes
3answers
5k views

What package name to choose for a small, open-source Java project? [closed]

I'd like to publish a small open-source library in Java. I wonder what package name should I choose? I'm not a company and I don't have a domain that I could use as the basis for naming the package ...
3
votes
1answer
296 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
164 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
463 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
123 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 ...
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 ...
2
votes
2answers
490 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.) ...
26
votes
4answers
17k 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 ...
5
votes
4answers
289 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
1answer
251 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
votes
1answer
121 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
vote
4answers
382 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 ...
64
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? ...
4
votes
9answers
558 views

What is a widely accepted term for a string variable that would probably contain a file path and file name?

For functions that need to index files in a directory and rename them FileName0001, FileName0002, etc... I often need to write a function that splits the file name from the file path and rename the ...
-1
votes
2answers
5k views

Is it best practice to always capitalize class file names in PHP, and other languages? [closed]

I ask because I've seen a couple of OO PHP tutorials which do not adhere to this, but to me it just makes sense. It makes it easy to instantly see if a file is a class or not, if non-class files all ...
3
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 ...
24
votes
8answers
19k views

Meaningful concise method naming guidelines

Recently I started releasing an open source project, while I was the only user of the library I did not care about the names, but know I want to assign clever names to each methods to make it easier ...
-1
votes
2answers
238 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 ...
2
votes
2answers
289 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) } ...
3
votes
1answer
1k 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
995 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
145 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 ...
2
votes
1answer
124 views

What is the correct name for a conditionally present flag/field in an interface?

It looks like there's a problem with our deploy process where old versions of our service are being deployed to certain clusters, but it's hard to tell exactly what's wrong, since all we have as data ...
35
votes
10answers
8k views

What naming anti-patterns exist? [closed]

There are some names, where if you find yourself reaching for those names, you know you've already messed something up. For example: XxxManager This is bad because a class should describe what the ...
1
vote
1answer
196 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
1k 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, ...
9
votes
2answers
6k 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
110 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 ...
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
1answer
141 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
759 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 ...