4 ms·
At first I thought this might have been a repost of some refactoring advice I heard of long ago. A quick google finds a reference on wikipedia [0]. Essentially
by Cogito 13y ago
At first I thought this might have been a repost of some refactoring advice I heard of long ago. A quick google finds a reference on wikipedia [0]. Essentially it goes like this:
The first time you implement something, just do it.
The second time you implement the same thing, copy it.
The third time, refactor.
The OP seems like an interesting variation on the same theme.
[0] http://en.wikipedia.org/wiki/Rule_of_three_(computer_programming) http://en.wikipedia.org/wiki/Rule_of_three_(computer_program...
- babuskov 13y agoThis is similar to Jeff's rule "b". The only difference is cause and effect ordering. Jeff suggests you build it, reuse it, and when you reused it thrice in different applications, than call it a general purpose library. It seems to me that Jeff misunderstood what rule of three means, or he's just trying to re-tell the Wikipedia article in his own words. The "Rule of three" you quoted is how it should be done. Create, copy/paste, refactor to be reusable. And there's nothing wrong with that.
- Cogito 13y agoTo be fair to Jeff, he was quoting from "Facts and Fallacies of Software Engineering" by Robert Glass [0]. The two rules are very similar, and that's why I think they have the same 'theme'. In one we are talking about when to refactor and in the other when to create a library, but both are essentially the same idea. Don't spend time generalising something that might never be used again. Three existing uses is (apparently) a good heuristic for answering "When is something going to be reused lots?" [0] http://www.amazon.com/exec/obidos/ASIN/0321117425/ http://www.amazon.com/exec/obidos/ASIN/0321117425/
- brazzy 13y ago> It seems to me that Jeff misunderstood what rule of three means, or he's just trying to re-tell the Wikipedia article in his own words. Not at all - he's actually making a much deeper point: that something cannot really claim to be reusable until it has actually been used in three different places. Because if you writer a reusable component for just one product, chances are very high that even if it's technically reusable, it will end up conceptually coupled to that one product too much to actually be useful elsewhere.
- shardling 13y agoHuh, that was the exact rule I adopted the first time I had to work on a "real" project. I wonder if I'd previously read it into my subconscious, or if it's simply kind of obvious. :)
- Zarathust 13y agoThis might be the reason behind "Everything sucks until version three"
- Casseres 13y agoAwesome. Where did you hear this? A Google search for "Everything sucks until version" returns no results. I think there might be some truth to this. My first MVP sucked hard. My second version of it was passable, but still left quite a bit to be desired. I have a feeling whenever I ever get to version 3, it will be good.
- Zarathust 13y agoI think it's from Jeff Atwood, but I can't find the exact source. It is also rather true for Samsung Galaxy and iPhones. First memorable Windows "for everyone" is 3.1 and the list goes on and on.