Click to search on your search term.
Subscribe to Fig Leaf Tutorials


Need help with a project? Contact us at sales@figleaf.com.
From code reviews to project "jumpstarts" and full life-cycle development, we've got you covered!
Check out our case studies!
Follow us on Twitter!
Click here to join our Facebook group!

Ready to upgrade your skills? Try these instructor-led classes in Washington, DC:
Ext JS 6 Bootcamp
12/04/2017

Getting Started with Sencha MVC

Page of 168

Large client side applications have always been difficult to maintain. They quickly grow out of control as you add more functionality and developers to a project. Sencha Touch 2 comes with an application architecture that not only organizes your code but reduces the amount of code that you have to write and maintain.

The application architecture follows an MVC-like pattern. While there are many MVC architectures, most of which are slightly different from one another, Sencha Touch MVC is defined as follows:

  • Models are a collection of data fields which persist through the data package. They can be linked to other models through associations and linked to a data stream through the use of a proxy.
  • Stores are a client-side cache of model instances.
  • Views are any type of components that output information to your browser, i.e. Container, Map, TabPanels, FormPanel
  • Controllers are used to add your application logic. You can add events to your views and their components as well as integrate data from your stores into your views.

Understanding the Benefits of Sencha MVC

Using MVC in Sencha Touch 2 provides you with the following benefits:

  • Use a single method (Ext.application()) as the central point for designing your application using controllers
  • Consistent file structure for your code and classes
  • Controllers associate models and stores with views
  • Easy to add your app's logic to your controllers
  • Easy to add events to any of your controller's view components using simple CSS selector syntax
  • Create reusable components (views) that may be defined visually through Sencha Architect and not bounded to app logic
  • Code is easy to read and maintain
  • Dependencies between classes are easier to manage
  • No need to explicitly manage required classes

MVC isn't required to develop applications, but when it is used, it brings benefits in code reuse and a predictable coding structure and pattern. Sencha Architect always generates code using the MVC pattern.

Page of 168
comments powered by Disqus