Академический Документы
Профессиональный Документы
Культура Документы
A better Framework
Fahim Farook
Defining ‘Modularity’
A case study - Gmail
Agenda Client-side solution – a Framework
Demo
Defining ‘Modularity’
A case study - Gmail
Agenda Client-side solution – a Framework
Demo
Modules are Highly cohesive
and Loosely coupled ‘units’
Reduced complexity
Increased
maintainability
Increased reusability
Keywords
• DOTADIW
• Single Responsibility
• Focused
• High Cohesion
• Low Coupling
• Divide and Conquer
• Simple/ Not-complex
• Reusable
• Maintainable
• Self contained
• Easy Navigation
How about JavaScript?
With IIFE AMD
What about ‘Modular UI’ then?
Defining ‘Modularity’
A case study - Gmail
Agenda Client-side solution – a Framework
Demo
Header
Folders
Mail List
Chat
Solution Structure
Issue 1 – No separation of technology concerns
Solution 1 – Let’s separate the technology concerns
Issue 2 – Single JSP to rule them all
Solution 2 – Tiles to rescue
Let’s revisit the web contents
Issue 3 – Long JavaScript files (& functions)
Not coherent
Violates SRP
Not reusable
High complexity
Issue 4 – Tight coupling
High complexity
Issue 5 – Polluted DOM
That.js Main.js
Issue 6 – Vendor Lock
$(‘.element’).function();
$(‘.element’).function();
Tight coupling with libraries
$(‘.element’).function();
$(‘.element’).function();
Moving from jQuery to dojo is
$(‘.element’).function();
$(‘.element’).function();
nearly impossible
$(‘.element’).function();
$(‘.element’).function();
$(‘.element’).function();
Main.js
Solution 3, 4, 5, 6
Let’s build a Framework
Back to Tiles
Issue 7 – Server side view technology (JSP)
Java + HTML
Requires compilation
• Safe DOM
Header Header
DOM Gateway
Header
Modules are not allowed to access the DOM outside it’s ‘domain’
No Module Coupling
Module 1 Facade
PUBLISH X
Not allowed
SUBSCRIBE X
Module 2 Facade Kernel
Module 3 Facade
SUBSCRIBE X
Module
• Scaffolding
• Widgets