- Role of Bindings and Controllers
- Collaboration of Patterns Within Bindings and Controllers
- Bindings and Controllers Limitations and Benefits
Bindings and Controllers Limitations and Benefits
A common criticism of bindings is that there is too much magic happening that the programmer can't see. This chapter dispels some of the magic. Bindings are hard to document because they typically aren't visible in code. The same criticism can be made for Targets, Actions, and Outlets that are configured in Interface Builder. However, due in part to the flexibility and potential complexity of bindings, the need to document bindings is even greater than the need to document Targets, Actions, and Outlets.
The use of string keys avoids coupling between objects. Any two properties of any two objects can bind together as long as properties corresponding to the string keys can be found at runtime. Of course, the corresponding down side is that the compiler can't determine correctness of bindings. You have to wait until runtime to test bindings.
Bindings interoperate with features like Value Transformers that aren't covered in this chapter (see http://developer.apple.com/documentation/Cocoa/Conceptual/ValueTransformers/Concepts/TransformersAvail.html). Bindings have the potential to replace code that would otherwise need to be written. Chapter 29 culminated with an example use of Bindings. That example highlights the code that's replaced when bindings are used.