← Back to SproutCore Training Overview

SproutCore Datastore Training

There are no online training classes scheduled at this time.

Get the video for this training class for only $99.
The video is DRM-free, in the mp4 format, and is watermarked throughout with the purchaser's name. You will receive an email when your video is ready to download.


Class Description

SproutCore includes a powerful, full-featured and cloud-ready model layer framework called the datastore.

This class will explain (with code and diagrams) every major aspect of the datastore. Following the class, you will have the necessary info to choose the correct server-interaction style and provide the proper API to your app's controller and view layers.

You'll learn a practical, scalable methodology for providing model layer functionality early in the app development process, and then iteratively extend the reach of your model layer to the server and with push. Finally, you'll learn how to handle the latency issues that arise with browser apps connecting to the cloud.

We'll also cover how to test your model layer, both for correctness and for performance. With regards to performance, substantial time will be spent on the various "knobs" in the datastore available for performance tuning. In combination with the development approach I'll be describing, you will be able to handle virtually any performance issue that arises on the SproutCore side of the client-server interaction.

This is a hands-on, practical class designed to change the way developers think about, code, and test their model layer code with SproutCore. After this course, you'll be able to begin applying what you've learned to your existing codebase the following day.

The class starts at 10 am Pacific Standard Time, has a 10-15 minute break around noon, and goes until 2pm. Space is limited to 24 people. Please arrive 5 minutes before the class is schedule to start.

The class will start on time. If you are late, need to leave during the class, or cannot attend at all, a video of the class is made available for you to review.

Please allow 2-4 weeks for the video to be encoded. Each video is unique to the attendee, and may not be a recording of the specific class taken, though it does contain the same material as the outline. With up to 24 attendees, it takes a while to do.

Cost

The class is $99 USD/person. Quantity discounts are not available.

Course Outline

