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
-3 votes
0 answers
57 views

Are there conventions for naming functions which query and return results from a database? [closed]

Our team's codebase contains functions which perform SQL database queries and return their results. At the moment, we don't follow a standard naming convention for these functions. As a result, we ...
Andrew Parsons's user avatar
1 vote
2 answers
151 views

What is an appropriate length for function names? [closed]

I'm writing a C++ class, CBookSpellDef which has the following methods: int GetIndexOf(const char *psz); char* GetNameAtIndex(int index) { return m_spellTypes[index].szName; } char* ...
AcinonX's user avatar
  • 467
0 votes
3 answers
154 views

Naming multiple Entities of same collection (with different sets of fields, few less, few more)

Say I have a complex entity (class) called Quote. We have one representation that has just 3-4 fields used to hold minimal amount of data to identify a quote. Is there any convention to call an entity ...
tgkprog's user avatar
  • 607
-2 votes
1 answer
57 views

Is it possible a class method have the same name as an existing function? [closed]

Courtesy link: What Are The Specific Meanings Of The Terms: Functions, Methods, Procedures, and Subroutines? What's the difference between a function and a method? In the linked question: ...
Arunabh Bhattacharya's user avatar
0 votes
4 answers
286 views

Are "easier to search for the interface" and "avoid yo-yo to interface to find implementations to fix bugs" reasons to add prefix "I" on interfaces?

According to Should interface names begin with an "I" prefix?, I should not add prefix "I" to interfaces. However, I think prefix "I" in interface may be useful sometimes....
wcminipgasker2023's user avatar
1 vote
2 answers
256 views

Why did TC39 name JavaScript's array predicate functions `some` and `every` instead of `any` and `all`?

Python, Ruby, Rust, Haskell, Kotlin, C#, C++, Perl, MATLAB, SQL, and R all call their respective array predicate checking functions any and all. Is there any record of why JavaScript's designers ...
Alex Ryan's user avatar
  • 127
0 votes
1 answer
163 views

What would be good alternative function names for "filterHighNumbers"? The word "filter" could go either way [closed]

The problem I noticed is that I wrote a function called filterX which removed any X from a list. Then another engineer came along and wrote a filterY function which kept only the instances of Y in the ...
ubershmekel's user avatar
2 votes
5 answers
181 views

Is SetRelay a misleading name? Domain Expectations vs Programmer Expectations

I am working with a system that connects a number of voltage reference devices to a measurement device, it does this by "setting a relay". When defining the name of this function I have a ...
Nifim's user avatar
  • 151
0 votes
2 answers
97 views

Is usage of "with" prefix acceptable for filter methods that are specific(not generic) [closed]

I am not a native english speaker so I have the following question related to naming I have a class that has generic filter method of type: filter(Predicate predicate) In the same class I have some ...
Alexander Petrov's user avatar
4 votes
5 answers
329 views

Naming a method that does the same thing faster but only approximates the result?

Presume I have a function that does some precise calculation on a large amount of data, call it calculateResult(data). This function gets very slow with increasing size of input. Luckily, I only need ...
csstudent1418's user avatar
9 votes
4 answers
3k views

Is it okay to have misleading struct and function names for the sake of encapsulation?

I'm writing this library in which the user can provide custom code defining the algorithm used for finding an optimal solution. In the papers that I have read, the targeted user thinks in terms of ...
Mehdi Charife's user avatar
3 votes
2 answers
348 views

When refactoring many functions that share state in to a single class, how can you avoid writing an "escort" class?

This well-known article criticises Java on the basis that it does not allow you to write functions that do not live in a class. This flaw forces you to write classes with names that look suspiciously ...
J. Mini's user avatar
  • 1,007
1 vote
2 answers
981 views

how to name functions that return booleans

I like the practice of naming boolean variables with a prefix like "is", "has", "should", or "can". But what about the functions that produce those results? ...
Ryan's user avatar
  • 147
0 votes
1 answer
337 views

Naming for a layer between controller and domain logic

I realize this sounds similar to How is layer between MVC controller and back-end called?, but that didn't quite clarify the situation I'm facing. I have a backend system - for the sake of an example, ...
abl's user avatar
  • 471
-2 votes
1 answer
279 views

Adding new column(s) to DB Table breaks existing queries [closed]

Dilemma: I am working in microservices (MS) architecture for a product with shared (PostgreSQL) DB between MSes and DB Views exposed as Data Access API between SW Components, written and maintained by ...
ALZ's user avatar
  • 107
23 votes
5 answers
6k views

Best Practice - Avoid naming class and field the same?

