Tagged Questions
50
votes
14answers
6k views
Why do most of us use 'i' as a loop counter variable?
Has anyone thought about why so many of us repeat this same pattern using the same variable names?
for (int i = 0; i < foo; i++) {
// ...
}
It seems most code I've ever looked at uses i, j, ...
72
votes
56answers
10k views
Worst coding standard you've ever had to follow? [closed]
Have you ever had to work to coding standards that:
Greatly decreased your productivity?
Were originally included for good reasons but were kept long after the original concern became irrelevant?
...
68
votes
17answers
13k views
What is the benefit of not using Hungarian notation?
One of the things I struggle with is not using Hungarian notation. I don't want to have to go to the variable definition just to see what type it is. When a project gets extensive, it's nice to be ...
26
votes
15answers
2k views
Space around operators? a=b/2; or a = b / 2; What are the arguments?
Personally I prefer space around operators. For me it makes the code much more readable. What are the arguments not have space around them? Line length?
An example from the Python style guide (I ...
8
votes
9answers
1k views
What C++ coding standard do you use? [closed]
For some time now, I've been unable to settle on a coding standard and use it concistently between projects. When starting a new project, I tend to change some things around (add a space there, remove ...
58
votes
17answers
3k views
Recommendations for teaching junior programmers good coding style
I am a big fan of good coding style, producing clean, clear code that runs well and is easy to use and integrate into larger systems. I believe that we programmers are essentially craftspeople who ...
15
votes
14answers
1k views
Coding standards and coding style, is it that much important?
There are a lot of ways of typing code, but I can't understand what is the good reason to adopt a certain standard or style if it does not change the way the code can be read and understood.
Everyone ...
2
votes
2answers
153 views
Are there standard style guides for PHP?
I've been working in a very small team for PHP development and we've been using an ad-hoc, "Invented Here" style guide. Now that our team and codebase is growing, we would like to use a more ...
7
votes
7answers
948 views
Why would an employer ask for a 'long' code sample?
What would a large project that spanned multiple files and >1000 lines show to an employer that a few individual files and a couple hundred lines couldn't capture?
2
votes
6answers
1k views
Line break before/after operator
While Sun's Java code convention suggests to put line break before the operator many other guidelines disagree with it. I do not see any obvious pros and cons, so are there advantages of using one of ...