> > The time you would need to debug this nice piece of software would > be exponentially larger then if you just used events / event dispatcher. > Though, on the other hand, if you don't work hard, it's difficult to > convince the management your work is worth the money they charge for it :) > > Best. > > Oleg >
The problem with chaining calls using event/event dispatcher is that you are essentially building what I like to call event-based-spaghetti-code. For example, say you need to make ten calls one after the other as they are dependent on each other in a certain order. Then a month later a new call needs to be implemented within this chain and some calls need reordering. Suddenly you have a huge mess of callbacks you have to reorganize. Sure its not too hard, but when I'm in the middle of a 10 day sprint I don't have time to fiddle around with trying to order callbacks to chain properly. Using something like the Task framework from Spicelib ( http://www.spicefactory.org/parsley/docs/2.3/manual/task.php) you can very easily move tasks around in order simply by moving an addTask() call up/down a line or two. These tasks are still event based, they just provide a nice API for setting up the order of tasks that need to be performed. -omar