Someone on IRC asked which he should use, a WATask vs a WAComponent.
First, I sent him to read the class comments, which are actually surprisingly... well... present here. :)
But the conversation then turned to "oh, so WATask is Controller, and WAComponent is View?". I thought about that for a second, and realized that this is an interesting observation.
A WATask is strictly a controller component. It cannot use #renderContentsOn: to provide any content. Any content must result from using #call: and friends to temporarily replace this component with a suitable actual component (which in turn could be another WATask or WAComponent!).
A WAComponent is primarily a view component. It should provide a #renderContentsOn: to provide some content. Within this content, callbacks can be used that should not provide rendering, but rather controller code (like small versions of WATask).
So, a WATask is strictly C. A WAComponent is mostly V with a little C. Hope that helps.
One other interesting point is that if a WATask is used as the root component, it will loop. That is, if you fall off the end of the #go method, you return back to the top! That confused me the first time I saw it, but after digging into how WATask>>#updateRoot: is implemented, it became obvious. Check it out if you're curious.
Comments