Questions for best practices for writing high quality code.
Questions tagged [code-quality]
648 questions
355
votes
19 answers
How would you know if you've written readable and easily maintainable code?
How would one know if the code one has created is easily readable, understandable, and maintainable? Of course from the author's point of view, the code is readable and maintainable, because the author wrote it and edited it, to begin with. However,…

KyelJmD
- 971
- 5
- 10
- 20
323
votes
25 answers
When is a BIG Rewrite the answer?
Just read the question about the Big Rewrites and I remembered a question that I've been wanting answered myself.
I have a horrible project passed down to me, written in old Java, using Struts 1.0, tables with inconsistent relationships, or no…

Jonn
- 2,038
- 4
- 18
- 24
291
votes
7 answers
Does using == in JavaScript ever make sense?
In JavaScript, the Good Parts, Douglas Crockford wrote:
JavaScript has two sets of equality operators: === and !==, and their evil twins == and !=. The good ones work the way you would expect. If the two operands are of the same type and have the…

Robert Harvey
- 198,589
- 55
- 464
- 673
278
votes
25 answers
How do you know you're writing good code?
I love programming. I've been messing around with code since I was a kid. I never went the professional route, but I have coded several in-house applications for various employers, including a project I got roped into where I built an internal…

Jim
- 1,997
- 3
- 20
- 25
218
votes
18 answers
How can one manage thousands of IF...THEN...ELSE rules?
I am considering building an application, which, at its core, would consist of thousands of if...then...else statements. The purpose of the application is to be able to predict how cows move around in any landscape. They are affected by things like…

David
- 4,449
- 6
- 35
- 48
197
votes
32 answers
Is micro-optimisation important when coding?
I recently asked a question on Stack Overflow to find out why isset() was faster than strlen() in PHP. This raised questions around the importance of readable code and whether performance improvements of micro-seconds in code were worth even…

Boz
- 171
- 2
- 3
- 10
194
votes
14 answers
What's wrong with circular references?
I was involved in a programming discussion today where I made some statements that basically assumed axiomatically that circular references (between modules, classes, whatever) are generally bad. Once I got through with my pitch, my coworker asked,…

dash-tom-bang
- 2,543
- 2
- 16
- 11
191
votes
25 answers
How to convince my boss that quality is a good thing to have in code?
My boss came to me today to ask me if we could implement a certain feature in 1.5 days. I had a look at it and told him that 2 to 3 days would be more realistic. He then asked me: "And what if we do it quick and dirty?" I asked him to explain what…

Kristof Claes
- 3,100
- 2
- 21
- 33
188
votes
21 answers
A large part of my code has a major design flaw. Finish it off or fix it now?
I am a high school student working on a C# project with a friend of mine with about the same skill level as me. So far, we have written roughly 3,000 lines of code and 250 lines of test code in a span of 100 commits. Due to school, I put off the…

oldmud0
- 1,573
- 2
- 10
- 9
184
votes
10 answers
Why is Clean Code suggesting avoiding protected variables?
Clean Code suggests avoiding protected variables in the "Vertical Distance" section of the "Formatting" chapter:
Concepts that are closely related should be kept vertically close to each other. Clearly this rule doesn't work for concepts that…

Matsemann
- 1,918
- 3
- 16
- 21
174
votes
17 answers
How can I convince management to deal with technical debt?
This is a question that I often ask myself when working with developers. I've worked at four companies so far and I've become aware of a lack of attention to keeping code clean and dealing with technical debt that hinders future progress in a…

Desolate Planet
- 6,038
- 3
- 29
- 38
168
votes
28 answers
How to be a zero-bug programmer?
My boss has always told me that a good programmer should be able to ensure that the code he or she changes is reliable, correct, and thoroughly self-verified; that you should completely understand all the results and impacts your changes will cause.…

Elaine
- 261
- 2
- 4
- 4
157
votes
19 answers
How to Code Faster (Without Sacrificing Quality)
I've been a professional coder for a several years. The comments about my code have generally been the same: writes great code, well-tested, but could be faster.
So how do I become a faster coder, without sacrificing quality? For the sake of this…

ashes999
- 1,129
- 5
- 12
- 22
140
votes
10 answers
On developing deep programming knowledge
Occasionally I see questions about edge cases and other weirdness on Stack Overflow that are easily answered by the likes of Jon Skeet and Eric Lippert, demonstrating a deep knowledge of the language and its many intricacies, like this one:
You…

Robert Harvey
- 198,589
- 55
- 464
- 673
140
votes
8 answers
Recursion or while loops
I was reading about some development interview practices, specifically about the technical questions and tests asked at interviews and I've stumbled quite a few times over sayings of the genre "Ok you solved the problem with a while loop, now can…

Shivan Dragon
- 4,583
- 5
- 24
- 31