Join us in building a kind, collaborative learning community via our updated Code of Conduct.

Questions tagged [naming-conventions]

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.

1
vote
2answers
90 views

rails naming convention - “Fuel” [closed]

I have a table called fuel that stores vehicle fuel data. Can anyone suggest the correct naming convention for the controller? Thanks
115
votes
9answers
103k views
0
votes
0answers
10 views

Naming convention “by” vs “with” vs “using”

I have a project where we have a mix of different naming when a function needs to find an object using a property given in parameter. I am wondering if there is a naming convention for the following: ...
0
votes
1answer
58 views

A getter method that doesn't necessarily get a member's value?

Say I have a C++ class that holds an array. A member function of this class for example, could be to return the value at a certain index. I'm confident this would be considered a getter method. ...
-1
votes
2answers
51 views

Naming an abstract class that extends another abstract class [closed]

What is a good naming convention for an abstract class that extends another abstract class? I've got an abstract class called Builder, how should I name the abstract class that extends it? Should I ...
0
votes
1answer
11 views

REST API - Naming convention - Return collection of objects, but only a single property of these items

I have a db with a collection of Member objects. I have a method (GET) that returns all theses Member objects, but only a single property (in this case, "Id") - so not really Member objects, but ...
0
votes
4answers
60 views

Inserting data into Mysql with PHP while loop

I'm trying to check an email against my database, and if it doesn't already exist, add it to the database. $query = "SELECT * FROM users"; $inputQuery = "INSERT INTO users (`email`, `password`) ...
0
votes
2answers
18 views

REST URL naming convention /users/{id}/cars/{carId} vs /cars/{carId}?

I have a simple model Each Use can have multiple cars Now when I decide to name the related REST URL naming for Cars service Initially I suggest to be as the following GET /cars/{carId} But when ...
-3
votes
0answers
35 views

Swift method naming convention [closed]

