News for hackers. Stuff that matters.
Re:Goodbye, Clean Code by endgame on Saturday January 11, 2020 @09:50PM (#22024137)
From (I think) an old Joshua Bloch talk on API design, paraphrased:

* If you generalise based on one example, you will get a flexible API that can handle only that example. * If you generalise based on two examples, you will get a flexible API that can switch between those two examples. * If you generalise based on three examples, you have a chance of abstracting over the common essence.

Re:Goodbye, Clean Code by abrax3141 on Sunday January 12, 2020 @10:44AM (#22026745)
Hmm. I wonder if he got that from Simon while he (JB) was at CMU. He (HS) once said to me, jokingly, I think, “One makes an observation, two makes a generalization, three makes a proof”.
Re:Goodbye, Clean Code by DataWorker on Sunday January 12, 2020 @12:21PM (#22027500)
Sounds good but is wrong. Sometimes you need more than 3. Maybe 3 is for those who need to move fast and break things though.
Re:Goodbye, Clean Code by abrax3141 on Tuesday January 14, 2020 @12:43AM (#22042181)
Yeah. I think he (HS) was joking. He had a Nobel, and (co)invented AI. I’m pretty sure he knew what a proof is.
Re:Goodbye, Clean Code by kitd on Sunday January 12, 2020 @07:13AM (#22025933)
Yes, he mentions it in Effective Java. When designing APIs, collaborate with 3 clients if possible.
Re:Goodbye, Clean Code by aj7 on Sunday January 12, 2020 @12:52PM (#22027743)
Until an example that “doesn’t fit” ?
Re:Goodbye, Clean Code by scarface74 on Sunday January 12, 2020 @01:18PM (#22027952)
And then if the example “doesn’t fit”. It’s by definition a different thing than you originally modeled