When modeling classes I always have stumbled on the problem that the class has a field with the same name. Look at this example: class Name { string meaning; string language; string name; /...
bubbletea's user avatar
  • 347
4 votes
2 answers
280 views

Term for type information from C Source Code

I'm writing a code that extracts information about functions (prototype) and types (enum, struct, typedef) from a C source file. This is to augment the type information about a particular function or ...
Marco's user avatar
  • 377
0 votes
2 answers
421 views

Can a UUID be called a constant?

From my understanding, a constant is a value which is assigned only once and cannot change at runtime, whereas variables have mutable values which are unpredictable by nature. My question is, to what ...
Clara's user avatar
  • 53
2 votes
3 answers
436 views

What is the name, or design pattern, for something that calls a list of functions one by one?

The following design emerged from using Azure Durable Functions with lots of fan out, which turned out to not work very well. Our starting point was an Orchestrator with a companion Durable Entity for ...
Thomas Eyde's user avatar
1 vote
1 answer
286 views

Self-Selecting Variant of the Strategy Pattern?

I've found this pattern useful, and am trying to classify or name it. Basically, that: A task should be performed by different strategies, depending on the context. Each concrete strategy implements ...
MrTrick's user avatar
  • 113
-3 votes
1 answer
84 views

Declarative name for function with multi-purpose-loop from broken-up monolithic function [closed]

I'm currently in the process of reworking a monolithic function. My first step is finding blocks of code that can be extracted into their own "sub"-methods for ease of readability & ...
Incubbus's user avatar
5 votes
3 answers
2k views

What to name a POST endpoint that behaves like GET?

My app has an API endpoint GET /sessions/{id} which gets info about a session. This endpoint returns a lot of data, so we allow passing JSON in the request body to filter what fields etc. are ...
Chris's user avatar
  • 163
0 votes
1 answer
350 views

Best way to name derived classes when extending its functionality [closed]

I have just recently joined a new company and one of the classes used to log information has not been written properly. So I have been asked to add new functionality to the logger. Rather than ...
user16405900's user avatar
6 votes
2 answers
1k views

Naming an interface that does something and its opposite

Maybe I'm overthinking about naming, but it's a problem I've encountered several times and it was really annoying every time. I have three interfaces. The first is IAssembler, which has assemble(...) ...
Bipolo's user avatar
  • 83
1 vote
1 answer
364 views

What to name class that applies methods of another class?

This is a pretty vague question, but, sometimes, I'm not very good at naming specific tasks, but I know it's very important and I don't want to name it something ungood. I have the following file ...
YozNacks's user avatar
  • 119
2 votes
1 answer
2k views

Naming Conventions for microservices

We are currently splitting up our Intranet monolith into multiple (Micro)services. The layout in itself is already finished and we have decided to split them up in a way that there is only ever one ...
SirHawrk's user avatar
  • 239
-1 votes
1 answer
2k views

Best practices for naming python utils / extending core modules?

So a lot of the time my utils end up with a structure that mirrors the core library. I might end up writing a multiline version of str.center, an itertools-y function that returns the first or last ...
Jesse's user avatar
  • 111
0 votes
3 answers
428 views

Should I send the current or previous state with my state changed event?

I have an event that is raised when my job objects change state (e.g. initializing, running, complete, etc). The event is to be invoked from my set method in the State property, but before I make it ...
Hazel へいぜる's user avatar
2 votes
1 answer
411 views

Why is the 4+1 architecture model view named "4+1"?

Why are use-cases counted separately from the other views in the 4+1 architecture? How are use-cases different from others views?
NK-cell's user avatar
  • 139
-2 votes
2 answers
156 views

Guidance on naming methods that check data quality and then executes logic [closed]

I'm writing boolean methods that do a data quality check and then performs logic. such as isRecordValidAndIsUserPrivilaged. these methods checks the record validity, and then checks the user's access )...
PartOfTheOhana's user avatar
0 votes
1 answer
55 views

Correct selection of flags for extension

