• If you are citizen of an European Union member nation, you may not use this service unless you are at least 16 years old.

  • You already know Dokkio is an AI-powered assistant to organize & manage your digital files & messages. Very soon, Dokkio will support Outlook as well as One Drive. Check it out today!

View
 

Runtime-Introduction

This version was saved 15 years, 4 months ago View current version     Page history
Saved by Charles Jolley
on December 26, 2008 at 11:08:56 am
 

Outline

  1. Property Observing provides a way for you to keep all of the pieces of your application in sync without writing glue code.  
    1. Using property observing means you can spend more time working on features while eliminating one of the most common sources of bugs in an application.
    2. Example: user presses a button to add a new item
      1. call a new method to update a record
      2. call a method to update the list of records
      3. call a method to update the count of records
      4. call a method to display the details of the new record
      5. etc, etc.
      6. With property observing, just create the new record.  All the objects observing the list of records through bindings and observers will update automatically.
  2. Property observing includes a number of related tools you can use to propagate changes. You should learn what each of these are and when to use them in your application is get the best performance.
    1. Observers - functions that "observe" a property.  Whenever the property value changes, the observer function will be executed.  You should mostly use observers to notice when properties change on your own object.
    2. Bindings - bindings tie properties of one object to another object, so that whenever the value changes in one property, the other property will be changed also.  This is how you tie together the big pieces of your application.  
    3. Computed Properties - These are properties that are actually functions which run.  You often use computed properties to create prepared "intermediate" values from your input values on an object.  In the process, you will automatically cache those results, keeping your application fast.
  3. Notification Timing
    1. Observers are notified immediately
    2. Bindings are triggered only at the end of the run loop
    3. Computed properties are 'invalidated' whenever their dependent keys changed.  This means the next time you get the property value, it will be recomputed.  If no one tries to get the value again, there will be not cost.
  4. How SproutCore Property Observing Compares To Other Frameworks
    1. Cocoa bindings for example are far less flexible and require a lot more configuration.  They do not map well to JavaScript because they require so much manual setup.

Comments (0)

You don't have permission to comment on this page.