sencha at xero

41
Craig Walker, Chief Technology Officer www.xero.com Sencha @ Xero

Upload: craig-walker

Post on 10-May-2015

3.210 views

Category:

Technology


6 download

DESCRIPTION

Presentation given to the Auckland Sencha Meetup on 2 Dec 2010. Highlights how we use Sencha products (ExtJS & Sencha Touch) in our development at Xero.

TRANSCRIPT

Page 1: Sencha At Xero

Craig Walker, Chief Technology Officer www.xero.com

Sencha @ Xero

Page 2: Sencha At Xero

Craig Walker, Chief Technology Officer www.xero.com

ExtJS @ Xero

Page 3: Sencha At Xero

Craig Walker, Chief Technology Officer www.xero.com

@storminwalker

Page 4: Sencha At Xero

Who is Xero?

• Started in 2006 by Rod Drury and Hamish Edwards

• IPO in June 2007

• 100 staff in 7 locations (HQ in Wellington) and over 27,000 customers in over 50 countries

• A New Zealand business with global aspirations

Page 5: Sencha At Xero

What is Xero?

• Software-as-a-Service small business platform starting as an online accounting system

• Revolutionising the way small businesses are managed

• Staff and advisors all connected and unconstrained by legacy process or technology

Page 6: Sencha At Xero

Xero Business

Page 7: Sencha At Xero

Multi-tenanted data model

The Xero Framework

Object relational model

Multi-dimensional general ledger

Business event (transaction) engine

ASP.NET

XSLT

HTML, JavaScript

• Pure end-to-end web development framework designed from the ground up to be the platform for Xero

ASP.NET 4.0/XSLT/ExtJS

C#/WCF

LLBLGen Pro

SQL Server 2008

Page 8: Sencha At Xero

XSLT & ASP.NET• MVC pattern using

ASP.NET as a platform and XSLT as the view engine

• Combined with integrated conventions XSLT is a robust and fast view engine

• Allows our designers to incorporate their designs into the application without needing to be programmers

• It’s all about painting screens

Page 9: Sencha At Xero

Prototype

Script.aculo.us

Page 10: Sencha At Xero

The Invoice Grid

Page 11: Sencha At Xero

What we liked

• The grid!

• Pretty out-of-the-box

• Ability to theme using pure CSS

• Impressive component library

• Object-oriented

• Event subsystem

• Performance

Page 12: Sencha At Xero

What we didn’t

• Wicked learning curve

• HTML is fugly (heavy DOM)

• Theming was harder than expected

• Lack of a distribution builder

• Maintainability – very easy to write very bad code

• Performance

Page 13: Sencha At Xero

UI

ExtJS

Server

JSON

Page 14: Sencha At Xero

Server Server Server

UI

ExtJS

JSON

JSON

JSON

Page 15: Sencha At Xero

Progressive Enhancement

Page 16: Sencha At Xero
Page 17: Sencha At Xero

UI

ExtJS

ASP.NET

HTML

HTTPHandler

JSON

HTML

Page 18: Sencha At Xero

Evolution

Page 19: Sencha At Xero

Static classes

Ext.ns(“XERO”, “XERO.yada”);

XERO.yada.MyClass = {

init: function() {

new Ext.Panel({ renderTo: “divId”, cls: “xero-panel”, items: [ new Ext.grid.GridPanel({ … }) ] });

}}

console.log(XERO.yada.MyClass.init());

Page 20: Sencha At Xero

Componentised

Ext.ns(“XERO”, “XERO.yada”);

XERO.yada.MyPanel = Ext.extend(Ext.Panel, { cls: “xero-panel”, renderTo: “divId”,

initComponent: function() { this.grid = new Ext.grid.GridPanel({ … }); this.items = [ this.grid ];

XERO.yada.MyPanel.superclass.initComponent.call(this); }});

Ext.reg(“xero-panels-mypanel”, XERO.yada.MyPanel);

var myPanel = Ext.create({ xtype: “xero-panels-mypanel”, renderTo: “anotherDivId” });

Page 21: Sencha At Xero

Xero Help

Page 22: Sencha At Xero

ASP.NET MVC

UI

ExtJS

JSON

Page 23: Sencha At Xero

Xero Personal

Page 24: Sencha At Xero

UI

ExtJS

ASP.NET MVC

HTML

JSON

HTML

Page 25: Sencha At Xero

Xero Touch

Page 26: Sencha At Xero

ASP.NET MVC

UI

Sencha Touch

JSON

Page 27: Sencha At Xero

Why Sencha Touch?

• Cross-platform

• Looks native, feels native

• Faster, cheaper, easier to build with

• Highly customisable

• Flexible deployment

• HTML5/CSS3 goodness

Page 28: Sencha At Xero

Sencha Touch ≈ ExtJS 4.0

Page 29: Sencha At Xero

ModelView

Controller

Ext.regController

Ext.regModelExt.regStore

Ext.extend(Ext.Panel { ...}

Page 30: Sencha At Xero

Theming• SASS & Compass (compass-style.org)

• CSS3 is awesome – SCSS is awesomer@import “compass/css3/gradient”;

$width: 100px;.button { width: $width; .linear { @include linear-gradient( color-stops(white, #c39 30%, #b7f 70%, #aaa) ); }}

.button { width: 100px;}.button .linear { background-image: -webkit-gradient(linear, 0% 0%, 0% 100%, color- stop(0%, #ffffff), color-stop(30%, #cc3399), color-stop(70%, #bb77ff), color-stop(100%, #aaaaaa)); background-image: -moz-linear-gradient(top, #ffffff 0%, #cc3399 30%, #bb77ff 70%, #aaaaaa 100%); background-image: linear-gradient(top, #ffffff 0%, #cc3399 30%, #bb77ff 70%, #aaaaaa 100%);}

Page 31: Sencha At Xero

Tips & Tricks

Page 32: Sencha At Xero

Tools

• Browsers – obviously

• Firebug (getfirebug.com)

• Illumination (illumination-for-developers.com)

• Web Inspector

• YSlow (developer.yahoo.com/yslow)

Page 33: Sencha At Xero

Object-oriented

• Use namespaces to define your library

• Define components – code for reusability

• Extend first, write plugins second (not at all if possible)

Page 34: Sencha At Xero

Events rock!

• Use events to communicate between components

• Use an event manager

• Use event delegation

Ext.get('header').on('click', function(e,target){ if (Ext.get(target).is('.item')){

}}, this, { delegate: 'a.menu’})

Page 35: Sencha At Xero

Override appropriately

• Do not edit the library files

• DO NOT EDIT THE LIBRARY FILES!

• Use an overrides file if you need to override the framework

• Do the same with CSS (but you should be using cls properties)

Page 36: Sencha At Xero

Define a directory structure

• Break your code into small files

• Use build tools to compile for performance

• Use extjs-debug-all.js & extjs-debug-base.js during dev (but never prod!)

• Keep the framework up-to-date – upgrade as often as you can

Page 37: Sencha At Xero

Worry about performance

• Understand client-side performance rules & use them

• concatenate, minify, compress!

Page 38: Sencha At Xero

Theming

• Use CSS

• Understand XTemplate

Page 39: Sencha At Xero

Sencha.com

• Read the forums

• Read the docs

• Read the source!

Page 40: Sencha At Xero

Any questions?

www.xero.com

Page 41: Sencha At Xero

We’re always hiring!www.xero.com/careers/