4 ms·
There's a simple concept that one should bear in mind when designing APIs: "pit of success" (credit to Rico Mariani). That is, failure should take effort. Dang
by barrkel 14y ago
There's a simple concept that one should bear in mind when designing APIs: "pit of success" (credit to Rico Mariani).
That is, failure should take effort. Dangerous options should be more laborious to express. The happy path should be the most concise and straightforward path.
- grannyg00se 14y agoI would say that by having the default be the safer option, the API is in line with that philosophy. It takes more effort to override the default and shoot yourself in the foot. Granted, it could be better. I guess that strange option could be a completely separate command parameter with a very obvious name. Then again, it's such a strange behaviour, maybe it just shouldn't even be an option at all.
- crawfordcomeaux 14y agoThe effort it takes to do something that's unsafe should be laborious and not simply require adding a single line of code. This API doesn't fit with the philosophy because it takes a negligible amount of work to walk down the unsafe path.