Questions tagged [naming-conventions]

Do not use this tag to ask what you should name something. Naming conventions refer to general rules governing names assigned to programming constructs such as variables and methods. These conventions facilitate readability, and thus improved maintainability of code by enforcing naming consistency across disparate modules.

Naming conventions refer to general rules governing names assigned to programming constructs such as variables and methods. These conventions facilitate readability, and thus improved maintainability of code by enforcing naming consistency across disparate modules.

Examples

4026 questions
3
votes
0 answers

Choosing between naming conventions and semantics with Node.js module imports

When importing modules in Node.js, it's fairly common (and greatly aids in readability) to use capitalization when importing classes and camel case when importing anything else: let Transform = require('stream').Transform; let util =…
TheEnvironmentalist
  • 2,694
  • 2
  • 19
  • 46
3
votes
2 answers

Python readability through descriptive naming

I have been using Python for about a year now, coming from a mostly Java background. I found Python quite easy to learn because of its focus on readability and simple design. The thing I don't understand about python is why for a language that…
toc777
  • 2,607
  • 2
  • 26
  • 37
3
votes
0 answers

Naming predicates for plural objects

I have a model "messages". And it should have a predicate, which will indicate, are they (messages) fetching. Should I name it "areFetching" or "isFetching"? I tried to google "predicates naming conventions", but they all are only about "is" and…
kana
  • 86
  • 4
3
votes
2 answers

What is the naming convention for YARN containers used by Spark?

When running Spark jobs on top of YARN (yarn-cluster mode), YARN creates the workers in containers that have a name that looks something like this: container_e116_1495951495692_11203_01_000105 What is the naming convention for the containers? Here…
summerbulb
  • 5,709
  • 8
  • 37
  • 83
3
votes
5 answers

Which is the best among GetCountOfObjects, GetNumberOfObjects, and GetObjectCount?

I am a C++ programmer from a non-English country.I am always confused about how to choose one of the following function names: GetCountOfObjects GetNumberOfObjects GetObjectCount Who can tell me what the subtle differences are between them?
xmllmx
  • 39,765
  • 26
  • 162
  • 323
3
votes
3 answers

Single function classes (named as verbs)

I'm trying out a new code structure where I'm splitting all my giant repositories and factories into loads of smaller classes each with a single responsibility. And on top of this I'm using verbs for class names as I think that it's the best way to…
svejk
  • 63
  • 4
3
votes
7 answers

C# Unit Testing: Why must the expected result be included in the test name?

If the expected result of the method being tested exists in the official documentation of the method, then indicating the expected result in the test names would be redundant. In fact, if the purpose is to document the method, then the documentation…
drifter
  • 611
  • 5
  • 17
3
votes
1 answer

Should I start internal methods with _?

If I have an object that has several internal functions that are not exactly meant for outside calls. Should I always start them with _ or __?
RomaValcer
  • 2,786
  • 4
  • 19
  • 29
3
votes
4 answers

What naming conventions do you follow with functions that allocate memory?

So here are two functions that do almost the same thing. How would you name each one, if you had to include both in your project? void strToLower1(char* str) { int len = strlen(str); int i; for (i=0; i
theanine
  • 986
  • 3
  • 10
  • 21
3
votes
1 answer

Does the variation in android attribute naming styles mean anything?

It looks like the naming style for android attributes varies between underscore and camel case. Does the variation mean anything, or is it arbitrary? edit: examples would be layout_width and columnWidth.
Tim Barrass
  • 4,813
  • 2
  • 29
  • 55
3
votes
0 answers

Naming conventions of Java exceptions: Illegal vs. Invalid

I recently thought about the naming conventions of Java exceptions, regarding exceptions starting with "Invalid" and such starting with "Illegal". When looking through the Exception classes, at a first glance it looks like the "Illegal..."…
user7291698
  • 1,972
  • 2
  • 15
  • 30
3
votes
1 answer

Why are Datomic attributes are named in camelCase

I noticed that in many examples datomic attributes are named using camel case (for example startMonth instead of start-month in mbrainz schema: https://github.com/Datomic/mbrainz-sample/blob/master/schema.edn#L78) which would definitely be more…
Tomas Kulich
  • 14,388
  • 4
  • 30
  • 35
3
votes
2 answers

Using variables in a PL/pgSQL function

Postgres PL/pgSQL docs say: For any SQL command that does not return rows, for example INSERT without a RETURNING clause, you can execute the command within a PL/pgSQL function just by writing the command. Any PL/pgSQL variable name appearing…
Nulik
  • 6,748
  • 10
  • 60
  • 129
3
votes
1 answer

Generics types naming

I have code like this: TServer = class private fOnMsgFromServer: TProc; public procedure RegisterOnMsgFromServer(aCallBack: TProc); procedure Execute; end; procedure…
aQuu
  • 565
  • 8
  • 18
3
votes
1 answer

Naming convention for Android widgets

I think official code style guidelines from Google are very helpful, but they do not cover naming conventions for view elements. Let's say we simple Activity which contains one ImageView, one TextView and Button. Code would look like this: class…
Nominalista
  • 4,632
  • 11
  • 43
  • 102