Stack Exchange Network

Stack Exchange network consists of 174 Q&A communities including Stack Overflow, the largest, most trusted online community for developers to learn, share their knowledge, and build their careers.

Visit Stack Exchange

Questions tagged [naming-standards]

The tag has no usage guidance.

1
vote
1answer
43 views

Naming Convention [closed]

When we determine names for the variables, there are two important issues that the people mention: The variable names must be explanatory. For the sake of this, their names can be long.` The variable ...
0
votes
0answers
85 views

Is there a naming convention for a boolean parameter that toggles the function functionality? [closed]

I am wondering if there is a common one letter representation for a boolean toggle which is for disabling function code. So for example: // A function that will make text blink for stdout // I might ...
-2
votes
0answers
58 views

Naming convention: map vs mapping vs mapper [closed]

I've been refactoring some code and I've stumbled across two classes with almost the same fonction: they were Java bean representation of an XML, used to map stuff (status and project name from ...
2
votes
4answers
197 views

C# class naming convention for a single item in the item list [closed]

In my C# project, I have a domain class named 'User'. this class will contain user's id, firstname, last name, DoB, home address, phone, etc. And we also have a typical REST web api (i.e. api/users) ...
-2
votes
1answer
47 views

How do I name a service that adds a line item to the quote?

I have an object called LineItem, which can be added to an object called Quote. A Quote can have 0 or more of LineItem. I have a service, which is a class, whose purpose is to add LineItem to the ...
1
vote
1answer
125 views

Using “On” at the start of a method name

From what I've observed, methods that start with the word "On" fall into two categories: A base class that defines an event will expose a protected method whose name starts with "On" followed by the ...
-1
votes
1answer
50 views

Variable naming for collaboration between software engineering and data science

There exist lots of discussions on variable naming. However, I would like to address a specific aspect. I am a data scientist and deal with dozens of features/variables/columns — however you may call ...
3
votes
1answer
138 views

Application_Start() vs ApplicationStart()

Why is the method in Global.asax called Application_Start() and not ApplicationStart()? According to MSDN method names should be in Pascal case.
2
votes
1answer
46 views

Does any scale exist (e.g. naming convention to be used for sizes) that allows trivial insertions at any point in the scale?

Question probably sounds confusing so let me clarify. Let's say I have an object containing keys and values for my project's font sizes: { small: '8px', medium: '11px', large: '14px', } ...
8
votes
4answers
606 views

Is it a good practice to end a function's name with a preposition?

I have seen examples of methods whose name ended with a preposition applying to the first (and most often only) parameters. But other examples don't use this kind of naming convention. Which do you ...
0
votes
0answers
59 views

Does this format violate ISO 8601?: YYYY-MM-DD-HHMMSS

I'm reviewing best practices for naming things with a date and/or time, and it seems that ISO 8601 provides a solid foundation. However, I see things here & there that seem to violate the ...
0
votes
1answer
125 views

Is there a rule of thumb when it comes to the “name” attribute?

Since there is things like BEM in naming conventions for HTML class attributes, does the name attribute have anything of that sort?
0
votes
1answer
53 views

What to specify as interfaces in component diagrams

I am following the textbook Object oriented software specification using UML, patterns and Java (3rd edition) and I am defining interfaces between system components (subsystems). But I encountered a ...
2
votes
1answer
202 views

Naming conventions for pure functions

Are there 'conventions' / best practices on naming pure functions? For example: adding numbers: add or sum? calculating the square root: calcSqrt or sqrt? reversing a list: reverse or reversed? ...
0
votes
3answers
192 views

Naming variable which describes that something is currenty in use

I'm creating a variable which should describe that an object is currently in use. Lets say we have a form with a password input, and I want to describe the state when someone is using that input. Is ...
-1
votes
2answers
158 views

SQL Coding Naming convention: Variable same name as Columns

Is there a coding naming convention principal for SQL variables? Can variables be named the same as column names, I heard in different companies, this may cause confusion. However in C# below, its a ...
0
votes
1answer
79 views

Co-ordination between technologies following different naming conventions [duplicate]

Javascript community generally follows camel case naming convention, whereas while writing REST api URLs follow snake case naming conventions. What would be the better naming convention for the ...
6
votes
1answer
252 views

Is it a good practice to redefine unavailable keywords as macros?

Is it a good practice to redefine unavailable keywords with macros? I use GCC 4.8 in one of my projects which isn't exactly C11 standard compatible. At least not the extent of 4.9. But there are some ...
2
votes
1answer
325 views

How to name a Boolean variable that represents either of two options?

I'm developing an application with Python. I want to have a Boolean variable that represent whether something is buy or sell but I'm not sure how I should name it. Here are my current ideas: isBuy ...
2
votes
1answer
229 views

Method naming: to vs as vs get

Do the words to, as and get have any special meaning when used in method names? Examples to new Integer(4).toString() get Integer.getInteger("system.unknown.property",4) as Arrays.asList(...
0
votes
1answer
113 views

Is a URC (Uniform Resource Citation) synonymous with a Query String or Url Parameters?

Reading this: https://renenyffenegger.ch/notes/development/web/URI-URL-URN-IRI-URC URCs provide a set of attribute/value pairs that describe properties of URIs like authorship, publisher, ...
-3
votes
3answers
159 views

Ambiguous use of “User”

In one of my projects, I had to name some variables and functions that belong to the person using my app. I named them userCard, getUserInventory() and so on. I named them like that cause there were ...
0
votes
3answers
252 views

RESTful APIs: Terminology for Update Modes/Types

When designing a RESTful API, providing a spec for updating an entity will force the designer to make some decisions on how the update will behave (an update mode or type). Here are some of the modes ...
-3
votes
2answers
348 views

Writing readable code and not overdoing it with naming [closed]

I've been in an argument at work about writing readable code. It was mainly about variable and method names and the idea that comments are worthless if the code is readable enough. I would not like to ...
-2
votes
1answer
718 views

How to name different components in adapter pattern?

(example code in PHP, but this can apply to more languages) I have a scenario with an adapter pattern, where I have classes, interfaces and objects with different roles, like so: An original object ...
2
votes
4answers
508 views

Naming similar variables [closed]

I need few related variables (for example I have the lengths of 3 lines given. I have to say whether they form a triangle). Which variable naming convention is preferable in Java? len0, len1, len2 ...
-3
votes
1answer
68 views

What to call a API and DB code layer [closed]

In a recent MVVM mobile app project I wrote a set of API classes and Database classes where there was a clear flow of logic between both api and db code. To enforce the way api and db interacted I ...
0
votes
0answers
35 views

Best practice on naming an array (i.e. an array of image file names) [duplicate]

I have an array of image file names. e.g: [ 'a/b/foo.jpg' 'c/d/bar.jpg', 'example.png' ] However, I am confused as to what the best practice of naming this array. Would it be: ...
29
votes
2answers
8k views

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 ...
6
votes
2answers
1k views

What's the Java convention for names with a sequence of numbers, like “ISO 8859-1”?

If I'm creating a Java class for something that has a sequence of numbers in its name, e.g. “ISO 8859-1”, how should I name my class? Iso88591 seems wrong, since there's no boundary between the ...
1
vote
0answers
893 views

Entity Framework naming conventions for the same table name across multiple schemas

The DbContext of my application's Entity Framework setup (which I will refer to as ApplicationContext, the name of our derived type) contains classes for all of the tables in our SQL Server database, ...
5
votes
2answers
647 views

Use of “my” prefix in object naming

I am refactoring a large code base, and noticing the author often uses "my" to prefix object names. For instance, using myThingy to identify an object of type Thingy. Is this generally considered a ...
1
vote
2answers
64 views

What's the standard term for removing data and embedded code modules from a database before publishing?

Hopefully this question isn't too application-specific; I'm thinking about it with regard to Excel, but I think it applies to any file-based database that includes embedded code. I'm working on an ...
14
votes
8answers
8k views

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, ...
3
votes
1answer
59 views

Naming a view class

I'm a little hesitant on what to name a view class. I have a view class which I call ChooseImageView because that's what the user does in that view. After the user has chosen an image I display a ...
0
votes
1answer
789 views

Naming collections of helper methods, and avoiding meaningless jargon words

While coding anything remotely useful, I inevitably find myself wanting to add methods to perform smaller bits and pieces. (It could be a method to return everything in a string to the left of the ...
1
vote
2answers
754 views

JS: convention to distinguish immediate vs async methods

I normally have a laissez faire attitude on method naming conventions but now I am working on a module in JavaScript that will have some methods that can return the value directly (immediate / plain ...
4
votes
1answer
6k views

What is the best practice when it comes to naming microservices?

I come from a "monolithic" SOA API mindset where, lets say, there would only be one RESTful service for persistence (persistence-app). Now that I'm developing in a microservice environment, I believe ...
46
votes
2answers
11k views

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

Which is the better name for a method that returns a boolean? IsSupportContentType or CanSupportContentType
0
votes
3answers
2k views

How and why do we have underscores in variable naming

If I look in python code and sometimes maybe also in C codes, there is often two variables with the same name except for the underscore. For example two variables variable1 data; variable2 _data; ...
1
vote
4answers
834 views

Naming procedure conventions - Where to place adjective in a verb followed by an object convention

I am reading on Coding Complete book the following statement: To name a procedure, use a strong verb followed by an object A procedure with functional cohesion usually performs an operation on an ...
0
votes
2answers
147 views

How to name the classes that caries data to a different layer?

When I retrieve data from database I name the class as Model, for example UserModel. When I send data to the View I name the class as ViewModel, for example UserSettingsViewModel. How to name the ...
-1
votes
1answer
964 views

Do you name a dictionary by the key or the value? [closed]

Do you name a dictionary by the key or the value? I have a dictionary that will hold gradient data and the component: dictionary[gradient] = component; Do I name it gradientDictionary or ...
2
votes
3answers
328 views

Applying the label “Parent/Child” on inheritance vs composition

I just stumbled over an interesting problem with naming. I am writing automated tests for an Object-Relational mapper. This involves using super-generic classes that exist solely to exercise certain ...
2
votes
3answers
1k views

Naming convention for C# class that accesses a webservice

I apologize if this is a little vague, but I'm curious about what most people use for naming conventions for classes that access a webservice. Typically on my team we create separate projects for BLL ...
1
vote
0answers
63 views

Project Structure for intermediate level abstraction

This is really a question on higher level naming. We have an API directory for classes that deal directly without outside APIs, and contain all the code to consume a specific API. We call this lib ...
2
votes
2answers
278 views

When should I use “value” as an argument name? [closed]

I'm building my own utility functions to master ES6: const contains = (array, value) => { return array.indexOf(value) > -1 } const keys = (object) => { return Object.keys(object) } ...
-1
votes
1answer
144 views

How to name a class whose purpose is to hold related objects?

I am working in a wizard in WPF application. As the wizard gathers a lot of information I have designed separate view models for each step (view) in a wizard. But I have to hold all this information ...
140
votes
17answers
29k views

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 ...
2
votes
2answers
382 views

Choose best function name in repository [duplicate]

In my code, I'm using repository pattern. For example, I got deal repository. I just curious how you decide the name of the function when the function itself doing so many things. I think when the ...