Sunday, April 10, 2011

When to Make a Subclass

Found this really useful during the reading:
"First, know the framework. You should become familiar with the purpose and capabilities of each class in the framework. Maybe there is a class that already does what you want to do. And if you find a class that does almost what you want done, you’re in luck. That class is a promising superclass for your custom class. Subclassing is a process of reusing an existing class and specializing it for your needs. Sometimes all a subclass needs to do is override a single inherited method and have the method do something slightly different from the original behavior. Other subclasses might add one or two attributes to their superclass (as instance variables), and then define the methods that access and operate on these attributes, integrating them into the superclass behavior."

http://developer.apple.com/library/ios/#documentation/Cocoa/Conceptual/CocoaFundamentals/AddingBehaviortoaCocoaProgram/AddingBehaviorCocoa.html#//apple_ref/doc/uid/TP40002974-CH5-SW22

P.S. it is really unfortunate that the book: "Designing Gestural Interfaces" is only PARTIALLY online unless you register for a free trail. Chapter3 looks really interesting.

No comments:

Post a Comment