In my library (DLL), I have extensions for List like the next one. <Runtime.CompilerServices.Extension> Public Sub Store(Of TVal As IFullyOperable)(items As List(Of TVal), w As BinaryWriter, ...
Bogdan Samchuk's user avatar
1 vote
1 answer
3k views

Appropriate naming for (GitHub) repositories belonging to the same project [closed]

I have some issues selecting an appropriate naming scheme for GitHub repositories that belong to the same project. The main package repo relies on additional repos to generate documentation or run ...
mluerig's user avatar
  • 137
1 vote
2 answers
113 views

What do you call a process which transforms objects of complex types into simple objects of primitive types? [closed]

My first thought was that I'm "serializing" the complex object, but from what I understand that means I'm reducing it down to a string or binary format which could be passed over a network. ...
André Christoffer Andersen's user avatar
3 votes
1 answer
3k views

Naming convention for the classes holding REST APIs [closed]

Our new team suffixes class names with API to indicate that they encapsulate RESTful methods. Eg: "PaymentTemplateAPI", "FeeTemplateAPI" classes. I find it odd since API is a ...
explorer's user avatar
  • 149
-1 votes
1 answer
276 views

What should be a method prefix that makes calculation based on the parameter [closed]

I have a method, that takes a list of students, and returns the student with the best score. Part of me wants to call it Student getBestStudent(List<Student> students), but I think that get ...
a3dsfcv's user avatar
  • 131
1 vote
2 answers
99 views

Naming for a Class that performs one or more set operations

I'm designing a class that takes: 1 - An initial set of items (a simple collection/list) 2 - 1 or more Filter objects, that take the initial set of items and return a new set. Each Filter object may ...
rafark's user avatar
  • 21
0 votes
2 answers
218 views

How to manage ongoing development of two variants of the same library?

I'm the developer and maintainer of a FOSS C++ library, call it libfoo. There used to be just one variant of it; and I've made several numbered releases. Last year, I've created a second variant of ...
einpoklum's user avatar
  • 2,496
-1 votes
1 answer
77 views

What do you call a function that properly remains undefined?

Backstory: I have subclasses that are supposed to override and define various functions, but not neccessarily all of them. They can't remain purely virtual though for obvious reasons, and so I am ...
Anon's user avatar
  • 3,593
-2 votes
3 answers
2k views

Is there the difference between "symbols" and "characters" in programming?

I want to select between "symbol(s)" and "character(s)" for my variables' names in cases when these terms are synonyms. Please teach me some information which allows to make this ...
Takesi Tokugawa YD's user avatar
1 vote
2 answers
2k views

Can a class be considered as a factory even though it only creates one concrete type of objects?

I have a simple class called Link that contains some properties, and use different classes for creating different types of links. My code looks like this: class Link { String reference, label, ...
Harold L. Brown's user avatar
9 votes
2 answers
1k views

Should function names describe their parameter types?

If you wish to perform the same action using different parameters, you can either make differently named functions: public Apple findAppleById(long id){ return repo.findById(id); } public Apple ...
Bar Akiva's user avatar
  • 217
2 votes
3 answers
390 views

I need help naming a possible movement in a chess game

I'm working on a chess game and have created a base class for game entities and chess pieces, along with an enum for the state of a square, when returned in a collection of possible movements: public ...
Hazel へいぜる's user avatar
22 votes
11 answers
5k views

In a fluent interface with "with", is cloning expected?

In an object oriented language like Java or PHP (other perspectives welcome as well) if I use a fluent interface like this: my_pizza = (new Pizza).withTopping("pineapple"); another_pizza = ...
AndreKR's user avatar
  • 577
1 vote
2 answers
194 views

API for input stream operation read until

I want to create a stream class The input stream should read/parse a continuous range from left to right providing convenience methods. The implementation isn't a problem but choosing a consistence ...
Viatorus's user avatar
  • 119
2 votes
2 answers
811 views

GetOrCreate method for a database operation

I have read this thread: Is it bad coding practice to create something in a get if it does not exist? But, my question involve a method which gets a record from a database or creates it if it doesn't ...
MrChudz's user avatar
  • 129
0 votes
0 answers
84 views

Download method of type void vs response

Given a method that is widely used and has a void return type: from somepackage import download_model from somepackage import get_filename def download(name, download_path): response = ...
Yosi Dahari's user avatar
6 votes
4 answers
706 views

Is there a standard name (or examples) for the "sandwich" pattern?

I've noticed a certain idea recur in different contexts, but before I start calling it "the sandwich pattern", it would be useful to know (in the spirit of other "Is there a name for ...
ShreevatsaR's user avatar
0 votes
2 answers
236 views

What is the best practice to name a method that must either return saved result or resolve it?

Consider the following java code: public class Foo { private Bar bar; .... public Bar xxxBar() { if (this.bar == null) { //resolve bar this.bar = ...
Pavel_K's user avatar
  • 175
0 votes
2 answers
144 views

Adjective for being okay to send via an unreliable protocol?

UDP is an example of an unreliable protocol. Is there a single word that means "okay to send via an unreliable protocol?" Sort of like "unimportant", but that's too strong a word. ...
Kevin Krumwiede's user avatar
1 vote
1 answer
1k views

Naming for services/workers ect

I'm kind of new to this "separate your methods from models" (yes I was one of those developers). From what I understand I have to separate everything into models, services and factories. A ...
ikwillem's user avatar
  • 121

1
2 3 4 5
14