Note: Subject to change. I'm still improving the presentation. :-)

  • Datastore: SproutCore's High-Performance Model Layer
    • what a modern model layer "does"
      • provides a framework for the object lifecycle
      • provides ways to group, sort, and query model objects
      • implements a "transactional" object graph approach
      • supports lazy data loading
      • makes undo/redo support uniform and simple
    • where the model layer fits in with KVC/KVO/Bindings and the "V" property
    • why the model layer is frequently its own framework
      • testing and performance
      • separation of concerns
    • the two fundamental tasks of the model layer
      • provide an API to app-level code that provides access to and/or updates the "store"
      • efficiently interact with the server for persistence and/or communication (push)
    • how the datastore is engineered
      • SC.Store and storeKeys
        • storeKeys are globally-unique integers
        • the datastore uses storeKeys internally for everything
      • SC.Record
        • primary keys
        • the 'status' property
        • the 'attributes' property
        • get() and set()
          • SC.RecordAttribute
          • ignoreUnknownProperties
          • readAttribute()/writeAttribute()
  • Datastore's app-level features
    • a model-layer schema
      • mapping JSON hashes to objects
        • transforming properties
        • transforming keys
        • synthesizing properties at runtime
      • mapping relationships between objects
        • to-one relationships
          • using the SC.Record.toOne() helper
          • using queries and record arrays directly
        • to-many relationships
          • using the SC.Record.toMany() helper
          • using queries and record arrays directly
    • query-based record arrays
      • what is a query?
        • a SQL-like language for finding records
        • an abstraction for performance
          • SproutCore has no "query optimizer"
          • what SproutCore has is even better: scoped queries
      • what is a record array?
        • the result set for a query (analogous to a "view" in SQL)
        • a structure for lazy loading
        • what you hand to applications from your model layer
    • what model layer API to provide for your app(s)
      • SC.Store and it's APIs are not for app use!
        • apps should not create the store
        • apps should not call SC.Store APIs
        • apps SHOULD create and use nested stores
      • you should provide API to create new records
        • apps should not use YourApp.YourRecord.create()
      • you should provide API to create queries and record arrays for apps
        • apps should not call SC.Store#find()
          • provide specific API to do this
        • queries and record arrays are store-specific
          • you'll need to know which store they're for when you create them
          • give your apps API to do this
          • for query networks, provide the whole network
      • you should provide API for all "actions" need by your app(s)
        • some restrictions apply, attend class for details
      • these "rules" apply to both server-interaction styles
        • some restrictions apply
  • Datastore's server-level features
    • there are two main styles of server interaction
      • the proactive style
        • you decide when to contact the server, and what to ask for
          • can use whatever server API makes sense
        • use SC.Store's pushRetrieve() and friends to update the store (only)
        • "base" store is READ-ONLY
          • use nested stores when you need a READ-WRITE store
      • the reactive style
        • "base" store is READ-WRITE
          • don't HAVE to use nested stores (though still recommended)
        • update server after changes are made (aka "reactively")
          • using SC.DataSource, or
          • by overriding SC.Store#createRecords()
        • can use ReST backend, but will perform poorly
          • better to send store changes to dedicated server app
          • CAN use ReST calls from dedicated server app
          • does not apply for LAN-based apps
      • the proactive style is by FAR the easiest if you have an existing server
        • also easiest to get running with push
      • datastore FULLY SUPPORTS both styles
        • neither is "better" than the other; I use and recommend both
    • when to use a particular server-interaction style
      • how "push" technology factors in
    • coding the "proactive" style
      • OtherInbox uses the proactive style
      • use SC.Store#pushRetrieve() and friends
      • the "base" store is read-only
        • this includes key-value coding's .set() on model objects!
          • many apps don't actually need directly-writable objects
        • use nested stores to work around this
          • you'll need model-layer API to "apply" a nested store
          • this is much easier/cleaner than it sounds in practice
    • coding the "reactive" style
      • with SC.DataSource
      • without SC.DataSource
  • Misc. Datastore Stuff
    • nested records
      • attribute or record?
        • records MUST have a primary key
        • attributes do not have a primary key
      • nested record support in 1.5
    • addressing performance and latency
      • when you're using the proactive style
      • when you're using the reactive style
      • how to handle data sets that are "too large" to load into the browser
    • what about local (offline) storage?
      • pretty easy to do overall
        • depends mostly on non-datastore things (your server, server interaction-style, etc.)
      • can be done with either approach
        • use a lookaside cache
        • cache changesets locally when offline, in addition to updating the database
    • how model-layer development fits into the overall development process
      • providing fixtures and related API to apps
      • testing for correctness and performance
      • dealing with performance problems (latency and server speed)
      • dealing with large data sets

Teacher Bio

Erich Ocean has been working with Cocoa for 13 years and with SproutCore since 2007. He has taught this course material at Apple (Cupertino, CA), Infosys (India), Bosch (Germany) and to individuals all over the world.

Erich consulted with Apple Computer on SproutCore 1.0 and MobileMe, and with other companies on SproutCore and Cocoa. Most recently, Erich ported the Google v8 JavaScript engine and node.js to Solaris 10.

In 2009, Erich was the primary architect behind SproutCore 1.0's highly-regarded datastore framework.

Quotes

Mike Subelsky, OtherInbox:

Erich Ocean is a software visionary and a gifted teacher. He marries extensive development expertise with an engaging teaching style, which helped me quickly get up to speed in a language and framework that were brand-new to me while building OtherInbox on a tight deadline. I would recommend his training to anyone who wants to get better, faster, and smarter at building applications.

Andreas Linde, Cultured Code:

Working with Erich Ocean has been an awesome experience. The workshop was perfectly organized and all our questions and issues were addressed. We were even able to bring in some new questions and work on strategies and proof of concepts on how our goals could be achieved. The know how that we were able to gather via the workshop made it possible to speed up our development time tremendously while increasing code quality and overall understanding of the used frameworks. We can't wait to do another workshop when our next project starts.

Gregory Moeck, Review:

The training materials on Sproutcore are definitely lacking, and so to have the opportunity to watch, and talk with Erich for 4 hours was a steal of a deal at double what I was charged. I would certainly recommend the course to others...




Last updated February 20, 2011.
Copyright 2010-2011 Erich Atlas Ocean. All Rights Reserved.