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.
3,957
questions
0
votes
0
answers
32
views
is using underscores in variables names bad? [duplicate]
so while a was talking to a friend about my code, he said that i shouldn't use underscore characters in my variables. i understood that it's allowed by the language (c++) and as long as i don't name a ...
0
votes
1
answer
29
views
Why do I get a naming convention error in PySpark when the name is correct?
I'm trying to groupBy a variable (column) called saleId, and then get the Sum for it, using an attribute (column) called totalAmount with the code below:
df = df.groupBy('saleId').agg({"...
0
votes
0
answers
17
views
Best naming convention for a Java utility class and method which forwards a request to an error handler mapping [closed]
I have a class ErrorForward which is basically a utility.
It's used in Servlets, inside the catch block.
It forwards request to /error mapping and sets the exception as a request attribute, to be used ...
0
votes
0
answers
60
views
What is the best naming convention for constant variables? [closed]
I usually use the UPPERCASE naming convention for const variables, but I sometimes forget and am very inconsistent with it. I know a lot of people use the UPPERCASE convention, but what are the limits ...
0
votes
1
answer
45
views
Is there a naming convention for the package alias in Python? [closed]
How to find the naming convention for the package alias ? e.g.
import pandas as pd
pd is the alias of pandas. For the less common packages, is there an alias naming convention ?
1
vote
0
answers
32
views
Stub object naming conventions
I need to perform a suite of unit tests to a function that sorts an array based on a combination of 4 parameters. The nature of the functions makes it so that it has a lot of edge cases and I need to ...
0
votes
1
answer
16
views
Insert a variable into an objects name in Javascript [duplicate]
If you look at the JSON posted further below, I have several objects named row0, row1, row2 etc...
The code I posted further below works but not as intended. The problem lies with the following line:
...
1
vote
1
answer
34
views
Can I apply a crate attribute only to the crate itself?
I have a Rust project that needs a few binaries with TitleCaseNames. So I created source files like src/bin/MyFooBinary.rs and src/bin/MyBarBinary.rs. The compiler warns that these binary crates ...
0
votes
0
answers
17
views
Name for REST endpoint that serves the single closest match to a search
My REST API serves items at /items, and items by exact name at /items?name=:name. An API consumer needs another endpoint that serves the single item with "most similar" name, instead of ...
-1
votes
1
answer
56
views
What is the name of the variable naming convention used in VBS that includes the data type in the name? [duplicate]
I have recently started working in a system that includes the data type in the fieldnames for every record. I'm writing up the documentation for this system (in particular the coding conventions), and ...
3
votes
2
answers
69
views
Is underscore needed between the word and number in a variable name?
I have 2 variables, city1 and city2 as shown below:
city1 = "New York"
city2 = "Los Angeles"
According to Function and Variable Names in PEP 8 – Style Guide for Python Code, an ...
1
vote
2
answers
60
views
Is camelCase basically deprecated or not allowed to use in Python?
I read Naming Conventions in PEP 8 – Style Guide for Python Code.
And, it says:
Function and Variable Names
......
mixedCase is allowed only in contexts where that’s already the
prevailing style (e.g....
0
votes
1
answer
24
views
REST API naming for short entity version
For instance,
I have a team entity and API to retrieve teams will be like this:
GET \teams
To retrieve a single team
GET \teams\{team_id}
and so on...
What name will be good if I need to return a ...
0
votes
0
answers
26
views
GraphQL naming convention when objects and models have "Type" in their names
It feels weird asking about this, but I'm at a point where I really just need to ask someone.
I'm developing a GraphQL schema using Django and Graphene. Everything works fine. The problem I have is ...
-1
votes
2
answers
48
views
DotNet Naming rule for auto property fields
Is there a way to change the naming conventions for auto properties to camelCase.
E.g. with the .editorconfig file?
Thanks!
-1
votes
1
answer
18
views
What is the best practice when naming a queue?
I would like to know if there is an internationally recognized best practice for naming queues?
My question is probably easiest to understand with an example:
Someone uploads an image and I add a ...
0
votes
0
answers
31
views
Should java/scala test packages follow the structure as main regarding inverted domain prefix?
The convention for java and scala in main package is:
main/
java-or-scala/
inverted.domain.convetion/
foo/
What about the test package? Is there a convention? Should it be:
test/...
1
vote
0
answers
35
views
Flutter streams/controllers naming convention
I have a question about the naming convention of exposed Streams and private StreamControllers in your apps. Currently, we have sth like that:
final BehaviorSubject<T> _valueController;
...
0
votes
0
answers
13
views
Up or Down? Upstream - downstream, genealogies vs hierarchies vs fluids, pyramids vs trees vs streams, Which one is the preferred one?
I usually find that talking about graphs and relationships, which include everything from OOP design principles, reactive systems and even microservices.
The words UP and DOWN, are the source of ...
0
votes
1
answer
13
views
Convention for naming tables with lists of possible values
How do you usually call tables to store lists of possible values for fields in other tables. What prefix/suffix would you use?
For example:
contract_type (
contract_type_id,
contract_type_name,
...
0
votes
0
answers
9
views
Long variable names: better use timein and timeout?
i was recording the time a user stayed at a page, especially at the login page.
I then compared this time to my Variables
minAllowedTimeForRevisitAsGuestSec
...
-3
votes
0
answers
79
views
How to structure a file system in the best way possible?
Sometimes I get the feeling that there's a proper way of keeping everything organized on your OS (i.e. libs, apps, or environments).
Let me know if you know a kind of proven way to organize files/apps/...
0
votes
0
answers
36
views
Are there well known conventions for naming and signatures of C asynchronous functions?
I'm coming from the C# world.
I had async functions there and I need them in C.
I know, I have callbacks. So...
Instead of:
await DelayAsync(1000); TheNextThing();
I say:
delay_async(1000, ...
0
votes
0
answers
11
views
What is the naming convention for Laravel store confirmation dialog
I have a form to create a new resource (for example a new user account). When the form is submitted, I want to show a summary of the data which the user has just submitted before actually storing this ...
2
votes
3
answers
71
views
Naming a subclass to store requirements of the parent class
I have the class Party and inside i have some restrictions to join that party.
Looking like this:
class Party {
String id;
String name;
Instant date;
Requirement requirement;
}
class ...
0
votes
1
answer
44
views
Can the id and a class have the same name of an html element?
The CSS allows that I can have a class called “.header”, as well as “.main”, “.footer”, “.aside” and so on... the same for IDs. In theory, I can have 3 selectors with almost the “same” name, like “...
0
votes
0
answers
52
views
What is the most common name for staging/pre-production/prod-like deployment environment?
We use several different names for the "staging/pre-production/prod-like" deployment environment in our organization. This environment is very close to production and we do final tests there ...
0
votes
2
answers
141
views
Etymology of "sink" in SwiftUI / Combine?
I'm joining development on an existing SwiftUI / Combine iOS project, which is my first exposure to the technology.
The names of functions like assign(to:on:) are easy enough to grok, but I'm lost at ...
0
votes
1
answer
90
views
Naming convention for variables containing file path or its parts
What are standard or most self-descripting variable names for variables with following values? (Consider them from perspective of File.Ext)
// Windows environment
var0 = "C:\Folder_A\Folder_B\...
0
votes
0
answers
15
views
Naming: Composite vs compound for entities that delegate function calls to array of entities (vs something else?)
Imagine you have some Entity class and want another class that groups multiple instances of Entity.
How do you name it?
CompoundEntity?
CompositeEntity?
something else?
This is a common thing I do, ...
0
votes
1
answer
69
views
Should I write the name of states, cities in capitals for JavaScript code while it's naming conventions suggest camel case
I'm a junior JS developer, and I'm not sure what's considered best practice for naming the variables that might be connected to the front-end interface.
For example, I'm trying to provide a list of ...
1
vote
1
answer
46
views
What is the implication of naming a package, method or parameter as "Factory"?
This is a very basic question that doesn't seem to be asked or answered anywhere.
Sometimes we define a method and name the parameter as "factory". Example: https://github.com/AirtestProject/...
0
votes
0
answers
14
views
Is there any standard or widely-accepted convention for structuring and naming general software projects in enterprises?
Not only for the source files but also other related artifacts such as reports. There could be more than one standard covering different aspects but the main point is that it should not be too ...
0
votes
1
answer
62
views
Why is "app.Add*()" and "app.Use*()" naming convention used in ASP.NET Core application?
In ASP.NET Core, when configuring services I notice that it's usually done by extension methods that have prefix Add*.
Similarly, when configuring middleware pipeline, we have extension methods with ...
2
votes
3
answers
169
views
Proper naming conventions for a dictionary in Python
After having someone read through my code, I noticed they got confused by the name of a variable containing a dictionary. The variable was named after the purpose of the keys in the dictionary, not ...
0
votes
0
answers
47
views
Single underscore as unused variable name in function signature?
I am building an interface in C which defines some function types with predefined signatures. Some implementations of this interface may not use some of the passed variables.
Is it a good / reasonable ...
1
vote
2
answers
105
views
How to implement a custom Rubocop rule for checking git branch naming convention?
For example, I need to check the correctness of git branch naming - it should contain ticket ID similarly to this:
module Rails
class GitBranchName < RuboCop::Cop::Cop
MSG = "Use correct ...
0
votes
1
answer
17
views
What the standard/conventional extension for a one data per line file on Windows? (list)
I'm used to name list files (one item per line) as *.lst under Linux.
Example.:
\data.lst
entry1
entry2
entry3
...
entryN
However i am currently working on Windows with Visual Studio, and *.lst file ...
0
votes
1
answer
44
views
How to name Settings model properly in Django?
As we all know the best code style practice to is to name Django models (classes) as singular (Cat, User, Permission, etc.), instead of plural (Cats, Users, Permissions), because it represents the ...
1
vote
2
answers
120
views
How to represent active low variables?
I've found trailing '#' characters in the pin description section in some datasheets, which indicates that the specific pin has active-low functionality.
Is there any conventions for variable names ...
-1
votes
1
answer
37
views
What are different methods used for naming snakemake pipeline output files that depends on multiple variables?
I wrote a snakemake pipeline which is intended to be run again with different variables provided by the user in a new config file during each run.
config.yml:
param_a: 100 #filter dataset rule1
...
-2
votes
1
answer
33
views
Do any programming languages provide the ability to name the return value of a function?
Quite commonly while programming I find it necessary to document the value that a function returns. In Java/Scala world, you often use comments above the function to do this.
However, this can stand ...
4
votes
0
answers
173
views
Where to use camelCase in Python according to PEP 8?
Recently I have started working on machine learning with Python, however I'm very new to this language. I know that "Readability counts", so I have been trying to get myself familiar with ...
-1
votes
1
answer
94
views
Naming convention for pub(crate) constructor
I have a struct with two constructors, one for public usage (pub fn new(...)) and one for internal usage (pub(crate) fn new_internal(...)). NB: I use the term "internal" in analogy to C# ...
0
votes
1
answer
86
views
DDD how to name different event handlers for same event
I have a website where sellers post products for sale and buyers offer to buy the product. When the seller accepts the offer an event OfferAcceptedEvent is raised. I have two side effects: 1. the ...
1
vote
1
answer
103
views
Django views/class naming conventions
Just recently i changed my IDE to PyCharm (former was Sublime) and turns out all my views/classes are considered bad because they have underscore ( _ ) in their name.
My django-rest project views goes ...
1
vote
1
answer
179
views
Python package naming: verb or noun?
I am writing a Python package that provides a parser for, say, .xyz files. I am aware of PEP8, PEP423, and other questions here and there.
I am hesitating in naming my package xyzparse or xyzparser.
...
-2
votes
1
answer
89
views
Getting undefined index when retrieving json value of key name having a dot within in PHP [duplicate]
My JSON file has this structure:
[
{
"n.name": "name1",
"n.section": ["section1"]
},
{
"n.name": "name2",
"n....
0
votes
1
answer
24
views
In the snake_case convention, should general or specific entry come first?
In the snake_case convention https://en.wikipedia.org/wiki/Snake_case, for example, snake_case, it seems snake is a specific type of case (there is CamelCase)
Is more common to put the specific thing ...
0
votes
1
answer
262
views
Sonar Issue : rename this abstract class
There is simple minor issue reported in Sonar for an abstract class which says to update the class name as per regex: '^Abstract|Base[A-Z][a-zA-Z0-9]*$'
It seems preety simple where we have to just ...