Questions tagged [code-standards]

*Coding standards*, or *coding conventions*, are sets of rules or guidelines designed to govern the process of code production in a software project. They're usually based on industry best practices or generally accepted conventions.

Coding standards, or coding conventions, are, in essence, sets of rules or guidelines designed to govern the process of code production in a software project, based on industry best practices, and, as such, they have been around for almost as long as programming itself. They are often applicable to a specific programming language, library, framework or environment, but they can also be language-independent, focusing mostly on style.

While coding standards can be somewhat informal, defined by a small team or corporation for internal use, most adopted standards aim to provide a formal definition of their rules, the reasoning behind each rule, and whether (and how) compliance with those rules may be verified. The main advantage of adopting coding standards, regardless of the formality and reasoning of a standard, is to have consistency across a code base.

In practice, to a programmer, complying with coding standards means restricting oneself to a subset of the programming language's features or syntax rules, in virtue of consistency, robustness and code readability. This tends to result in increased team productivity and reduced maintenance and production costs.

118 questions
1
vote
1 answer

Is there any coding standards for x86 assembler?

I'm looking for something like MISRA or HICPP, but for assembly language. We kind of have an assorted bunch of style and security rules in our company and I suppose every coding community has its own set of useful customs. But is there any industry…
akalenuk
  • 3,815
  • 4
  • 34
  • 56
1
vote
1 answer

Current issue of a Java Style Guide/Coding Standards from an official source

I'm working on a project which is in the initial stages, and I'm setting up some coding standards and a style guide. I've been looking for some good sources for coding standards, style guidelines, and best practices in general for Java…
Dave Evans
  • 33
  • 3
1
vote
2 answers

How to organize controller class and action method?

Suppose I am working on a Car Portal. To search a new car, the user provides the following information: Brand Model ModelVersion FuelType Budget Business Rules: If user selects Brand only : Show brand list page with all models of selected…
Paul
  • 457
  • 2
  • 11
  • 26
1
vote
3 answers

How to find out if any method is written without having try catch block

In a Visual Studio 2010 C# Project, how do I find out if any method is written without having a try-catch block? Sometimes as a code reviewer, its hard to search function/methods which are not properly written according to code standards esp:…
0
votes
4 answers

Return Expressions in C++

Consider the following code: float validateEntry() { string entry; float value; getline(cin, entry); value = atof(entry.data()); return ((isNumber(entry) && value >= 0) ? i : (cout << "Enter valid amount: ",…
skippr
  • 2,656
  • 3
  • 24
  • 39
0
votes
1 answer

C# What are the Advised Coding Practises to place Constant String Literals in Class

Where is the best place to put string literals within the class? Should they be declared as constant members, should they be referenced in the method (provided the string literal is only ever used once), should they be put in a helper class or…
user989046
  • 589
  • 2
  • 7
  • 11
0
votes
3 answers

how to assure my implementation is in standard form (avoid bad coding)?

There are standard ways to implement most of the common funcionalities. For example it is recommended to use String Buffers when concatenating larger Strings rather than using Concatenating operator.(which I randomly found) Where can I find a…
Dinushan
  • 2,067
  • 6
  • 30
  • 47
0
votes
0 answers

Can a single attribute in an API definition support dual function based on a type attribute?

I have a question on whether I can use the same attribute in an API but will have different information based on a type flag within the API. The function we are planning to build is to do an automated information update vs. an On-demand information…
Karthick
  • 1
  • 1
0
votes
0 answers

How to check if all major UI elements have IDs

In order to make UI automation test cases more stable, I'm looking for a tool (perhaps a chrome extension) to check whether webpage meets some certain standard when front end developers commit their code. For example, to make sure all major UI…
0
votes
1 answer

How to wrap long lines of Apache Camel Java DSL code

In my project we are using Apache Camel via Java DSL This is how a typical route looks: from("direct:MyPizzaRestaurant") .routeId("PizzaRoute") .log(LoggingLevel.INFO, LOG, LOG_IN_MESSAGE) …
0
votes
1 answer

How we can achieve writing reusable and modular code

How we can achieve writing reusable and modular code in an Enterprise code. What are the basics to get started
0
votes
1 answer

How to format algebric code for readability

I have a fairly complex-looking (about 50 chars when typed out) equation that is all basic algebra (*, /, +, -, ^). How would I best style it for readability? Condensed, it looks difficult to read and impossible to understand how I got there, so I'm…
user760900
  • 298
  • 1
  • 12
0
votes
0 answers

Where can I set correct formating for implementations generated by Visual Studio?

If I ask Visual Studio 2017 to generate an implementation for me using this button: The result will be: void MyClass::testMethod(int * someParameter) const { } Notice that the * is not next to type. In our project, we put & and * next to types.…
Tomáš Zato
  • 50,171
  • 52
  • 268
  • 778
0
votes
1 answer

Sonarqube supports rules to enforce coding standards or not

Sonarqube produces issues with the code like bugs and security-related issues as vulnerabilities and code smell that could cause issues. Is there a way to add the coding standards to enforce conventions specific to readability and maintainability…
intechops6
  • 1,007
  • 4
  • 22
  • 43
0
votes
1 answer

How to: git repository with default NPM modules and its configs

I would like to have repository with default NPM modules and its configs for all future NPM projects. For now the configs consists of tsconfig.json, tslint.json, .prettierrc. The goal is to have a simple way for creating new project with custom…
cJayy
  • 11
  • 4