4 ms·
If you are writing an API that others are incorporating, create equivalent pull methods for every push where possible (or alternatives if necessary). The reaso
by scj 8y ago
If you are writing an API that others are incorporating, create equivalent pull methods for every push where possible (or alternatives if necessary).
The reasoning is simple, sometimes programs get in bad states. When a bad state is detected, a program _should_ be able to go into a recovery mode and return to normal. But I've seen push-only libraries (that I could not modify), where access to the data I'd need could not be guaranteed.
This particularly holds true in a client-server relationship. The client should have a method of asking the server for help without needing to reset the session.
Ignoring state effects, a pull model will permit recovery by default, while it needs to be planned in a push model.