I have a class name as follows (for detail) final class Review { private (set) var reviewCount: Int private (set) var lastReviewedDate: Date? func isPermitted() -> Bool { guard !...
0
votes
3answers
230 views

Using prefix `o` in ui5 javascript

I have seen people are using prefix o a lot when developing ui5 application. var oRowsModel = new sap.ui.model.json.JSONModel(); oValueHelpDialog.getTable().setModel(oRowsModel); if (...
0
votes
2answers
25 views

Laravel spatie/laravel-permissions Naming Conventions

Are there some naming guidelines I should be following when it comes to naming permissions? Right now, everything I find is just along the lines of "Add Foo","Edit Foo","Delete Foo","Add FooBar","Edit ...
0
votes
0answers
10 views

S3 naming for large amount of different sizes of photos

My goal is to create naming that is predictable and searchable to a certain degree. Idea is to create small images processing service that would be accessed via URL which would contain the image ID ...
0
votes
2answers
42 views

Kotlin Naming Conventions

Am a bit of an aesthetic programmer and I ventured into Kotlin lately. I named my static variable as val PREF_NAME = "onb" and got an alert in android studio I looked into this but it's contradicting ...
53
votes
4answers
51k views

What characters are allowed in C# class name?

What characters are allowed and what is not allowed in a C# class name? Could you please help? EDIT: To specify. What special characters are allowed? Please be specific, because links to 50 pages ...
5
votes
4answers
4k views

Camel case and Pascal case mistake

I constantly forget which is Camel case and which is Pascal case. So I thought that maybe a little history will help. Where do the names of these conventions come from? Is there some history behind ...
61
votes
5answers
24k views

Why does pylint object to single character variable names?

I'm still getting used to python conventions and using pylint to make my code more pythonic, but I'm puzzled by the fact that pylint doesn't like single character variable names. I have a few loops ...
557
votes
12answers
311k views

What is the naming convention in Python for variable and function names?

Coming from a C# background the naming convention for variables and method names are usually either CamelCase or Pascal Case: // C# example string thisIsMyVariable = "a" public void ThisIsMyMethod() ...
2
votes
1answer
184 views

Are there naming conventions for pip requirements files?

Are there conventions for storing multiple requirements.txt files in a Python code repository. For example, one file for simply running the program, another for day-to-day development, another for ...
2
votes
1answer
101 views

Single-function typeclass naming in Haskell | “er” vs “has”

I find it sometimes hard to come up with reasonable single-function typeclass names. If the method name is a regular verb (like get, write, read...), it's easy to do the same thing Gophers do with ...
1
vote
1answer
45 views

Perl module naming convention

I have checked On the Naming of Modules, perldoc perlvar and perldoc perlmod but can not find best practices for naming modules whose name is an acronym: SMTP, ORM. At once on CPAN both variants ...
-2
votes
2answers
34 views

What should be the name of the arguments in Array.reduce?

As a matter of best practices in terms of code readability, Which of the following naming convention should be used while naming arguments of the callback in Array.reduce? const studentAges= [15,16,...
28
votes
3answers
18k views

Is it suggested to have Git repository names in upper or camel case instead of lower case?

I see a lot of projects keeping lower case names for their GitHub repositories. Is it suggested to have repository names in Upper Case or Camel Case? If (yes/no) why?
-1
votes
0answers
27 views

I am required to create a session variable that I can’t find a syntactical equivalent for

So at work my boss wants to structure the website’s code to fit a standard he has envisioned; this way the syntax is much more digestible for new hires, along with for efficiency purposes. Now I am ...
6
votes
4answers
11k views

Are class names allowed to be lower case

I ran my program successfully when declaring a class name starting with a lower case letter. I don't understood why it is asked to start with first capital letter.
6
votes
2answers
127 views

Avoiding the pitfall of using anaphoric macro unwittingly

How do I know whether I'm calling an anaphoric macro? If I do so without knowing it, some seemingly unbound symbols might behave quite different from what one would expect. Example Collecting all ...
1
vote
0answers
30 views

How to name an entity class that represents a collection of key/value pairs

We have an existing relational database table named Preference that we cannot reasonably change with the following schema: | PreferenceId | UserId | SerializedValue | Each SerializedValue represents ...
3
votes
4answers
72 views

Why cannot name a java package “default”?

In IntelliJ I tried to create a package for my default implementation of services with name default: 🗁 src └─── 🗁 main └─── 🗁 java └─── 🗁 service ├─── 🗁 default ...
4
votes
1answer
46 views

Kotlin naming convention for properties

Names of properties holding references to singleton objects can use the same naming style as object declarations: val PersonComparator: Comparator<Person> = ... I don't understand what ...
1
vote
1answer
33 views

Naming convention for checked and unchecked exceptions in Java

I am writing an application wehre I have some custom exception classes. The naming convention what I use for the custom exception classes is <error-name>Error.java. For example: ...
5
votes
2answers
6k views

SQL Naming Conventions

I read this tutorial, but I got confused about this. What naming style should I be using in this case: My table name: QuestionTypes or question_types? My table id: QuestionTypeID or QuestionType_ID, ...
139
votes
6answers
37k views

Correct Bash and shell script variable capitalization

I run across many shell scripts with variables in all caps, and I've always thought that there is a severe misunderstanding with that. My understanding is that, by convention (and perhaps by ...
4
votes
4answers
450 views

Test failures: false positive or false negative

If my unit test fails, but the underlying code actually works, would this be called a false positive, or a false negative? (Here is the context. I run a bunch of tests in parallel and some tests fail....
0
votes
1answer
82 views

Java 8 functional interfaces naming convention? [closed]

Does such convention exist? For example, I have a predicate: Predicate<Integer> predicate = i -> (i < 1); or BiFunction<String, String, String> function = (x, y) -> x + y;. How ...
1
vote
2answers
32 views

What is the right naming for “VPNAPIs” class

What is the right way to write the name of a class "VPNAPIs"? Is it VpnApis, VPNAPIs or VpnAPIs? VPN: Virtual Private Network. API: Application Program Interface.
0
votes
0answers
27 views

Why arraycopy() does not obey the lowerCamelCase convention? [duplicate]

Why Java's System.arraycopy() method name does not obey the lowerCamelCase naming convention for method names? By the way, there is also method getenv() in the same class, which name's composition ...
61
votes
8answers
122k views

Valid characters in a Java class name

What characters are valid in a Java class name? What other rules govern Java class names (for instance, Java class names cannot begin with a number)?
0
votes
0answers
18 views

Force jackson to return json objects in MISMO standard

In my maven pom file, I am using swagger-codegen-maven-plugin to generate models from yaml file: <plugin> <groupId>io.swagger</groupId> <artifactId>swagger-codegen-...
0
votes
0answers
9 views

naming convention for keys in toml file

looking at toml repo, I don't see any restriction/suggestion on naming convention for keys looks like most of the variables are lowercase but wanted to know what's the best practice -naming ...
119
votes
10answers
38k views

Why do Java programmers like to name a variable “clazz”?

I've seen lots of codes have declaration like Class clazz , where does this originate from ? Is this some kind of convention ? I think 'clazz' is not even an English word , has no meaning at all , how ...
1
vote
2answers
521 views

Is any meaning difference between 'Storage' and 'Repository' in the class-naming conventions?

For example, I usually name SessionStorage but ProductRepository... It is something mental I couldn't explain to myself. Does anybody understand the meaning of suffixes Repository and Storage? :)
21
votes
4answers
6k views

How to name a variable: numItems or itemCount?

What is the right way to name a variable int numItems; vs. int itemCount; or constant: public static final int MAX_NUM_ITEMS = 64; vs. public static final int MAX_ITEM_COUNT = 64;
1
vote
0answers
41 views

Interfaces convention for public libraries [closed]

I work on a simple library I plan to publish to Maven Central Repository later. For sake of brevity, I think over explicitly naming all the interfaces. Here a very simple example what I mean: public ...
1
vote
0answers
13 views

Laravel 5 Naming Conventions - Broker VS Manager

Broker - is a word that sometimes comes into the naming convention, at least we have a PasswordBroker. But more often they are Managers like in - Support\Manager and Queue\Capsule\Manager... What is ...
1
vote
1answer
36 views

Pass parameters from a function to another function where parameters have the same name in Python [closed]

Let's say I have a parameter in a function that I want to pass to another function, and both parameter are named the same (because they represent the same logical element) - How do I handle this ...
28
votes
7answers
28k views

Function naming conventions

I am writing a library, so, I want its functions to be named as clearly and cleverly as possible. Currently, I use the following principles: Self-explanatory names: a function getName() will tell the ...
0
votes
1answer
25 views

Should function name also reflect actions of functions called as callbacks on promise.then()?

When choosing a name for the function should we also take into consideration what callbacks set by this function are doing? The question is a bit tricky, but everything should be straightforward with ...
-1
votes
0answers
68 views

Use of “(_s)” after the structure name

I found a github C code where the coder has used (_s) after the structure name as shown below: struct NCO(_s) { liquid_ncotype type; // NCO type (e.g. LIQUID_VCO) T ...
2
votes
1answer
61 views

Naming convention of @FunctionalInterface

By convention, types should be named by nouns, that's ok. However, @FunctionalInterface is a special type - object type that acts like function/method. In case of function I feel like it's more ...
0
votes
3answers
56 views

How do you choose what naming convention to use for namespaces and class in c#? [closed]

When declaring namespaces and classes I noticed there are at least two ways of doing so. Two most common cases I came across are: namespace Vehicles { public class Car { public ...
10
votes
6answers
19k views

Naming convention for objects in java

I had started programming in java 2 years back. Seniors in our project at that time had advised me to append 'obj' to the name of the object which is being created. Ex: Car objCar = new Car("Ferrari"...