4. Enterprise world
Enterprise service – what does it mean?
What we want to develop?
• Scalable – a new client can triple your traffic
• Secure – pen tests every day
• Stable – 24x7 - 99.99…% availability
• Flexible
• Single page applications
• Fast
• Modular
• Decoupled / Flexible
7. Decoupled architecture
Decoupled architecture: Server side
Proprietary API
API API API API
• Improved stability, availability, performance &
security, resilience
• Faster release cycles
We went from one centralized service that
does it all to a lot of small decoupled services
10. Problems / Solutions
• Code separation
Problems / Solutions
• Browser to server communication
• Tooling
• Performance & Resource management
11. Code separation - Javascript
Javascript is:
[][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]][([][(![]+[])[
+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]]
]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!
+[]+!+[]+!+[]+!+[]+!+[]+!+[]]]]+([][[]]+[])[+[[+!+[]]]]+(![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[+!+[]]]]+([][[]]+[])[+[[+[]]]]+([][(![]+[])[+[[+[]]]]+([
][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[
+[[+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[
])[+[[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]((![]+[])[+[[+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]+(!![]+[])[+[[
+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[
+[[+!+[]]]+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+[+!+[]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[
!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[+!+[]]]+[[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]]])()
http://www.jsfuck.com/
weird/strange/sad -
flexible, powerful, everywhere
• Easy to write bad code, harder to write good cod
• Requires a lot of discipline
• Tooling is in its infancy
• It is the only language that developers think they
can write code in without learning
13. Code separation
Code Separation
• Dependency management
(require.js, commonjs)
• Revealing pattern (hide those private
methods)
• MV* provider – backbone, angular, knockout
…
• Reusable components (sdk, utilities, ui
controls)• Unit tests – just do it (Qunit, …)
• Automatic Tests – across all supported
browsers
14. Tooling
• Use Build tools
Tooling – correct tool for the job
• Designed for client side not server side
Grunt, Yeoman, …
• Use code analyses tools (jshint, …)
• Use code complexity tools (plato, …)
16. Tooling
• Use Build tools
Tooling – correct tool for the job
• Designed for client side not server side
Grunt, Yeoman, …
• Monitor, monitor, monitor
• Yslow, pagespeed, gomez, …
• RUM
• Use code analyses tools (jshint, …)
• Use code complexity tools (plato, …)
17. Performance & Resource management
• Memory
• Run your code for at least 24 hours
• Chrome dev tools
• Browser specific (IE8 leaks 4K every JSONP
req)
Performance & Resource Management
• DOM Elements
• Clean up after yourself
• Render only what is visible
18. Performance & Resource management
API API APIAPIAPI API
• Number of API requests
Performance & Resource Management
• Number of requests
• Optimize images / sprites
• Concatenate files using build tools
19. Performance & Resource management
API API APIAPIAPI API
PROXY
• Make server developers work
Performance & Resource Management
• Number of API requests
• Number of requests
• Optimize images / sprites
• Concatenate files using build tools
If you can do it – does not mean you shouldA lot of HTML5 standard is to do with JSEverywhere * Tried to run server side code in the browser – Failed * Node.js – run client side code on the server
If you can do it – does not mean you shouldA lot of HTML5 standard is to do with JSEverywhere * Tried to run server side code in the browser – Failed * Node.js – run client side code on the server
Unless it is too big – then lazy load what is not immediately needed– at run time or during build
Unless it is too big – then lazy load what is not immediately needed– at run time or during build
Unless it is too big – then lazy load what is not immediately needed– at run time or during build