Skip to main content

Questions tagged [naming]

Give meaning and explanation using names, labels or terms most accepted by your team or community at large.

0 votes
5 answers
533 views

Naming - Lists - All elements except the last

When it comes to lists there are good, short and nice sounding names for most parts of list Head Tail Last - somewhat commonly used Currently I am doing a lots of TypeScript type manipulation and ...
Jarek's user avatar
  • 249
0 votes
2 answers
302 views

Where does the practice of naming variables with the prefix "my" come from?

I recognize that there are situations in which "my" is semantically useful, but I have met multiple professional programmers that have a habit of using this everywhere that it's not - "...
timeeeee's user avatar
1 vote
2 answers
179 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
  • 613
0 votes
3 answers
202 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
  • 611
-4 votes
1 answer
83 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's user avatar
  • 143
0 votes
4 answers
341 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
294 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
1 vote
1 answer
264 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
183 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
131 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
336 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
381 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,017
2 votes
2 answers
2k 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
  • 157
0 votes
1 answer
495 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

15 30 50 per page
1
2 3 4 5
44