Questions tagged [naming-standards]

Naming standards is about defining rules about the use of symbols such as the name of namespaces, packages, modules, types, functions, or variables

Naming standards is about defining rules about the use of symbols such as the name of namespaces, packages, modules, types, functions, or variables

169 questions
294
votes
2 answers

Python file naming convention?

I've seen this part of PEP-8 https://www.python.org/dev/peps/pep-0008/#package-and-module-names I'm not clear on whether this refers to the file name of a module/class/package. If I had one example of each, should the filenames be all lower case…
darkace
  • 3,051
  • 3
  • 10
  • 5
150
votes
17 answers

Coding standard for clarity: comment every line of code?

I've worked in shops that produce life critical software and I've dealt with commenting rules that were meant to keep the code readable and potentially save lives. In my experience though the requirement becomes a brain dead chore to be ticked off…
77
votes
3 answers

Naming of bool methods: Is vs. Can vs.?

Which is the better name for a method that returns a boolean? IsSupportContentType or CanSupportContentType
Mediator
  • 839
  • 1
  • 7
  • 11
69
votes
8 answers

Naming issues: Should "ISomething" be renamed to "Something"?

Uncle Bob's chapter on names in Clean Code recommends that you avoid encodings in names, mainly regarding Hungarian notation. He also specifically mentions removing the I prefix from interfaces, but doesn't show examples of this. Let's assume the…
Vinko Vrsalovic
  • 858
  • 1
  • 6
  • 13
66
votes
1 answer

Swift Protocol Naming Conventions

Coming from a mainly c# background, I'm used to using the term "interface" for describing an object with no implementation that defines behaviour. In c#, the convention is to prepend interface names with "I", as in IEnumerable, etc. Of course, the…
Michael Daw
  • 763
  • 1
  • 5
  • 5
49
votes
3 answers

Why does convention say DB table names should be singular but RESTful resources plural?

It's a pretty established convention that database table names, in SQL at least, should be singular. SELECT * FROM user; See this question and discussion. It's also a pretty established convention that RESTful API resource names should be plural.…
smitelli
  • 599
  • 1
  • 4
  • 4
48
votes
3 answers

Readme.txt vs. README.txt

I have just forked a project in Github, made my changes etc. This got me wondering: I see mostly README.txt in opensource projects and the file I edited was Readme.txt. Is this some sort of standartisation or should I have left it as is?
Tolga Ozses
  • 607
  • 1
  • 5
  • 7
37
votes
6 answers

What is the philosophy/reasoning behind C#'s Pascal-casing method names?

I'm just starting to learn C#. Coming from a background in Java, C++ and Objective-C, I find C#'s Pascal-casing its method-names rather unique, and a tad difficult to get used to at first. What is the reasoning and philosophy behind this? I'm…
Debajit
  • 473
  • 1
  • 4
  • 6
36
votes
9 answers

How to name a method that both performs a task and returns a boolean as a status?

If there is a method bool DoStuff() { try { // doing stuff... return true; } catch (SomeSpecificException ex) { return false; } } should it rather be called IsStuffDone()? Both names could be misinterpreted…
Limbo Exile
  • 705
  • 2
  • 7
  • 11
33
votes
2 answers

Why does software use the Win32 name?

If a software/library has some support for the Windows platform they almost always name their directories and variables as win32. This is most prevalent in C/C++ projects. Even the MinGW project's target triple uses win32. Is there a reason for…
Unmanned Player
  • 551
  • 1
  • 5
  • 8
33
votes
2 answers

Why does XMLHttpRequest not seem to follow a naming convention?

I've been working with the XMLHttpRequest object in JavaScript recently, and I couldn't help but notice that the casing of this name makes no sense. Why is 'XML' all in caps while 'Http' is not? They're both acronyms! Surely it'd make more sense…
Alec
  • 441
  • 4
  • 5
28
votes
8 answers

C# - Why are prefixes on fields discouraged?

Back in the old days, we did Hungarian notation. That's now considered passé, and for the most part I don't use it anymore, but I still find use for the m_ prefix to indicate member fields. For me, if I'm reading through someone else's code, and I…
Betty Crokker
  • 558
  • 2
  • 5
  • 10
26
votes
1 answer

What is the history for naming constants in all uppercase?

What is the history behind the convention of naming constants in all uppercase? My intuition is that it started with the C preprocessor, where people developed a practice to name preprocessor macros in all uppercase so that they would effectively…
jamesdlin
  • 418
  • 4
  • 11
24
votes
3 answers

Why are module-specific prefixes widely used for function names in C modules?

In some C projects, function names start with a common prefix indicative of the module name, for example: mymodule_do_this_stuff(); mymodule_do_that_stuff(); Is there a justification for doing so when the linkage is internal, and there is no…
user6007354
  • 351
  • 2
  • 5
24
votes
2 answers

Naming conventions for Java classes that have a static main method?

After reading gnat's answer to Why a static main method in Java and C#, rather than a constructor? I take his answer to mean that the purpose of a Java class with a static main method is to define a program entry point and that it is not meant to be…
Korey Hinton
  • 2,656
  • 3
  • 20
  • 30
1
2 3
11 12