backbone.JS and his friends
Dima Tarasenko, 2013
Skull bone...
Phalanges bone…
Rib bone…
Yes! Backbone!!!

Addy Osmani thinks about JS framework
Framework shouldn’t be slow and fat
Community
Good Documented

Fast

Intuitive

Success projects

Small

Examples

Framework should be …
Backbone.js is a lightweight JavaScript library that adds
structure to your client-side code. It makes it easy to
manage
and
decouple
concerns
in
your
application, leaving you with code that is more
maintainable in the long term. It’s a library, rather than a
framework, that plays well with others and scales
well, from embedded widgets to large-scale applications.
© Addy Osmani
So, it’s great!!!
Butt!
It’s only a code organizer!
backbone.JS
Collections
Routers
Models
Events
Views
History

Real Application

≈ 6/26 ≈ 23%

OOP core
Dependencies
Collections/Routers/Models..
Controllers
Layouts
Utilities
DOM Query
Error handling
Validators
REST support
Internalization
Application class
Normalization layer
Session management
Data Readers/Writers
Permissions management
Integration of all modules
Build system
Unit test framework
…
AAAAAAAAA!!!
Session management
OOP core

Dependency manager
Base classes
Controllers Build system

Utilities

Integration

Layouts

Unit tests

Permissions

REST support

UI components

Error handling

Validators

Oh my goodness…

Other…
Time lack
No consistency
Long code reviews
Our solutions are bad

No unit tests

A lot of bugs…
bugs…
bugs…

Oooops
What should we do?
Scenario 1: do it like real cowboys!!!
For example, N13 - OOP Library
•
•
•
•
•
•
•
•
•
•

Mixins classes
Statics support
String namespaces
Classical inheritance
Class configuration
Constructors
Super method calls
Mixins methods calls
Dependencies manager
Other libraries compatibility
N13.define('App.View', {
extend : 'Backbone.View',
statics : {
prop: 'hello',
func: function () {
return this.prop;
}
},
configs : {cfg: 'default'},
requires: ['App.Class1'],
init
: function () {
this.callParent();
}
});

// String namespace
// Parent class

var cl = new App.View({
cfg: 'new value'
});

// Instantiates class
// Class configuration

// Static property
// Static method
// Correct this - App.Class

//
//
//
//

Сonfiguration property
Will be loaded first
Constructor function
Calls Backbone.View::init()
N13.define('Mixin', {method: function () {return ' mixed';}});
N13.define('Base', {method: function () {return ' base'; }});

N13.define('App.Class', {
extend: 'Base',
mixins: {mix: 'Mixin'},
method: function () {
return 'Hello' +
this.callMixin('mix') +
this.callParent();
}
});

//
//
//
//

App.Class is a function
Parent class
List of mixins
Overridden method

var cl = new App.Class();
cl.method();

// App.Class instantiation
// returns 'hello mixed base'

// Calls method() from Base
// Calls method() from Mixin
Looks great!!!
Butt!
OOP Library is 1/26 part of real application
And three weeks of work
How developer thinks about himself
The reality
So, it’s possible, but it took a lot of time
Scenario 2: do it like real developers!
OOP core

V

V

V

Dependencies

V

V

V

Collections/Models/Routers/Controllers

V

V

V

Embedded Widgets

V*

V

V

Layouts

V

V

V

DOM Query

V

V

V

Error handling

X

X

X

Validators

V

V

V

REST support

V

V

V

Internalization

V

V

V

Application class

V

V

V

Session manager

X

X

X

Data management

V

V

V

Build system

V

V

X

Unit test

V

V

V
* - powerful feature
ExtJs

Dojo toolkit
Yahoo UI
backbone.JS

1 dev - $595,
20 devs - $11 185
free
free
free
So, what???!!!
With backbone, you should be true developer!
Or, you will get this…
So, how can we measure our developers?
Developers skills* at SoftServe
T
J
M
S
L
A
C

(Trainee)
(Junior)
(Mid)
(Senior)
(Lead)
(Architect)
(Chuck Norris)

=
=
=
=
=
=
=

0
1
2
3
4
5
16

* Pro adds 0.5 for every value
Project success formula
SoftServe success range

[ 0.8; ∞)

My success range
(1; ∞)
For example
Summary:
• With backbone.JS, we should invent the
wheel. It tooks a lot of time
• Frameworks are better then our “hand made”
• Skilled people - are very important
Questions?

Backbone.js and friends

Editor's Notes

  • #2 Здесь нужно рассказать о чем презентация и в чем её цель. Цель – показать, что backbone.JS является далеко не полным решением для построения средних и больших апликаций.
  • #5 Всё из вышеперечисленного есть в backbone.JS