Hacker News new | past | comments | ask | show | jobs | submit login

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.




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”.


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.


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.


Yes, he mentions it in Effective Java. When designing APIs, collaborate with 3 clients if possible.


Until an example that “doesn’t fit” ?


And then if the example “doesn’t fit”. It’s by definition a different thing than you originally modeled




Join us for AI Startup School this June 16-17 in San Francisco!

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

Search: