SlideShare a Scribd company logo
1 of 122
Download to read offline
Modern UI
Development
With Node.js
@bittersweetryan
1990 1991
Sir Tim Berners-Lee
writes HTML, URI, and
HTTP
Worlds first web page
launched
CSS
Re
2011
e Brehm coins the
m “isomorphic”
om/isomorphic-javascript-future-web-apps/
2015
Michael Jackson says
“universal” is better
https://medium.com/@mjackson/universal-javascript-4761051b7ae9
<code>
Step	
  0
Use. Modules.
http://mattsbrickgallery.tumblr.com/post/48739663720
An IIFE is not a
module!
ES6 or CommonJS
ES6 Modules
ECMA spec
browsers will (eventually) implement
strict mode default
named exports and imports
ES6 Modules
spec had been under churn
browser support coming along slowly
transpolation can get messy
cannot conditionally load them
CommonJS
Node.js default module system
A single syntax for all the modules
conditional loading
CommonJS
No strict mode default
different syntax for browser and node
conditional loading is a double edge sword
The code you
write today is
the code that will
be copied tomorrow.
https://pixabay.com/p-26556/?no_redirect
ES6
ES2015
What is the first thing developers do
when they start coding in a new
project?
⌘+c
⌘+v
⌘+c
Babel now!
classes
ui components as classes
These aren’t even mixins!
They should be modules!
UI components are modules
<build>
The build
pipeline is the
foundation
modern UI
projects are
built on.
http://mdti.net/wp-content/uploads/2014/10/exterior-wall-crack-cropped.jpg
Your build chain is your development lifeline.
Treat it accordingly
Each step is a module.
Each module does one thing
(demo)
If you have to require more than one
plugin you might want to create another module.
Rule of thumb
Tip!
Save your globs in a separate JSON file and
require them into your build modules.
Use your build
tool to automate
mundane tasks.
http://www.companiesandmarkets.com/Content/DynamicMedia/cms-uploaded/X-20140605161048330.jpg
testing
just do it
Test as you code
Test as you code
Test before you push
Test as you code
Test before you push
Test in you CI Server
Tip!
Make testing easy and people will do it.
Easy is…
fast
automated
easy to bootstrap
having a culture of testing
Code	
  Quality
eslint
Why lint?
catch common errors
catch oops moments (console.log, debugger)
Why eslint?
Style checker
Pluggable
Future friendly: ES6, JSX
configure rules [ignore, warn, error]
csslint
Nesting
is the worst thing to happen to CSS.
You should never see this in css!
Don’t let
lint errors in your
repos.
https://odetojoandkatniss.files.wordpress.com/2013/12/gc-nope.png
How?
push hooks
http://www.sitepoint.com/introduction-git-hooks/
pre-commit
pre-push
pre-rebase
commit-msg
post-update
post-checkout
post-merge
For GIT
Add these files to your .git directory’s hooks folder
http://www.sitepoint.com/introduction-git-hooks/
pre-commit
pre-push
pre-rebase
commit-msg
post-update
post-checkout
post-merge
This is your “Nope” button
git push --no-verify
Continuously Lint & Test
Add your testing and linting
as part of the build process and in your CI tool.
Public shaming is
a great motivator.
Automate Adding Hooks
<serve>
business logic, maybe some sql
business logic, maybe some sql
php/jsp/asp/erb/etc
business logic, maybe some sql
php/jsp/asp/erb/etc
run some JS on the client
RESTful API’s
RESTful API’s
JS template on the server
RESTful API’s
JS template on the server
interactive JS on the client
There is a large cost to context switching.
Proceed with Caution!
Let node do what it’s good at, nothing more.
Don’t block
Don’t implement business logic
fire & forget, take advantage of the message queue
Make calls to async services
Compose a template
Send the response
Some things have to be
synchronous.
Keep as many of those at startup as you can.
Be aware of the “hot”
path!
Code that will run with EVERY request.
Keep your functional programming
off the hot path.
But what if?
RESTful API’s
RESTful API’s
JavaScript
Isomorphic!
Unimorphic!
Isomorual!
Universal!
Don’t let the demos fool you!
Universal JS is hard!
Calling a template with some data to
produce HTML is easy
De-hydrating data in Node and
re-hydrating client in the browser is
HARD.
Getting your data can
be really hard.
Don’t
Do
Use meta data to tell other modules what data the UI needs.
In React, statics are perfect for this.
Bind Falkor paths
Load i18n strings
Webpack &
Browserify
Eac
Node code vs Browser code
Client code is bundled, node code isn’t.
Why not run bundles in Node?
It only takes a few configuration tweaks
http://jlongster.com/Backend-Apps-with-Webpack--Part-I
0) Collect your node_modules
Not a “hot” code path
1) Add another config to webpack.config.js
Export an array
Have multiple targets
2) Tell web pack to ignore your requires for node_modules
AND your CSS
No Node node_modules
No css
$> node build/server.js
Next level
Stuff
Weback dev server & hot module
swapping.
(demo)
Last thoughts…
Start Small When Transitioning
There are lots of learnings to be had from a single page
Legacy
ServiceServiceService
Routing Layer
( /path match )
Node
Iterate on Modules
Modules don’t have to be perfect at first
learn & refactor
Keep your code clean
Don’t let bad code infect your repository.
Automate
People are lazy. They will do the easy things and
ignore the hard things.
http://webdesign.tutsplus.com/articles/a-brief-history-of-the-world-wide-
web--webdesign-8710
http://www.evolutionoftheweb.com/
http://nerds.airbnb.com/isomorphic-javascript-future-web-apps/
http://jlongster.com/Backend-Apps-with-Webpack--Part-I
References
Questions?
Thank You.
ranklam@netflix.com
ryan.anklam@gmail.com

