• 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!


Basics-Architecture Overview

Page history last edited by Charles Jolley 15 years ago

NOTE: This outline is a rewrite of Introducing SproutCore MVC to provide a clearer explanation of the main parts of the app.


  1. SproutCore applications are designed around the Model-View-Controller paradigm.
    1. MVC is a long standing pattern in desktop applications.  It helps you break your code into layers that are easier to maintain over the long run.
  2. Models
    1. implements the business logic of your application.  This is where you define things like "Contacts" and "Events" and their relationships to one another.  
    2. Also where you put data validation code to make sure your data is always consistent and correct. 
    3. You often define much of your model as a schema similar to the way you might model a database structure.
    4. In SproutCore, the model also contains server interaction code that will synchronize your in-memory data with local browser storage and with your server. 
    1. displays the visual UI of your applications
    2. handle low-level mouse, touch, and keyboard events and turn them into higher level actions that your application can respond to.
    3. Good views are written in a generic way.  Avoid putting business logic or application-specific logic into views. Instead, just write these views to worry about about drawing and events and leave everything else to the rest of the app.
    4. In SproutCore, the actual display of your UI is left up to the browser using HTML, CSS, SVG, Canvas, and sometimes Flash.  Your views will simply render this content and then leave the actual painting up to the browser.
  4. Controllers
    1. Shuttle data between your models and your views.  
    2. In a typical app you may have many model objects loaded and only a few views visible onscreen.  The controllers are responsible for picking the model objects that should be displayed and forwarding their data onto the views.
    3. In most frameworks, the controller layer is the most disorganized part of your app.  This is often considered the "glue" code that you write to hook everything together.  It is also one of the most common sources of bugs.
    4. In SproutCore apps, your controller layer is often divided into controllers, which shuttle data, and Responders, which respond to high-level actions in your application.  Using these technologies you can eliminate much of the glue code in your app, along with many bugs.


Comments (0)

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