building enterprise apps with sencha extjs/touch & deftjs

28
Building Enterprise Apps with Sencha & DeftJS ryan canulla | @ryancanulla

Upload: fitc

Post on 11-May-2015

1.197 views

Category:

Education


7 download

DESCRIPTION

with Ryan Canulla Presented live on Nov 7-8, 2013 in Boston at FITC's Web Unleashed 2013 conference. Learn how to build enterprise applications with Sencha & DeftJS. This session will discuss the build process and application architecture, as well as DeftJS integration — leave with all of the tools needed to begin writing scalable, maintainable and testable Sencha applications.

TRANSCRIPT

Page 1: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

Building Enterprise Apps withSencha & DeftJSryan canulla | @ryancanulla

Page 2: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Our Roadmap

Create workspace/apps

Configure deft and create login views

Add localization

Add viewController/businessService

Reorganize workspace & add unittesting

Add documentation

•••••

Page 3: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Sencha CMD

Cross-platform

Command line tool

Provides automated tasks around the fulllife-cycle of your applications

•••

Page 4: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Sencha CMD

Code generators

Application management

Web server

•••

Page 5: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

$ sencha generate [command]

workspace

app

Page 6: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Workspace Overview

.sencha/ # Sencha-specific files workspace/ # Workspace-specific content sencha.cfg # Workspace config file plugin.xml # Workspace-level pluginpackages/ # Sencha Cmd packagesbuild/ # Where build output is placedweb/ # Applicationmobile/ # Application

Page 7: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

App Overview

.sencha/ # Sencha-specific files app/ # App-specific content sencha.cfg # App config file build-impl.xml # Standard app build script plugin.xml # App-level pluginindex.html # Entry point to your appapp.json # App configurationapp.js # Initialization logicapp/ # MVC structure

Page 8: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

$ sencha app [command]

build - Executes the build process for an application

refresh - Updates the application metadata file

upgrade -Upgrade the application SDK

Page 9: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

$ sencha web [options] [command]

--port, -p

start

stop

Page 10: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Create workspace/apps withSencha CMD

Page 11: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Integrating DeftJS

Add Deft to your app.json

"requires": [ "[email protected]" ]

Refresh & build your app

$ sencha app refresh$ sencha app build

Page 12: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

DeftJS Features

IoC Container

MVC with ViewControllers

Promises and Deferreds

•••

Page 13: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

IoC Container

Eager and lazy instantiation

Injects dependencies before the class constructor isexecuted

userService: ‘SampleApp.service.UserService’

inject[ ‘userService’ ]

••

••

Page 14: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

MVC with ViewControllers

Class annotation-driven

Supports multiple view instances

Integrates with destruction lifecycle

Automatically cleans up listeners

Control a view and delegate work to injected business service (service classes, Stores, etc.)

•••••

Page 15: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Promises and Deferreds

Provides an elegant way to deal with async calls

Register success, failure, cancellation orprogress callbacks

Allows chaining

Implements the CommonJS Promises/Aspecification

••

••

Page 16: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Configure DeftJS IOC Containerand create a login view

https://github.com/ryancanulla/sencha-deft-sample/tree/step-one

Page 17: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Add localization

https://github.com/ryancanulla/sencha-deft-sample/tree/step-two

Page 18: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Architecture Overview

Page 19: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Modular Directory Structure

Organized by functionality

Essential for large applications

module.js

Configure IOC container Define events Define constants

•••

---

Page 20: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

View Controllers

Configure view data

Listen for events

View: user interaction

Services, stores, models (data changes)

••

--

Page 21: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Business Services

Business specific logic

Build the data to power your view

Available for injection

Fire events

••••

Page 22: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Custom Proxy

Page 23: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Add viewController/businessService

https://github.com/ryancanulla/sencha-deft-sample/tree/step-three

Page 24: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Unit Testing

Page 25: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Unit Testing

Jasmine

Karma Runner

••

Page 26: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Reorganize workspace & add unittesting

https://github.com/ryancanulla/sencha-deft-sample/tree/step-four

Page 27: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

JSDuck Documentation

$ [sudo] gem install jsduck$ jsduck --config jsduck-conf.json

Page 28: Building Enterprise Apps with Sencha ExtJS/Touch & DeftJS

ryancanulla.com | @ryancanulla

Add documentation

https://github.com/ryancanulla/sencha-deft-sample/tree/step-five