500 likes | 651 Views
Scalable JavaScript Application Architecture. SoftServe. Ability. Agility. Advantage. “May you live in interesting times.”. –Traditional Chinese Curse. “I will think about UI architecture tomorrow … maybe …”. –Unemployed Architect. we will do that. We are professionals.
E N D
Scalable JavaScript Application Architecture • SoftServe • Ability. • Agility. • Advantage.
“May you live in interesting times.” • –Traditional Chinese Curse
“I will think about UI architecture tomorrow … maybe …” • –Unemployed Architect
we will do that We are professionals
solid (Single responsibility, Open-closed, Liskov substitution, Interface segregation and Dependency inversion)
Gof design patterns Richard Helm, Erich Gamma, Ralph Johnson, and John Vlissides
GoF Patterns in JavaScript https://github.com/kbuzyk/GoF-patterns-in-JavaScript/blob/master/GoF_patterns_in_JavaScript.js
separation of concerns savvy?
N-tier architecture - MV* | mvW MVC | MCP | MVVM
layer • layer • layer Three-tier application
USER • VIEW • CONTROLLER • MODEL • application data, • business rules, • logic, • functions • manipulates • updates • sees • uses • accepts input • and converts it to • commands for • the model or view • output representation of information; • listens user's events MVC
accepts input • and converts it to • commands for • the model or view; • business rules, • logic, • functions; • contains UI business logic for the view • USER • PRESENTER • VIEW • MODEL • passes calls to • manipulates • updates • notifies • uses • sees • output representation of information • application data MVP
accepts input • and converts it to • commands for • the model or view; • business rules, • logic, • functions; • contains UI business logic for the view • USER • ADAPTER • VIEW • MODEL • passes calls to • manipulates • updates • notifies • uses • sees • output representation of information • application data MVA
USER • ADAPTER • VIEW • MODEL • ADAPTER • ADAPTER • passes calls to • manipulates • updates • notifies • uses • sees MVA
application data, • business rules, • logic, • functions • USER • MODEL • VIEW • VIEWMODEL • listens • updates • serves in • mediating • between the • view and the • model • updates • listens • output • representation • of information; • listens user's • events • uses • sees MVVM
application data, • business rules, • logic, • functions • USER • MODEL • VIEW • BINDER • listens • updates • serves in • mediating • between the • view and the • model • updates • listens • output • representation • of information; • listens user's • events • uses • sees MVB
separation of concerns again, doh?…
In software design, modularity refers to a logical partitioning of the "software design" that allows complex software to be manageable for the purpose of implementation and maintenance. The logic of partitioning may be based on related functions, implementation considerations, data links, or other criteria. Modularity as Wikipedia says
Modularity in UI
Modularity in Life
Base Library • Extension • Extension Scalable JS Application
Application Core • Base Library • Extension • Extension • Extension • Extension Scalable JS Application
Sandbox • Application Core • Base Library • Extension • Extension • Extension • Extension Scalable JS Application
Sandbox • Application Core • Base Library • Module • Module • Module • Module • Module • Extension • Extension • Extension • Extension Scalable JS Application
CONTROLLER • MODEL • VIEW • Triada (Agent) • Module Scalable JS Application
Application Core • Level 3 • Module • Level 2 • Module • Module • Module • Level 1 • Module • Module Scalable JS Application
Application Core • Level 3 • Module • Level 2 • Module • Module • Module • Level 1 • Module • Module Scalable JS Application
Sandbox • Level 3 • Module • Level 2 • Module • Module • Module • Level 1 • Module • Module Scalable JS Application
Sandbox • Level 3 • Module • Level 2 • Module • Module • Module • Level 1 • Module • Module Scalable JS Application
backbone library, not a framework
provides • Model (and Collection of models) • View • Routing • Events (can be used as ViewModel) • Else do as you wish
ember A framework for creating ambitious web
provides • Model • View • Routing • Controller • Bindings • Else do as you wish
knockout just implements Two-Way Data Binding
provides • ViewModel • Model (as simple JS Object) • View (as HTML) • Else do as you wish
kendo • Kendo UI Everything you need to build modern sites and apps with HTML5/JS
Kendo UI • provides • ViewModel • Model (as simple JS Object) • View (as HTML) • Build-in Widgets • Else do as you wish
canjs with modern features like custom tags and 2-way binding
provides • Model • View • Routing • ViewModel • Else do as you wish
extjs JavaScript framework with an MVC/MVVM architecture and modern UI widgets
provides • View • Model (as Models and Stores) • Controller • ViewModel • Routing (via Controllers) • ViewController • Build-in Widgets • Else do as you wish
angular superheroic JavaScript MVW framework
provides • View (as HTML and Directives) • Controller (witch plays role of Presenter and ViewModel) • Routing • Model (as JS object or Service) • Modularity • More interesting, huh?
pros and cons • understandability • performance • scalability • maintainability • testability • extensibility • flexibility • modifiability • reusability • understandability • … • etc.