Top "Coding-style" questions

**DO NOT USE!

What was the strangest coding standard rule that you were forced to follow?

When I asked this question I got almost always a definite yes you should have coding standards. What was the …

coding-style
Default parameters with C++ constructors

Is it good practice to have a class constructor that uses default parameters, or should I use separate overloaded constructors? …

c++ constructor coding-style overloading
Getter and Setter?

I'm not a PHP developer, so I'm wondering if in PHP is more popular to use explicit getter/setters, in …

php oop coding-style
Order of items in classes: Fields, Properties, Constructors, Methods

Is there an official C# guideline for the order of items in terms of class structure? Does it go: Public …

c# .net coding-style code-cleanup code-structure
#pragma once vs include guards?

I'm working on a codebase that is known to only run on windows and be compiled under Visual Studio (it …

c++ coding-style
Coding Conventions - Naming Enums

Is there a convention for naming enumerations in Java? My preference is that an enum is a type. So, for …

java standards coding-style
Simple way to create matrix of random numbers

I am trying to create a matrix of random numbers, but my solution is too long and looks ugly random_…

python random coding-style
"std::endl" vs "\n"

Many C++ books contain example code like this... std::cout << "Test line" << std::endl; ...so I've …

c++ coding-style iostream c++-faq
When do you use the "this" keyword?

I was curious about how other people use the this keyword. I tend to use it in constructors, but I …

c# coding-style this
Dictionaries and default values

Assuming connectionDetails is a Python dictionary, what's the best, most elegant, most "pythonic" way of refactoring code like this? if "…

python dictionary coding-style