Msg#: 3519520 posted 7:19 pm on Dec 3, 2007 (gmt 0)
I'm not use to this whole callback methodology and if I keep going at this rate - I'm going to end up with a ton of spaghetti code!
General OO practice would dictate creation of discreet modular methods and objects that can then be invoked by a shallow wrapper method at the point of execution.
Problem is that all these things like animation sequences and async HTTP calls require waiting for a response and they're all handled *asynchrously* which then dictates a callback action befined within that particular action. So, I am now linked between one method and the next and end up with a whole chain of methods now being dependent upon one another, one after the next (they're no longer discrete and independent). Even worse - I no longer see the value in writing discreet methods this way; I might has well just have one long rambling method per action instead of trying to break up sub tasks as methods.
Is this really how AJAX developers work? Surely not? Can someone please enlighten me as to appropriate design patterns when using async event driven models?
Msg#: 3519520 posted 7:39 am on Dec 5, 2007 (gmt 0)
I found the solution - it lies in a proper event-driven model. As a background coder primarily, I'm not use to thinking in terms of asynchronous events and callbacks scenarios. Event drivers appear to be the key to a clean coding model...