On Dec 23, 2010, at 1:09 PM, FF wrote: > On 2010-12-23, at 12:56 PM, David Duncan wrote: > >> On Dec 23, 2010, at 5:58 AM, FF wrote: >> >>> I copied this example from Apple docs. >> >> Generally the examples are there to show you how to use an API, not >> necessarily to be complete standalone code. You shouldn't necessarily expect >> doc examples to compile without doing extra work or cross referencing with >> another example. > > I thought, naively, that examples and tutorials in the docs are also aimed at > beginners and showing them working examples, which compile without hiccups, > is the best way to speed up the learning process.
The examples are intended to demonstrate how the API works but have a greater context. In particular the example you saw is but one of a few in the same section describing different parts of the pattern creation. Listing 6-1 and 6-2 also have critical parts of the code that you should understand before being able to use listing 6-5. Because these listings are shown first, it is expected that by the time you get to listing 6-5 that you understand the parts that are being glazed over in that example – that is, you cannot just jump to listing 6-5 and use it without having read the entire section describing how patterns work. This isn't unlike a textbook on algorithms that expects you to have a familiarity with data structures (either via earlier chapters or externally) before you are able to understand how to perform operations on them. -- David Duncan _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com