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
2
votes
1 answer

Incorporating microsoft managed recommended rules in GIT TFS 2015

I tried using stylecop, but it is quite strict with lot of rules. I do not want to customize it by disabling certain rules. I want to document that I am using 'Microsoft managed recommended rules', which I used while coding in VS 2017. I want to…
2
votes
1 answer

PHPCS - Sniffs to enforce new lines after closures and before returns?

We're running various sniffs to help consistency, along with using eslint - so we're trying to unify some rules. we can do this in eslint but cant figure out how to do it in phpcs. New line after closures e.g tap(function () { return…
owenmelbz
  • 6,180
  • 16
  • 63
  • 113
2
votes
1 answer

Best Practices - Form Class Receiving Message from Class Modules

Hoping to get some best-practice advise with regards to capturing a returned message from an instantiated class on my form. In my form (form1.vb), I have a label which reflects what is being done, with the code below. Code in form1.vb to display…
John Doe
  • 23
  • 5
2
votes
2 answers

What is name of anti pattern !string.IsnullOrEmpty(Employee.Name), (Decapsulation ?)

Very often I run into code that logic that should be within business object is repeated everywhere as such: if ( !string.IsNullOrEmpty( Employee.Name ) ) Display( Employee.Name ); where as it should be like this : if ( Employee.IsNameSpecified )…
jimjim
  • 2,414
  • 2
  • 26
  • 46
2
votes
2 answers

Extracting ReactDOM.render() calls to separate file

Background My React app currently consists of 3 top-level components; a header, an explanation paragraph, and the app itself, wrapping a bunch of child components. The last part is fine, each child component is extracted into its own file and…
Alec
  • 1,986
  • 4
  • 23
  • 47
2
votes
0 answers

Where to get C++ programming style standards and guidelines?

I have to write a code for my boss's presentation. Eventually, technical personnel and software engineers will look at the code. He wants me to perfect it so it looks professional (Do I look unprofessional??) so I have to do what has to be…
Khalil Khalaf
  • 9,259
  • 11
  • 62
  • 104
2
votes
2 answers

In what order do you put methods in class code?

Class could have static, private, protected, public methods. Each method is made for modifying, adding, removing etc. How do you group functions in class's code to make it clean to read? What is the best practices? Thank you.
Kirzilla
  • 16,368
  • 26
  • 84
  • 129
2
votes
1 answer

Exporting code style settings from IntelliJ IDEA version 14.1.5

I'm using the updated version of the IntelliJ IDEA and am trying to export my code style settings so that they can be used by all developers working on a particular project. I read the tutorials at…
misaochan
  • 890
  • 2
  • 8
  • 25
2
votes
3 answers

What is the benefit to assign the parameter to another variable

I am reading a tutorial form this site.http://tutorials.jenkov.com/java-unit-testing/matchers.html The author I believe is very experienced. I saw the code like this. I also saw someone else always like to assign the parameter of a method to a…
Tech Noob
  • 510
  • 1
  • 9
  • 33
2
votes
2 answers

PSR-0 Implementation on Class Loading

I'm not new to PHP but I'm new to PSR. I've read some of it and I want to give a try to follow this standards on coding but I'm a bit confused how can implement it. So I need a simple advice from you guys on how to implement it based on the example…
user3651491
  • 713
  • 1
  • 5
  • 6
2
votes
1 answer

How to get a list of PHP core functions in order to write function wrapper

I am trying to find a list of all the PHP core functions to write a proof of concept wrapper that standardizes all PHP function names into a consistent naming convention; in this case the PSR standards. Could anybody point me in the right direction…
Wellso
  • 119
  • 3
  • 12
2
votes
4 answers

How to add a comment in PHP and HTML

I have a some piece of code like this. How can I add comments? It has both HTML and PHP combined code.
Aqib Bashir
  • 49
  • 1
  • 7
2
votes
2 answers

How should I write words with dash in camelCase?

For example: Meta-information metaInfornation, metainformation or metainfo? getMetainfo, getMetaInfo or getMetaInformation? what about objective-c style?
BergP
  • 3,453
  • 4
  • 33
  • 58
2
votes
2 answers

Code style guide for JSF Expression Language

Are there any code conventions/standards or recommendations for formatting JSF Expression Language?
Seitaridis
  • 4,459
  • 9
  • 53
  • 85
1
vote
0 answers

Structure Policy for Django / Python Libraries

Question Summary Hi Folks, This is a kind of opinion question, I've built a Django library for my company and I keep swithering and changing my mind on how to structure it. Possible strategies I've come up with are below: Method 1 - Individual…
MajorFailz
  • 83
  • 1
  • 7