News for hackers. Stuff that matters.
Re:Diary of a Failed Startup by kaens on Monday June 23, 2008 @12:31PM (#225251)
"Solve a problem, not a class of problems."

I, for one, think this is good advice for code in general. At least "at first, solve a problem, not a class of problems".

I have noticed that if I write my code too general at first, it ends up solving one class of problems kinda poorly, and ends up being re-written. If I write it for the specific problem I need to solve, and then generalize it to include another similar problem when I need to (and continue this process), I end up with very solid generalized code that solves a specific class of problems very (IMO) elegantly. It still gets re-written, but in a small-chunk iterative fashion.

This, of course, may be because of the way I think - or it may be due to me being relatively "young" as a developer. I am slowly generating more general purpose code that is getting reused for similar problems in different applications, however I write much more code for specific problems than I re-use.

Perhaps someone who's been doing serious coding work for more than a few years would like to weigh in on this?

Re:Diary of a Failed Startup by llimllib on Monday June 23, 2008 @01:41PM (#225331)
I've always liked the rule of three; the first time, solve just your immediate the problem. The second time, notice that you solved the same problem twice. If the same situation occurs a third time, write a general solution.
Re:Diary of a Failed Startup by eelco on Tuesday June 24, 2008 @06:55PM (#226928)
I couldn't agree more. I call this ORYO: Only Repeat Yourself Once. Actually, I often put comments in my code marking places I've already repeated myself (saying 'ORYO' plus a reference, if needed).
Re:Diary of a Failed Startup by run4yourlives on Monday June 23, 2008 @12:42PM (#225267)
This will only become more true as you gain experience.

Take a look at any piece of software you consider great, and you'll see that at version 1, it did very little, but did it well.

Conversely, take a look at something like Lotus notes, and you'll see that the opposite is true.

Consider yourself lucky to have discovered this idiom so early in your career!

Re:Diary of a Failed Startup by alecthomas on Monday June 23, 2008 @01:36PM (#225325)
This is often referred to as YAGNI (http://c2.com/cgi/wiki?YouArentGonnaNeedIt).
Re:Diary of a Failed Startup by aston on Monday June 23, 2008 @03:05PM (#225436)
Joel calls this "Architecture Astronomy." http://www.joelonsoftware.com/articles/fog0000000018.html