views:

171

answers:

5

Hi Stackoverflow

A highly subjective question, but important I think. I often find myself struggeling with deadlines because I tend to "gold plate" my development efforts. I detest "ugly" code, but on the other hand you might not get anything out the door if everything HAS to be "gold standard". So, how and where do you draw the line between good quality and "gold plating", and do you have any tips or tricks on how to restrain yourself from wasting time on features considered to be "gold plating"?

In order to select a solution for my question, I'll select the response with the highest vote.

+2  A: 

Write good, well-factored code that does the minimal amount necessary. Know that you've designed in such a way that it'll be easy to add the extra functionality later.

Unit testing and TDD can help with this, as they promote minimal design, promote design that is easier to modify after the fact, and give a nice 'safety net' when refactoring.

kyoryu
You can gold plater during TDD too. Someone who already think that he gold plater in his code will also do it in his tests usually.
Daok
@Daok: Yeah, you can do gold-plating with anything. I find that for me, TDD at least helps fight the tendency. It's not a panacea.
kyoryu
A: 

It is called as good-enough-code.

Question yourself - Are you adding enough value by improving the code?
After a certain point the answer is no. No matter how much you try, it isn't possible to write perfect code. And I believe there is no perfect code.

I refactor the code once or twice and then stop.

Padmarag
This is a good suggestion. How do you force yourself to constantly having this in mind? I tend to wander of into: "is the naming descriptive enough, can I replace comments by more self-documenting code" etc. etc.
S.C. Madsen
A: 

Gold-plating is a process that can in theory take forever.

The best thing you can do to avoid excessive gold plating is re-phrase your question. Instead of trying to "avoid it", ask yourself "when should I stop goldplating"?

That question is much less phylosophical and easier to answer: stop goldplating when you are behind schedule.

So you need a schedule :)

Simple recipe for having a schedule: You make an initial estimate, add a 10% increase to cover "some" gold plating. Then you make a calendar of milestones (seriously, write that thing down) and stick it on a wall next to your monitor. Ideally you should have one milestone every 2 days, tops.

Then, you start developing. If a milestone is approaching and you have the requirements fulfilled, you can do some gold plating. If your requirements are not fulfilled, then you skip goldplating, and take shortcuts if needed.

egarcia
+1  A: 

I think I had this issue in the past and this is how solved it:

  1. Make it Work
  2. Test it to make sure it doesn't crash.
  3. If there is time left, improve the codding.

With experience you will find that good code will tend to appear at phase 1 ;)

Sergio
I like that approach, but I tend to work more like: prototype, prototype, prototype... Ok it now works, should we really solve the problem like this, or is there a better way, REPEAT.
S.C. Madsen
+1  A: 

If gold plating is caused by perfectionism, then to me the most important thing is to realize that there's no such thing as perfection. Any problem non-trivial enough to be worth solving requires making tradeoffs. It's simply impossible to write code that is optimal in all of the following qualities of good code:

  1. Readability/simplicity of implementation.
  2. Maintainability/flexibility.
  3. Usability/simplicity of interface.
  4. Large N/asymptotic speed.
  5. Small N/constant term speed.
  6. Memory usage.
  7. Security/robustness.
  8. Portability/standards compliance.
dsimcha
Good point, and you're absolutely right. That doesnt hinder one from wasting hours and hours on TRYING though...
S.C. Madsen

related questions