Cocoa (API) - Rich Objects

Rich Objects

One of the most useful features of Cocoa is the powerful "base objects" the system supplies. As an example, consider the Foundation classes NSString and NSAttributedString, which provide Unicode strings, and the NSText system in AppKit, which allows the programmer to place string objects in the GUI.

NSText and its related classes are used to display and edit strings. The collection of objects involved permit an application to implement anything from a simple single-line text entry field to a complete multi-page, multi-column text layout schema, with full professional typography features such as kerning, ligatures, running text around arbitrary shapes, rotation, full Unicode support and anti-aliased glyph rendering. Paragraph layout can be controlled automatically or by the user, using a built-in "ruler" object that can be attached to any text view. Spell checking is automatic, using a single dictionary used by all applications that uses the "squiggly underlining" convention introduced by Microsoft (actually a dashed red underline in Cocoa). Unlimited Undo/Redo support is built in. Using only the built-in features, one can write a text editor application in as few as 10 lines of code. With new controller objects, this may fall to zero. This is in contrast to the TextEdit APIs found in the earlier Mac OS.

When extensions are needed, Cocoa's use of Objective-C makes this a straightforward task. Objective-C includes the concept of "categories" which allows for modifications to an existing class "in-place". Functionality can be accomplished in a category without any changes to the original classes in the framework, or even access to its source. Under more common frameworks this same task would require the programmer to make a new subclass supporting the additional features, and then change all instances of the classes to this new class.

Read more about this topic:  Cocoa (API)

Famous quotes containing the words rich and/or objects:

    The belief that established science and scholarship—which have so relentlessly excluded women from their making—are “objective” and “value-free” and that feminist studies are “unscholarly,” “biased,” and “ideological” dies hard. Yet the fact is that all science, and all scholarship, and all art are ideological; there is no neutrality in culture!
    —Adrienne Rich (b. 1929)

    Nobody seriously questions the principle that it is the function of mass culture to maintain public morale, and certainly nobody in the mass audience objects to having his morale maintained.
    Robert Warshow (1917–1955)