More Related Content

What's hot

What's hot (20)

Testing of React JS app
Testing of React JS appTesting of React JS app
Testing of React JS app
 
React and redux
React and reduxReact and redux
React and redux
 
Getting started with typescript
Getting started with typescriptGetting started with typescript
Getting started with typescript
 
Learn react-js
Learn react-jsLearn react-js
Learn react-js
 
ES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern JavascriptES2015 / ES6: Basics of modern Javascript
ES2015 / ES6: Basics of modern Javascript
 
React Context API
React Context APIReact Context API
React Context API
 
Introduction to react native
Introduction to react nativeIntroduction to react native
Introduction to react native
 
Solid principles
Solid principlesSolid principles
Solid principles
 
Introduction to ReactJS
Introduction to ReactJSIntroduction to ReactJS
Introduction to ReactJS
 
Angularjs PPT
Angularjs PPTAngularjs PPT
Angularjs PPT
 
React js
React jsReact js
React js
 
3. Java Script
3. Java Script3. Java Script
3. Java Script
 
Reactjs
ReactjsReactjs
Reactjs
 
React native
React nativeReact native
React native
 
REST API and CRUD
REST API and CRUDREST API and CRUD
REST API and CRUD
 
Spring ppt
Spring pptSpring ppt
Spring ppt
 
Spring Boot and REST API
Spring Boot and REST APISpring Boot and REST API
Spring Boot and REST API
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.Introduction into ES6 JavaScript.
Introduction into ES6 JavaScript.
 
Angular interview questions
Angular interview questionsAngular interview questions
Angular interview questions
 

Similar to Modern UI Development With Node.js

SnapyX
SnapyXSnapyX
SnapyX
ekino
 
2012 04-19 theory-of_operation
2012 04-19 theory-of_operation2012 04-19 theory-of_operation
2012 04-19 theory-of_operation
bobwolff68
 

Similar to Modern UI Development With Node.js (20)

Developing Java Web Applications
Developing Java Web ApplicationsDeveloping Java Web Applications
Developing Java Web Applications
 
Monorail presentation at WebDevelopersCommunity, Feb 1, 2009
Monorail presentation at WebDevelopersCommunity, Feb 1, 2009Monorail presentation at WebDevelopersCommunity, Feb 1, 2009
Monorail presentation at WebDevelopersCommunity, Feb 1, 2009
 
Practical WebAssembly with Apex, wasmRS, and nanobus
Practical WebAssembly with Apex, wasmRS, and nanobusPractical WebAssembly with Apex, wasmRS, and nanobus
Practical WebAssembly with Apex, wasmRS, and nanobus
 
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh VariaCloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
Cloud-powered Continuous Integration and Deployment architectures - Jinesh Varia
 
