building advanced web ui in the enterprise world

21
Building advanced web UI in the Enterprise World Efim Dimenstein | July 2013

Upload: efim13

Post on 20-May-2015

583 views

Category:

Technology


1 download

TRANSCRIPT

Page 1: Building Advanced Web UI in The Enterprise World

Building advanced web UI in the Enterprise World

Efim Dimenstein | July 2013

Page 2: Building Advanced Web UI in The Enterprise World

Who am I?

Efim Dimenstein

Web Architect @ Liveperson

[email protected]

Page 3: Building Advanced Web UI in The Enterprise World

Agenda

• Architecture Overview

Agenda

• Building A Happy Web Application

• Stay Out Please

Page 4: Building Advanced Web UI in The Enterprise World

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

Page 5: Building Advanced Web UI in The Enterprise World

LP client-side

• Visitor scale

Liveperson client-side

• Customer scale

• 1.8b visits per month

• ~150b requests per month• Hostile environment

• 10k customers• 100k users• Friendly environment

Page 6: Building Advanced Web UI in The Enterprise World

Architecture concept

Business logicUI logicData protectionSecurity

Thin Clientrender

AppUI logicBusiness logic

API

Present+

Data Security

Past

Page 7: Building Advanced Web UI in The Enterprise World

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

Page 8: Building Advanced Web UI in The Enterprise World

Decoupled architecture

Client side

Spaghetti code

Lasagna code

Page 9: Building Advanced Web UI in The Enterprise World

Decoupled architecture

Client side

JS API

JSAPI

Module Module

1 browser1 window1 thread

Decoupled architecture – coupled deployment

Lasagna code

Spaghetti code

Page 10: Building Advanced Web UI in The Enterprise World

Problems / Solutions

• Code separation

Problems / Solutions

• Browser to server communication

• Tooling

• Performance & Resource management

Page 11: Building Advanced Web UI in The Enterprise World

Code separation - Javascript

Javascript is:

[][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[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]+(!![]+[])[+[[+!+[]]]]+(!![]+[])[+[[+[]]]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[+!+[]]]+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+[+!+[]]+([][(![]+[])[+[[+[]]]]+([][[]]+[])[+[[!+[]+!+[]+!+[]+!+[]+!+[]]]]+(![]+[])[+[[!+[]+!+[]]]]+(!![]+[])[+[[+[]]]]+(!![]+[])[+[[!+[]+!+[]+!+[]]]]+(!![]+[])[+[[+!+[]]]]]+[])[+[[+!+[]]]+[[!+[]+!+[]+!+[]+!+[]+!+[]+!+[]]]])()

http://www.jsfuck.com/

weird/strange/sad - flexible, powerful, everywhere

• Easy to write bad code, harder to write good code• Requires a lot of discipline• Tooling is in its infancy

• It is the only language that developers think theycan write code in without learning

Page 12: Building Advanced Web UI in The Enterprise World

Code separation - Javascript

IT IS HERE TO STAY

Page 13: Building Advanced Web UI in The Enterprise World

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

Page 14: Building Advanced Web UI in The Enterprise World

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, …)

Page 15: Building Advanced Web UI in The Enterprise World

Tooling

Tooling – Plato

Page 16: Building Advanced Web UI in The Enterprise World

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, …)

Page 17: Building Advanced Web UI in The Enterprise World

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

Page 18: Building Advanced Web UI in The Enterprise World

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

Page 19: Building Advanced Web UI in The Enterprise World

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

Page 20: Building Advanced Web UI in The Enterprise World

Performance & Resource management

Performance & Resource Management

• Optimize images

• Compress all output

Page 21: Building Advanced Web UI in The Enterprise World

Thank You

LivePerson is Hiring! [email protected]