Examples
When coding examples and explaining things to folks I'm generally a minimalist. I try to make examples that show as simply as possible the feature or concept I'm explaining.
In writing this book on animation though I'm struggling with that tendency. I have built a bunch of really simple user interfaces that show the animation techniques. I think the examples are good for explaining the concepts and show in a minimal fashion what can be done. So that part is positive. What I'm having a hard time with is there is little motivation or guidance in these examples of when or why to use the animation.
I fell something like I'm writing a book about the button when there is not a common set of understood interaction paradigms around the button. There are ways we should use a button and there are ways we should not. As developers we have developed that all important intuition over the years of what to do with a button.
With animation that corporate intuition is not there. I of course have my ideas of how we should use animation, Apple has its ideas and others have also put some animation into their apps. We have a start but its just that a start. So as I write these examples I struggle with doing an example to illustrate the why as well as the how. The trouble is that much of the why requires a bigger (usually much bigger) example and the details of that bigger example end up obscuring what I'm trying to explain.
As a concrete example take the Cocoa Slides application that Apple provides as an example of what you can do with animation. That has a kitchen sink approach to putting in tons of features to show off the animation possibilities. It has no real function other than that. No one would actually use that code to model their interface (at least I'd hope not).
If all you had was this example and you want to know how to put a QuartzComposer composition into a view you'd have to wade through all the bucket of code to get at that little bit. And there is always the possibility that the code in class A somehow makes everything work but the code that messes with the QC composition is in class B. It can be difficult to find that one line of code in class A that makes everything work as expected. It can be quite frustrating to figure out how to do the little bit you want to do successfully. Where as a simple example that had one view and placed a QC composition into its layer would have the advantage of being exactly what you were looking for.
On the other hand the Cocoa Slides example is inspiring because of its beauty. It just looks so cool. If you've not played with it you need to is fantastic. It has placed visions in my head of what is possible and how beautiful an application can be, even a useless one.
So anyway as an author I want to make sure the people get the most out of the book so I want to include examples that help people to understand animation as best I can. What are your thoughts, how do you learn best? I posted about this a while back in my java blog and got some interesting responses. I'd love to get some of the Cocoa community's thoughts.




How about the Flex Store as an example? I think it uses animation well from a UI perspective and also is interesting enough that I would want the code to use myself.
Posted by Jason on November 13, 2007 at 11:02 AM MST #