In ActionScript the URLLoader class that has seven separate events than can occur after you call the load() method.
In the HTTPServive classes there are two events,
In one of the classes I've wrote there is only one event,
result. In the result event I have property success that is set to true or false and if true the event has additional properties set. If false it has error object set.
To generalize, in the first class an event is dispatched for very specific cases. In the second class there are only two cases, success or failure. In the last is one event that contains, success, failure, errors everything all in one.
I'm now reading about callback hell when dealing with asynchronous calls and how the
then function can help with that. It will call a success or failure callback function on the results.
My question, is what are the pros and cons of writing a class that dispatches many very specific events vs dispatching fewer events and what would you like to use daily as a developer?
Note: This is regardless of the language and more of the approach one handler to handle multiple cases or multiple handlers to handle each individually.