Questions for best practices for writing high quality code.
23
votes
6answers
643 views
What payoffs have you seen from taking care of technical debt?
This article on technical debt has some good points, including:
Working on the "technical matters" works best when it is driven by stories. The code base is probably in need of work everywhere, ...
22
votes
15answers
846 views
How do I convince my team to use smaller classes/methods?
Disclaimer: I'm a newcomer (this is my third day of work), and most of my teammates are more experienced than me.
When I look at our code, I see some code smells and bad engineering practices, like ...
22
votes
17answers
3k views
What are useful metrics for source code?
What are useful metrics to capture for source code?
How can metrics, like for example (Executable?) Lines of Code or Cyclomatic Complexity help with quality assurance or how are they beneficial in ...
21
votes
10answers
5k views
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. ...
21
votes
5answers
1k views
What is the politically correct way of refactoring other's code?
I'm currently working in a geographically distributed team in a big company. Everybody is just focused on today's tasks and getting things done, however this means sometimes things have to be done the ...
21
votes
9answers
1k views
My coworker is a nice guy, but his performance is sub-par. Do I tell my boss?
I was placed on a project about three months ago that was until then under development by a single, newly hired developer because it was falling behind. To be fair, the project is an interface to a ...
20
votes
11answers
2k views
How much Code Coverage is “enough”?
We are starting a push for code coverage here at my work, and it has got me to thinking.... How much code coverage is enough?
When do you get to the point of diminishing returns on code coverage? ...
20
votes
7answers
920 views
Quality of Code in unit tests?
When writing unit tests, is it worth spending the extra time to make the code have good quality and readability?
When writing tests I often break the Law of Demeter, for faster writing and to avoid ...
20
votes
8answers
1k views
Should comments say WHY the program is doing what it is doing? (opinion on a dictum by the inventor of Forth)
The often provocative Chuck Moore (inventor of the Forth language) gave the following advice (paraphrasing):
"Use comments sparingly. Programs are self-documenting, with a
modicum of help from ...
20
votes
8answers
1k views
Organizing uncommented, dirty code?
I would like to ask you some questions about dirty code. There are some beginners who coded on a medium project. The code is a very huge ball of mud. They are not advanced programmers. They just know ...
20
votes
7answers
792 views
Can working with bad code erode your programming skills?
Can working with bad code erode your programming skills?
20
votes
13answers
1k views
How do you ascertain the quality of a potential employer's code before you take a position?
In my experience before you start working for a company you have no opportunity to look at the code-base (I've asked and for reasons of confidentiality everyone has always said no, I think that is ...
20
votes
9answers
732 views
Is it better to use pre-existing bad practices, or good practices that don't fit well with old code?
I was thinking of this because I was trying to write an extension for an existing 3rd party software, and their database is horribly denormalized. I needed to use their existing tables and add a bunch ...
20
votes
6answers
457 views
How to encourage version control adoption
I have recently started working in a team where there is no version control. Most of the team members are not used to any kind of version control. I've been using mercurial privately to track my work. ...
20
votes
3answers
739 views
How does office bureaucracy affect code quality
I'm interested in stories where office bureaucracy has had direct effect on the final code quality result.
For example, a friend just told me that at his previous work place the version control ...
19
votes
17answers
2k views
What is the hardest bug to find?
If possible write how to avoid this kind of bug (besides testing, of course, please write a specific technique)
19
votes
14answers
2k views
Why do so many developers believe performance, readability, and maintainability cannot coexist?
While responding to this question, I began to wonder why so many developers believe a good design should not account for performance because doing so would affect readability and/or maintainability.
...
19
votes
8answers
673 views
How to justify rewriting/revamping legacy software in a business case?
I work for a great little software company which makes good revenue from our main software package. The problem for me is that it's almost unmaintainable. It's written in Delphi 7 (has upgraded ...
19
votes
17answers
865 views
Dealing with co-workers who do not have a consistent coding style?
What do you when you're working with someone who tends to write stylistically bad code? The code I'm talking about is usually technically correct, reasonably structured, and may even be ...
18
votes
5answers
634 views
Keep it simple now, or program with the future in mind?
I'm currently coding a new application for my company that is rather involved. To meet the deadline, the functionality has been toned down quite a bit so that we can have something ready to go for ...
17
votes
13answers
709 views
How do you overcome your own coding biases when handed legacy code?
As programmers, we often take incredible pride in our skills and hold very strong opinions about what is 'good' code and 'bad' code.
At any given point in our careers, we've probably had some legacy ...
17
votes
16answers
2k views
What's the most acceptable use of 'goto' you've ever seen? [closed]
We all know that goto is evil, goto is considered harmful, etc. But it's still around (presumably) because of the rare cases where it can be used as part of an awesome, elegant algorithm.
What's the ...
17
votes
8answers
765 views
Do you prefer conciseness or readability in your code?
Language shortcuts can often be used to make code more concise.
For example, ternary and null coalescing operators can reduce the amount of code, but arguably to the detriment of readability:
In C#:
...
17
votes
10answers
1k views
Is 100% code coverage a pipe dream?
Is it feasible to expect 100% code coverage in heavy jquery/backbonejs web applications? Is it reasonable to fail a sprint due to 100% coverage not being met when actual code coverage hovers around ...
17
votes
15answers
1k views
What simple techniques do you use to improve performance?
I'm talking about the way we write simple routines in order to improve performance without making your code harder to read... for instance, this is the typical for we learned:
for(int i = 0; i < ...
17
votes
9answers
820 views
How can I sell a legacy program rewrite to the business?
We have a legacy classic ASP application that's been around since 2001. It badly needs to be re-written, but it's working fine from an end user perspective. The reason I feel like a rewrite is ...
17
votes
8answers
874 views
What are the disadvantages of writing code before writing unit tests?
I have always seen the recommendation that we should first write unit tests and then start writing code. But I feel that going the other way is much more comfortable (for me) - write code and then the ...
17
votes
8answers
991 views
Adding complexity to remove duplicate code
I have several classes that all inherit from a generic base class. The base class contains a collection of several objects of type T.
Each child class needs to be able to calculate interpolated ...
17
votes
8answers
539 views
Does anyone else have a refactoring problem?
It seems like after I've written a significant amount of code I get this anxious feeling like I haven't done it in the best possible way, and I end up continuously refactoring and spending way too ...
17
votes
6answers
562 views
Any success stories continuously using commercial static analysis tools for C++?
I can't decide whether an offer of a commercial static analysis tool is worth spending the resources. We tried the tool on several million lines of our C++ code and it found something like 50 real ...
17
votes
5answers
990 views
Is it OK for a function to modify a parameter
We have a data layer that wraps Linq To SQL. In this datalayer we have this method (simplified)
int InsertReport(Report report)
{
db.Reports.InsertOnSubmit(report);
db.SubmitChanges();
...
16
votes
16answers
2k views
Do Programmers sometimes intentionally over complicate code? [closed]
It seems alot of times on stackoverflow, that people (programmers especially) tend to over complicate a solution to a problem to where the solution is vastly much more complicated then the original ...
16
votes
5answers
1k views
Descriptive naming vs. 80 character lines [closed]
I frequently hear these two valuable programming practices: (1) lines of code should be 80 characters or less and (2) use descriptive names for variables, methods, classes, etc. I understand the ...
16
votes
9answers
2k views
Is there any reason to use “plain old data” classes?
In legacy code I occasionally see classes that are nothing but wrappers for data. something like:
class Bottle {
int height;
int diameter;
Cap capType;
getters/setters, maybe a ...
16
votes
4answers
1k views
Why is test driven development missing from Joel's Test?
I was reading this blog by Joel Spolsky about 12 steps to better code. The absence of Test Driven Development really surprised me. So I want to throw the question to the Gurus. Is TDD not really worth ...
16
votes
7answers
451 views
Could an internal rep, voting and badges encourage good programming practices?
Just thinking out aloud - we programmers love all this voting/badges/rep stuff so could a scheme like this be introduced into a companies code review process to encourage better coding.
Something ...
16
votes
14answers
944 views
Releasing poorly written software
I've made a poorly written, yet fully functioning website, in (shock, horror, shock) PHP.
Everything works as expected, I've implemented the necessary security measures: ...
16
votes
13answers
199 views
How to name parts of your program as a non native English speaker [duplicate]
Possible Duplicate:
Do people in non-English-speaking countries code in English?
I am from the Netherlands and we speak Dutch.
I have worked on quite a few projects now in various ...
15
votes
10answers
2k views
How can I quickly weed out “copy & paste” coders?
I need a way to filter out resumes of folks who just copy-and-paste code then hope it works, and check it in if it does. All this happens without having an understanding (or care) to understand the ...
15
votes
9answers
1k views
Are too many assertions code smell?
I've really fallen in love with unit testing and TDD - I am test infected.
However, unit testing is normally used for public methods. Sometimes though I do have to test some assumptions-assertions ...
15
votes
11answers
799 views
How should I manage a team with different skill levels?
I'll be working on a software project with some friends of mine, and I've been appointed technical lead. None of these guys is a bad programmer at all, but I do have significantly more experience than ...
15
votes
4answers
373 views
Would you show your production code to candidates at the interview?
I have seen this happen multiple times:
The candidate likes the company, succeeds at the interview. Then comes to work and at the end of the first day he is sure the codebase/project is not what he ...
14
votes
9answers
1k views
Dealing with a developer continuously ignoring edge cases in his work
I have an interesting, fairly common I guess, issue with one of the developers in my team. The guy is a great developer, work fast and productive, produces fairly good quality code and all. Good ...
14
votes
12answers
1k views
What to do with a not well organized application? [duplicate]
I'm a newly graduate programmer and just got hired before my graduation. In the office, I used to create and revise modules of some applications developed by other programmers in our company. The ...
14
votes
8answers
449 views
Methodologies of a high class development team
I've recently been tasked with increasing standards and efficiency within a development team. I've read similar posts about the makings of a good development team but these often discuss the human ...
14
votes
10answers
2k views
Should a method validate its parameters?
Say you are designing a Square root method sqrt. Do you prefer to validate the parameter passed is not a negative number or do you leave it up to the caller to make sure the param passed is valid. How ...
14
votes
5answers
954 views
Is code ownership a code smell?
This is something I've been thinking about ever since I read this answer in the controversial programming opinions thread. And it has been discussed a bit in other threads, such as this one, but I ...
14
votes
6answers
570 views
How can I judge whether a project is particularly complex or if I'm just slow in picking it up?
I'm making little progress on a major project. The source is massive, many layers of objects, macaroni code, double-diamond graphs of multiple inheritance, half-baked features frozen when the ...
14
votes
11answers
372 views
Should you fix preexisting defects while working on something else?
Conundrum: During the course of working on a new feature or fixing a defect, you find a legacy problem in code. What should you do? Fix it and risk altering the behavior of the code. It has either ...
14
votes
6answers
508 views
Do abstractions have to reduce code readability?
A good developer I work with told me recently about some difficulty he had in implementing a feature in some code we had inherited; he said the problem was that the code was difficult to follow. From ...