Questions tagged [naming]

A general purpose tag to cover anything concerning naming, be it files, programming constructs, data etc.

A general purpose tag to cover anything concerning naming, be it files, programming constructs, data etc.

1723 questions
32
votes
5 answers

What is the preferred way (better style) to name a namespace in Ruby? Singular or Plural?

What are for you the pros and cons of using: FooLib::Plugins FooLib::Plugins::Bar vs. FooLib::Plugin FooLib::Plugin::Bar naming conventions? And what would you use or what are you using? What is more commonly used in the comunity?
Szymon Jeż
  • 8,273
  • 4
  • 42
  • 60
31
votes
3 answers

When should I use camelCase / Camel Case or underscores in PHP naming?

I've been learning PHP and see there is a lot of variability in how people name stuff. I am keen to at least be consistent with myself. Where should I be using Camel Case and where should I be using underscores? Thoughts: Variables / Properties:…
Linz Darlington
  • 515
  • 1
  • 10
  • 25
29
votes
5 answers

Why are x86 registers named the way they are?

For example, the accumulator is named EAX and, while the instruction pointer is called IP. I also know that there are bytes called CL and DH. I know there must be a convention to all of the names, but what is it?
eleven81
  • 6,301
  • 11
  • 37
  • 48
29
votes
2 answers

Difference between element, item and entry when it comes to programming?

Naming variables is quite important and being a non-native English speaker I wonder what the difference would be for using element, item and entry to name things within data structures or variables/parameters.
Martin Kersten
  • 5,127
  • 8
  • 46
  • 77
29
votes
2 answers

When to use exclamation mark in clojure (or lisp)?

They say that use exclamation marks when naming impure functions. But I don't exactly understand the "impure" functions. Are they functions change state of their arguments (via reset!, alter, java-object-methods, ...) functions occur side-effect…
Bak Yeon O
  • 357
  • 3
  • 7
29
votes
8 answers

How to generate random variable names in C++ using macros?

I'm creating a macro in C++ that declares a variable and assigns some value to it. Depending on how the macro is used, the second occurrence of the macro can override the value of the first variable. For instance: #define MY_MACRO int…
freitass
  • 6,542
  • 5
  • 40
  • 44
28
votes
13 answers

Reserved words as names or identifiers

Is there any tricky way to use Java reserved words as variable, method, class, interface, package, or enum constant names?
None
27
votes
4 answers

Is there a reason Image.FromFile throws an OutOfMemoryException for an invalid image format?

I am writing code that catches this OutOfMemoryException and throws a new, more intuitive exception: /// ... /// The file does not have a valid image format. public static Image OpenImage( string…
Joe
  • 16,328
  • 12
  • 61
  • 75
26
votes
5 answers

What does "f" stand for in C standard library function names?

What does f stand for in the name of C standard library functions? I have noticed that a lot of functions have an f in their name, and this does not really make sense to me. For example: fgets, fopen, printf, scanf, sqrtf and so on.
Erik W
  • 2,590
  • 4
  • 20
  • 33
26
votes
23 answers

Do you use "kibibyte" as a unit of measurement in your programs?

For decades, in the field of computing (except disk manufacturers), a KB (kilobyte) was understood to mean 1024 bytes. In the past few years, there has been a movement to use KiB ("kibibyte") to mean 1024 bytes, and change the meaning of kilobyte to…
Steve Hanov
  • 11,316
  • 16
  • 62
  • 69
25
votes
10 answers

.NET Testing Naming Conventions

What are the best conventions of naming testing-assemblies in .NET (or any other language or platform)? What I'm mainly split between are these options (please provide others!): Company.Website - the…
Seb Nilsson
  • 26,200
  • 30
  • 103
  • 130
25
votes
8 answers

How to come up with clearer interface names?

I saw in an application where it had interfaces such as: IHasContent IHasValue IHasMesh IHasGeometry IHasTransformation Should they not be?: IHaveContent IHaveValue ... Or?: IIncludeContent IIncludeValue ... Personally I am leaning towards just…
Joan Venge
  • 315,713
  • 212
  • 479
  • 689
25
votes
9 answers

Long variable names

Lets say i have a variable that contains the number of search engine names in a file, what would you name it? number_of_seach_engine_names search_engine_name_count num_search_engines engines engine_names other name? The first name describes what…
RaouL
  • 1,133
  • 4
  • 14
  • 17
22
votes
2 answers

Why was the name "arange" chosen for the numpy function?

Is there a specific reason the numpy function arange was named so? People habitually make the typo arrange, assuming it is spelled as the English word, so the choice seems like something of an oversight given that other less ambiguously spelled…
iacob
  • 20,084
  • 6
  • 92
  • 119
22
votes
4 answers

Mapping query parameters to @ModelAttribute does not respect @JsonProperty name

@GetMapping("item") public @ResponseBody String get(@ModelAttribute Item item) Item has the attributes name itemType When I access /item?name=foo&item_type=bar the item gets populated only with name not with itemType. I tried a bunch of…
hansi
  • 2,278
  • 6
  • 34
  • 42