Web Components: The Future of Web Development is Here
Web Components: The Future of Web Development is HereWeb Components: The Future of Web Development is Here
Web Components: The Future of Web Development is Here
 
Seven Versions of One Web Application
Seven Versions of One Web ApplicationSeven Versions of One Web Application
Seven Versions of One Web Application
 
Testing with Codeception
Testing with CodeceptionTesting with Codeception
Testing with Codeception
 
ASP.NET MVC Performance
ASP.NET MVC PerformanceASP.NET MVC Performance
ASP.NET MVC Performance
 
Web開発の技術選び、 好き嫌いでやってませんか 〜技術選びで注目すべきポイントとは〜
Web開発の技術選び、 好き嫌いでやってませんか  〜技術選びで注目すべきポイントとは〜Web開発の技術選び、 好き嫌いでやってませんか  〜技術選びで注目すべきポイントとは〜
Web開発の技術選び、 好き嫌いでやってませんか 〜技術選びで注目すべきポイントとは〜
 
SnapyX
SnapyXSnapyX
SnapyX
 
SnapyX - ParisJS
SnapyX - ParisJSSnapyX - ParisJS
SnapyX - ParisJS
 
End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013End-to-end HTML5 APIs - The Geek Gathering 2013
End-to-end HTML5 APIs - The Geek Gathering 2013
 
2012 04-19 theory-of_operation
2012 04-19 theory-of_operation2012 04-19 theory-of_operation
2012 04-19 theory-of_operation
 
Shifting Gears
Shifting GearsShifting Gears
Shifting Gears
 
Coding the UI
Coding the UICoding the UI
Coding the UI
 
Coding Ui
Coding UiCoding Ui
Coding Ui
 
Welcome to IE8 - Integrating Your Site With Internet Explorer 8
Welcome to IE8 - Integrating Your Site With Internet Explorer 8Welcome to IE8 - Integrating Your Site With Internet Explorer 8
Welcome to IE8 - Integrating Your Site With Internet Explorer 8
 
Node.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel AvivNode.js meetup at Palo Alto Networks Tel Aviv
Node.js meetup at Palo Alto Networks Tel Aviv
 
Past, present, and future of web assembly - Devfest Nantes 2017
Past, present, and future of web assembly - Devfest Nantes 2017Past, present, and future of web assembly - Devfest Nantes 2017
Past, present, and future of web assembly - Devfest Nantes 2017
 
Jquery
JqueryJquery
Jquery
 

Recently uploaded

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
masabamasaba
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Medical / Health Care (+971588192166) Mifepristone and Misoprostol tablets 200mg
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
chiefasafspells
 

Recently uploaded (20)

%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
%+27788225528 love spells in Colorado Springs Psychic Readings, Attraction sp...
 
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With SimplicityWSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
WSO2Con2024 - Enabling Transactional System's Exponential Growth With Simplicity
 
Artyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptxArtyushina_Guest lecture_YorkU CS May 2024.pptx
Artyushina_Guest lecture_YorkU CS May 2024.pptx
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Architecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the pastArchitecture decision records - How not to get lost in the past
Architecture decision records - How not to get lost in the past
 
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital TransformationWSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
WSO2Con2024 - WSO2's IAM Vision: Identity-Led Digital Transformation
 
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
Abortion Pills In Pretoria ](+27832195400*)[ 🏥 Women's Abortion Clinic In Pre...
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
tonesoftg
tonesoftgtonesoftg
tonesoftg
 
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
WSO2CON 2024 - API Management Usage at La Poste and Its Impact on Business an...
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
WSO2CON 2024 - WSO2's Digital Transformation Journey with Choreo: A Platforml...
 
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
WSO2CON 2024 - Building the API First Enterprise – Running an API Program, fr...
 
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
%in Hazyview+277-882-255-28 abortion pills for sale in Hazyview
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
WSO2CON 2024 - Cloud Native Middleware: Domain-Driven Design, Cell-Based Arch...
 
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
Love witchcraft +27768521739 Binding love spell in Sandy Springs, GA |psychic...
 
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
Devoxx UK 2024 - Going serverless with Quarkus, GraalVM native images and AWS...
 

Modern UI Development With Node.js