mojo+presentation+1

37
Craig Condon github.com/crcn Fork me on GitHub! Wednesday, October 30, 13

Upload: craig-condon

Post on 15-Jan-2015

631 views

Category:

Technology


0 download

DESCRIPTION

Mojo.js is a JavaScript framework for building Single Page Applications, or static websites in Node.js. It's inspired by Angular.js, Derby.js, Knockout.js, Meteor.js, Ember.js, jQuery, Backbone.js, and many other JavaScript, and non-JavaScript frameworks. Much of the design was inspired by Backbone.js, and Node.js. The core is small, while third-party modules allow you to customize Mojo depending on your requirements. Mojo was built initially to phase out old code, and itself - hence the modularity. The philosophy behind Mojo is to allow you to build on top of your old code base, and slowly strangle out your old application until you have a new, highly maintainable application.

TRANSCRIPT

Page 1: Mojo+presentation+1

Craig Condongithub.com/crcn

Fork me on

GitHub!

Wednesday, October 30, 13

Page 2: Mojo+presentation+1

Hi, I’m Craig

•Engineer for 12 years

•Focus on application architecture

•Built browsertap.com, photomotr.com, cloveapp.com

•Full stack engineer at ClassDojo

Wednesday, October 30, 13

Page 3: Mojo+presentation+1

ClassDojo

• startup

•One of the fastest growing ed-tech company in history

•Backed by Jeff Clavier, Ron Conway and Paul Graham

Wednesday, October 30, 13

Page 4: Mojo+presentation+1

Approaching ubiquity across the US

(teachers only)

(Slide Redacted)

Wednesday, October 30, 13

Page 5: Mojo+presentation+1

Why?

•Self directed— able to pick whatever we want to work on

•High impact & high growth

•Flexible work schedule

Wednesday, October 30, 13

Page 6: Mojo+presentation+1

History of JavaScript at ClassDojo

Wednesday, October 30, 13

Page 7: Mojo+presentation+1

StackRequireJSfront-end:

view partials generated from backend

back-end:

testing:

Wednesday, October 30, 13

Page 8: Mojo+presentation+1

Front-end Problems

•Quickly built

•Little structure, not maintainable

•Hard to add new features

•36,000 LOC

Wednesday, October 30, 13

Page 9: Mojo+presentation+1

Why not an existing MV* Framework?

Wednesday, October 30, 13

Page 10: Mojo+presentation+1

Framework Requirements

•Not a lot of features

•Compatible with existing libraries

•Strangles old code out

•Testability

Wednesday, October 30, 13

Page 11: Mojo+presentation+1

Framework Fears

•Backbone compatibility

•IE compatibility

•Modularity

•Strangleability

•Unforeseen consequences

Wednesday, October 30, 13

Page 12: Mojo+presentation+1

Wednesday, October 30, 13

Page 13: Mojo+presentation+1

•Built to phase out old code, and itself

•Node.js philosophy

•Module-based

•Organization

Mojo.js

Inspired by

… and others!

Wednesday, October 30, 13

Page 14: Mojo+presentation+1

Sketch

Wednesday, October 30, 13

Page 15: Mojo+presentation+1

Scaffold & Implement

Wednesday, October 30, 13

Page 16: Mojo+presentation+1

v0.1

•Designed after Backbone.js, and jQuery

•Interchangeable parts

•Bindable.js - inspired by ember bindings

•Usable anywhere in the application

Wednesday, October 30, 13

Page 17: Mojo+presentation+1

Wednesday, October 30, 13

Page 18: Mojo+presentation+1

Wednesday, October 30, 13

Page 19: Mojo+presentation+1

Wednesday, October 30, 13

Page 20: Mojo+presentation+1

Dojo v1

Dojo v2(Mojo)

Phase in, Phase out

Wednesday, October 30, 13

Page 21: Mojo+presentation+1

Dojo v1

Dojo v2(Mojo)

Phase in, Phase out

Wednesday, October 30, 13

Page 22: Mojo+presentation+1

Old ArchitectureDojo v2(Mojo)

Phase in, Phase out

Wednesday, October 30, 13

Page 23: Mojo+presentation+1

Old Architecture

Dojo v2(Mojo)

Phase in, Phase out

Wednesday, October 30, 13

Page 24: Mojo+presentation+1

Challenges

•Evolution, refactoring

•innerHTML browser inconsistencies

•Stack overflows

•Feedback

•Wanted to dev faster

Wednesday, October 30, 13

Page 25: Mojo+presentation+1

v0.2

•Paperclip module

•Declarative two-way data-binding inspired by

•DOM shims

•100% JavaScript, including templates

Wednesday, October 30, 13

Page 26: Mojo+presentation+1

Wednesday, October 30, 13

Page 27: Mojo+presentation+1

http://jsperf.com/dom-vs-innerhtml

innerHTML vs appendChild

Wednesday, October 30, 13

Page 28: Mojo+presentation+1

Framework Comparison

1. build HTML string 2. call innerHTML 3. traverse and & bind

1. call innerHTML 2. traverse and & bind

1. build DOM & bind

Wednesday, October 30, 13

Page 29: Mojo+presentation+1

Current Status• Template Engine - declarative two-way data-

binding, similar to Handlebars

• Components - Ember-style components in templates - <div> {{#chart}} </div>

• Models - bindable objects / collections - communicates with API

• Router - HTTP router

• Mediator - Abstracts communication between parts of the application

• Testing - Testing Framework

Wednesday, October 30, 13

Page 30: Mojo+presentation+1

Team Productivity

•Build on top of existing code base

•Sketches > Scaffolding > Implementation

• Improved collaboration

•Reduced code bloat

•Rapid iterations

Wednesday, October 30, 13

Page 31: Mojo+presentation+1

Wednesday, October 30, 13

Page 32: Mojo+presentation+1

student.classdojo.com

• 3 weeks to design & develop

• 2.5K LOC

• Developed backend & front-end independently

• Easy to test

Wednesday, October 30, 13

Page 33: Mojo+presentation+1

Demo

Wednesday, October 30, 13

Page 34: Mojo+presentation+1

Resources

•Mojo.js - core framework

•Mojo Starter - starter kit for building applications

•ClassDojo - Company

Wednesday, October 30, 13

Page 35: Mojo+presentation+1

•Node.js support (derby / meteor style)

•Mojo Inspector

•More plugins

•Plugin catalogue

What’s next?

Wednesday, October 30, 13

Page 36: Mojo+presentation+1

Craig Condongithub.com/crcn

github.com/classdojo/mojo.js

Wednesday, October 30, 13

Page 37: Mojo+presentation+1

Thanks!Craig Condon

github.com/crcn

github.com/classdojo/mojo.js

Wednesday, October 30, 13