3 ms·
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
by endgame 7y ago
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.
- kitd 7y agoYes, he mentions it in Effective Java. When designing APIs, collaborate with 3 clients if possible.
- abrax3141 7y agoHmm. 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”.
- DataWorker 7y agoSounds good but is wrong. Sometimes you need more than 3. Maybe 3 is for those who need to move fast and break things though.
- abrax3141 7y agoYeah. I think he (HS) was joking. He had a Nobel, and (co)invented AI. I’m pretty sure he knew what a proof is.
- aj7 7y agoUntil an example that “doesn’t fit” ?
- scarface74 7y agoAnd then if the example “doesn’t fit”. It’s by definition a different thing than you originally modeled