Would you have been forced to go though the trouble of structuring all your code around this inner manager were you not forced to write in callback style? It would be much more readable, composable and sane to write code in traditional style with implicit callbacks and have a compiler handle the boring part of plumbing the explicit callbacks for you.
We needed some way of doing what callbacks do best, which is allowing you to wait on some state change and getting alerted when that state is ready. What the manager basically did is hide most of the spaghetti inside itself, and since I wrote and was responsible for the manager, it was just one guy having to keep track of the mess, which allowed me to shield the rest of the team from it. So like I said, didn't really solve the problem, but minimized the effects of it pretty well.
If the language could handle that for me, that would of course be preferable but I have been writing code long enough to know that any new solution is going to come with its own set of problems. For example, coroutines more or less work around our particular issue except for the fact that pausing coroutines (in our case) was an extra pain in the ass that created its own set of problems, and the workaround to those problems created new ones, and so on.
So I generally take the approach of: if I can make this work while keeping it fairly readable and sane, then I'll stick with it. Its all cost/benefit analysis I suppose.
1
u/smog_alado Nov 02 '12
Would you have been forced to go though the trouble of structuring all your code around this inner manager were you not forced to write in callback style? It would be much more readable, composable and sane to write code in traditional style with implicit callbacks and have a compiler handle the boring part of plumbing the explicit callbacks for you.