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
vote
1answer
826 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
67 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 ...
0
votes
1answer
57 views

If I'm explicitly using WCHAR strings in my Windows application, should I use the -W functions rather than the TCHAR #defines?

Basically, TCHAR and the associated macros (_T/TEXT) are only really necessary if you're targeting both ANSI and Unicode, and, like 99.9% of developers out there, the possibility that someone might be ...
0
votes
1answer
1k views

Naming collections of helper methods, and avoiding meaningless jargon words

While coding anything remotely useful, I inevitably find myself wanting to add methods to perform smaller bits and pieces. (It could be a method to return everything in a string to the left of the ...
3
votes
1answer
1k views

Why shouldn't you create a custom uri scheme?

In setting up deep linking to android and iOS apps, I've made some use of custom URI schemes, and they work great, especially as a fallback when the mechanism that allows maps from http: fails (as ...
-1
votes
1answer
74 views

REST: Using singular to return logged-in info

Github uses the convention "/user" (singular) to interact with the logged-in user's info. They still have the full "/users" suite of paths to support getting info based on IDs (or usernames in their ...
0
votes
2answers
207 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 ...
48
votes
2answers
16k 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
148 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
594 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
1k 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
192 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 ...
-2
votes
7answers
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 ...
-1
votes
1answer
568 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
168 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
151 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 ...
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
683 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 ...
6
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 ...
0
votes
1answer
88 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
802 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
277 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
162 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
438 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
120 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
484 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
15k 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
250 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
381 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? ...
-1
votes
1answer
115 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
212 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
288 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
976 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
928 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
287 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 ...
3
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
194 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
930 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
5k 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 ...
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 ...