Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

I actually try to build it "well" in the first pass, even for prototyping. I'm not gonna say I succeed but at least I try.

This doesn't mean writing tests for everything, and sometimes it means not writing tests at all, but it means that I do my best to make code "testable". It shouldn't take more time to do this, though: if you're making more classes to make it testable, you're already messing it up.

This also doesn't mean compromising in readability, but it does mean eschewing practices like "Clean Code". Functions end up being as large as they need to be. I find that a lot of people doing especially Ruby and Java tend to spend too much time here. IMO having lots of 5-line functions is totally unnecessary, so I just skip this step altogether.

It also doesn't mean compromising on abstractions. I don't even like the "rule of three" because it forces more work down the line. But since I prefer DEEP classes and SMALL interfaces, in the style of John Ousterhout, the code doesn't really take longer to write. It does require some thinking but it's nothing out of the ordinary at all. It's just things that people don't do out of inertia.

One thing I am a bit of hardliner about is scope. If the scope is too large, it's probably not prototype or MVP material, and I will fight to reduce it.

EDIT: kukkeliskuu said below "learn one tool well". This is also key. Don't go "against the grain" when writing prototypes or first passes. If you're fighting the framework, you're on the wrong path IME.



I personally find that doing it well in the first pass slows me down and also ends up in worse overall designs.

But I am also pretty disciplined on the 2nd pass in correcting all of the hacks and rewriting everything that should be rewritten.

There are two problems I have with trying to do it right the first time:

- It's hard to know the intricacies of the requirements upfront without actually implementing the thing, which results in designing an architecture with imperfect knowledge

- It's easy to get stuck in analysis paralysis

FWIW I am a huge fan of John Ousterhout. It may be my all time favorite book on software design.


I have found that too much coupling between product requirements and the architecture can be detrimental. It's often the reason why people tend do too much upfront work, but also slows down the evolution of the feature.

So I don't really want to know the future requirements, or refactor on the 2nd pass to "match".

If some feature needs too many modifications or special cases in the current architecture, it's a round peg in a round hole. I prefer to have those places be a bit more "painful" in the code. The code doesn't have to be bad per se, but it should be clear that something different and not traditional is happening there.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: