SlideShare una empresa de Scribd logo
1 de 80
Descargar para leer sin conexión
Front-end
Modernization
FOR MORTALS
CO RY G ACK ENH EIMER @ CG ACK
About Me
Software Engineer @Healthx
jQuery Mobile Team Member
Author
“Node.js Recipes”
“Introduction to React”
Consultant
What’s Covered
Motivation for this talk
Ideal Workflows vs. Actual Workflows
Tackling Monolithic JavaScript
Modularization Ideas
Making it Backcompat
Cherry-picking some new frameworks
Maintaining your sanity application
Motivation
FOR THIS TALK
The Front-end
Landscape
The Front-end
Landscape
IS CRAZY
Language Choices
Ye olde JavaScript
Ye Next JavaScript (ES6 and beyond)
TypeScript
CoffeeScript
Dart
OtherScript
MyNewScript
…
Framework Choices
jQuery
Backbone
Knockout
Angular
Ember
React
CanJS
???
Others (sorry if I left your favorite off the list, not intended)
How do choose?
Blog posts
Conference Talks
Video tutorials
Try it yourself
Your friend/colleague recommended
Framework X is most popular so it is best
ANY OF THESE COULD BE VALID FOR YOU
But…
… reality sets in
The codebase is not primed to accept
◦ bower
◦ browserify
◦ AMD modules
◦ Grunt Tasks, Gulp Tasks, Brocolli.
◦ …
It definitely doesn’t support
◦ A full rewrite of all the things
◦ A fully single-page framework
◦ An entirely new workflow
Workflow
Divergence
OR HOW TO ANGER YOUR ENTIRE TEAM
Workflow.current
Its been tested
◦ The team has been doing it for years
◦ The company is making money doing X for so long
◦ The developers understand it and have bought in
◦ Changing things wholesale will take some adjustment
Workflow.next
You can either
A) Adopt wholesale the processes of someone you
◦ Have seen talk
◦ Read a blog about
◦ Uses Framework X
B) Accept that you cannot change everything
◦ allow your process to evolve naturally
◦ adopting new or more modernized processes incrementally
◦ Make modernization an extension of your current work, not a replacement
Breaking Up
A MONOLITH
What is a Monolith?
It can be anything that hinders the maintainability and stability of your
front-end code
- A single file for all logic (note: concatenated files on production don’t
count)
- jQuery bits thrown about on inlined script tags served separately from
each server load
How to break it up?
Download React and everything will just work!
How to break it up?
… actually, It can be done in some simple, or at least manageable, steps.
Modularization
STEP ZERO
Take Inventory
Do you need these to coexist
◦ API Wrapper
◦ Validation Calls
◦ Date Parsing
◦ Animation/UI hacks
Split it out
First step is to
Split those into manageable chunks for development
MyBigApp.validations.js
MyBigApp.api.js
MyBigApp.uihacks.js
Next Step
Take what you have and concatenate and minimize them
Myapp.validations.js + Myapp.api.js + Myapp.uihacks.js =>
Myapp.min.js
This is enough
TO MAKE A MEASURABLE DIFFERENCE
How?
First!
◦ Your code is immediately more manageable
◦ Your code is immediately more maintainable
Second
◦ Your code is minimized on the client
I ALREADY KNOW THIS AND DO THIS
Modularization
STEP ONE
Step One
Concatenation and Minimization may not be enough
Next
◦ Modularize better
◦ Do not include all the code all the time
◦ Load modules when needed
Step One
You already have your code broken apart
◦ Main.js, validations.js, uihacks.js, etc.js
Make these load only when needed.
There are a ton of ways to do this… I’ll show you a few
Leverage jQuery
jQuery’s extend method can allow you to merge objects easily
Use AMD Modules
Require.js is pretty great
Using ES6
Using babel.io (or whatever) - https://babeljs.io/
Or any number of others…
TypeScript modules
Browserify – http://browserify.org/
webpack - http://webpack.github.io/
… etc.
Just one example - Browserify
Using browserify you can utilize CommonJS modules ->
require(“module”) like you see in Node.js
Browserify creates the require function so you can easily implement this
in the browser. You can run:
$ browerify myDevFile.js -o bundle.js
To get the output you want, or use a tool like watchify to watch a file ||
directory for changes and automatically create your bundle file.
So you can write your code like the following slide and use it in the
browser
Webpack
Similar to browserify, but can also do AMD modules along with
CommonJS modules
Pick your flavor and enjoy!
Change
Everything
YOU HAVE NOW OPTIMIZED THE MONOLITH AND
DECIDE TO CHANGE IT ALL
Revisit and Refactor
Modernize stale methods
Revisit helpers, validators, etc that might not be needed any more
Remove that old IE6, Opera (pre-Blink), and other hacks
… But what happens when you know there are likely places in the code
that are dependent on old hacks, functions, or objects
…
backcompat
GRACEFUL DEPRECATION
Deprecation Ideas
First
◦ Keep deprecated code around for a release or two (or six)
◦ Educate your team about deprecation
◦ Educate your users about deprecation
◦ Give alternatives
Log
At least use console.log() console.warn() during dev
Log using ajax
Log using google analytics custom variables
Log using some other method
Convert date string
Convert date string
Convert date string
What happens in some browsers when the dateStr === “2015-05-14”?
Convert date string
IRL we fix this
But what if we relied on this method somewhere or we are a third-party
library where we have a set of users that rely on it. We might not be
able to make a breaking change
So we make a new method
Backcompat
First we need to log that the old function was called
◦ Log via ajax, or analytics
◦ Add a console warning for teammates
Then we can call the new method or in this case .apply() the new
method
Framework
integration
Try It Out
Side Projects
Freelance Gigs
Hack time (if you get any)
Try It Out
You may not get the chance to try full-fledged apps, but at least go
through the basic trivial solutions before you settle on one for
production
This lets you get a taste of how the development flow works with the
different frameworks
A tale of three apps
One freelance gig building a new service
◦ Owner wanted a new front-end for solution X
◦ Thought “Knockout or whatever fits best”
◦ I built first prototypes with the existing jQuery, then Angular, and React
Find the Fit
This is where it gets difficult
It is easy to think X framework is better than Y because it has factor Z
If you honestly build a prototype with N number of frameworks, you will
find the one that
◦ Fits best with your current solution
◦ Or… will be easy enough to build from scratch
◦ Or… will be able to be used for new development and integrate with the old
Example Time
SIMPLE USER SELECT IN $, ANGULAR, AND REACT
Once You Choose
Evangelize to other developers on your team
Integrate with modern tools (more on that in a sec)
Be happy o/
Bottom Line
THERE REALLY ISN’T A WRONG ANSWER FOR THE
FRAMEWORK YOU CHOOSE AS LONG AS YOU MAKE
AN INFORMED DECISION
More Important
THAN PICKING A NEW FRAMEWORK, OR ANYTHING
ELSE REALLY
TOOLS
NOTHING HAS TO BE TOO FANCY…
Testing
PLEASE ADD AT LEAST ONE VALUABLE TEST
Lint
SERIOUSLY
Consistent Code
Style
ONE SHOULD NOT BE ABLE TO TELL WHO WROTE
WHAT CODE
Performance
testing
PERFORMANCE IS NOT A NICE-TO-HAVE FEATURE
Build tools
CONCATENATE AND MINIFY PLEASE
Thank You
QUESTIONS?

Más contenido relacionado

La actualidad más candente

professional core java trainer
professional core java trainerprofessional core java trainer
professional core java trainervibrantuser
 
Test your Javascript! v1.1
Test your Javascript! v1.1Test your Javascript! v1.1
Test your Javascript! v1.1Eric Wendelin
 
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MBNodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MBDavid Wesst
 
Everyones invited! Meet accesibility requirements with ColdFusion
Everyones invited! Meet accesibility requirements with ColdFusionEveryones invited! Meet accesibility requirements with ColdFusion
Everyones invited! Meet accesibility requirements with ColdFusionColdFusionConference
 
Node.JS error handling best practices
Node.JS error handling best practicesNode.JS error handling best practices
Node.JS error handling best practicesYoni Goldberg
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptTroy Miles
 
Nightwatch JS for End to End Tests
Nightwatch JS for End to End TestsNightwatch JS for End to End Tests
Nightwatch JS for End to End TestsSriram Angajala
 
Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiJared Faris
 
Testing nightwatch, by David Torroija
Testing nightwatch, by David TorroijaTesting nightwatch, by David Torroija
Testing nightwatch, by David TorroijaDavid Torroija
 
From zero to hero with React Native!
From zero to hero with React Native!From zero to hero with React Native!
From zero to hero with React Native!Commit University
 
React JS Belgium Touch Base - React, Flux, React Native
React JS Belgium Touch Base - React, Flux, React NativeReact JS Belgium Touch Base - React, Flux, React Native
React JS Belgium Touch Base - React, Flux, React NativePhilos.io
 
(Js) Export your own WebGL Viewer
(Js) Export your own WebGL Viewer(Js) Export your own WebGL Viewer
(Js) Export your own WebGL ViewerJooinK
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAlan Richardson
 
JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016Hendrik Ebbers
 
A Closer Look At React Native
A Closer Look At React NativeA Closer Look At React Native
A Closer Look At React NativeIan Wang
 
Taking Your GWT App to Tablets with GXT 4.0
Taking Your GWT App to Tablets with GXT 4.0Taking Your GWT App to Tablets with GXT 4.0
Taking Your GWT App to Tablets with GXT 4.0David Chandler
 

La actualidad más candente (19)

professional core java trainer
professional core java trainerprofessional core java trainer
professional core java trainer
 
Test your Javascript! v1.1
Test your Javascript! v1.1Test your Javascript! v1.1
Test your Javascript! v1.1
 
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MBNodeJS for Novices - 28/Oct/13 - Winnipeg, MB
NodeJS for Novices - 28/Oct/13 - Winnipeg, MB
 
Everyones invited! Meet accesibility requirements with ColdFusion
Everyones invited! Meet accesibility requirements with ColdFusionEveryones invited! Meet accesibility requirements with ColdFusion
Everyones invited! Meet accesibility requirements with ColdFusion
 
Node.JS error handling best practices
Node.JS error handling best practicesNode.JS error handling best practices
Node.JS error handling best practices
 
Enterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScriptEnterprise Strength Mobile JavaScript
Enterprise Strength Mobile JavaScript
 
Nightwatch JS for End to End Tests
Nightwatch JS for End to End TestsNightwatch JS for End to End Tests
Nightwatch JS for End to End Tests
 
Building Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript SpaghettiBuilding Rich User Experiences Without JavaScript Spaghetti
Building Rich User Experiences Without JavaScript Spaghetti
 
Testing nightwatch, by David Torroija
Testing nightwatch, by David TorroijaTesting nightwatch, by David Torroija
Testing nightwatch, by David Torroija
 
From zero to hero with React Native!
From zero to hero with React Native!From zero to hero with React Native!
From zero to hero with React Native!
 
React JS Belgium Touch Base - React, Flux, React Native
React JS Belgium Touch Base - React, Flux, React NativeReact JS Belgium Touch Base - React, Flux, React Native
React JS Belgium Touch Base - React, Flux, React Native
 
Introduction of React.js
Introduction of React.jsIntroduction of React.js
Introduction of React.js
 
React Django Presentation
React Django PresentationReact Django Presentation
React Django Presentation
 
(Js) Export your own WebGL Viewer
(Js) Export your own WebGL Viewer(Js) Export your own WebGL Viewer
(Js) Export your own WebGL Viewer
 
Automation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and BeyondAutomation Abstraction Layers: Page Objects and Beyond
Automation Abstraction Layers: Page Objects and Beyond
 
FreshAir2008
FreshAir2008FreshAir2008
FreshAir2008
 
JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016JavaFX JumpStart @JavaOne 2016
JavaFX JumpStart @JavaOne 2016
 
A Closer Look At React Native
A Closer Look At React NativeA Closer Look At React Native
A Closer Look At React Native
 
Taking Your GWT App to Tablets with GXT 4.0
Taking Your GWT App to Tablets with GXT 4.0Taking Your GWT App to Tablets with GXT 4.0
Taking Your GWT App to Tablets with GXT 4.0
 

Similar a Front-End Modernization for Mortals

Selecting the Best Javascript Web Framework
Selecting the Best Javascript Web FrameworkSelecting the Best Javascript Web Framework
Selecting the Best Javascript Web FrameworkRajitha Pathiraja
 
Improving Drupal Performances
Improving Drupal PerformancesImproving Drupal Performances
Improving Drupal PerformancesVladimir Ilic
 
Pain Driven Development by Alexandr Sugak
Pain Driven Development by Alexandr SugakPain Driven Development by Alexandr Sugak
Pain Driven Development by Alexandr SugakSigma Software
 
Workshop - The Little Pattern That Could.pdf
Workshop - The Little Pattern That Could.pdfWorkshop - The Little Pattern That Could.pdf
Workshop - The Little Pattern That Could.pdfTobiasGoeschel
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistMark Fayngersh
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumLiraz Shay
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure rupeshchanchal
 
Node.js meetup 17.05.2017 ember.js - escape the javascript fatigue
Node.js meetup 17.05.2017   ember.js - escape the javascript fatigueNode.js meetup 17.05.2017   ember.js - escape the javascript fatigue
Node.js meetup 17.05.2017 ember.js - escape the javascript fatigueTobias Braner
 
The Perfect Neos Project Setup
The Perfect Neos Project SetupThe Perfect Neos Project Setup
The Perfect Neos Project SetupKarsten Dambekalns
 
Lunch and learn as3_frameworks
Lunch and learn as3_frameworksLunch and learn as3_frameworks
Lunch and learn as3_frameworksYuri Visser
 
Ajax Performance
Ajax PerformanceAjax Performance
Ajax Performancekaven yan
 
Moving Large Apps to React - NYC JS
Moving Large Apps to React - NYC JSMoving Large Apps to React - NYC JS
Moving Large Apps to React - NYC JSstan229
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day trainingTroy Miles
 
Recipe of a rockstar developer
Recipe of a rockstar developerRecipe of a rockstar developer
Recipe of a rockstar developerTopu Newaj
 
Create first android app with MVVM Architecture
Create first android app with MVVM ArchitectureCreate first android app with MVVM Architecture
Create first android app with MVVM Architecturekhushbu thakker
 
Ci tips and_tricks_linards_liepins
Ci tips and_tricks_linards_liepinsCi tips and_tricks_linards_liepins
Ci tips and_tricks_linards_liepinsLinards Liep
 
Web Test Automation Framework - IndicThreads Conference
Web Test Automation Framework  - IndicThreads ConferenceWeb Test Automation Framework  - IndicThreads Conference
Web Test Automation Framework - IndicThreads ConferenceIndicThreads
 

Similar a Front-End Modernization for Mortals (20)

Selecting the Best Javascript Web Framework
Selecting the Best Javascript Web FrameworkSelecting the Best Javascript Web Framework
Selecting the Best Javascript Web Framework
 
Improving Drupal Performances
Improving Drupal PerformancesImproving Drupal Performances
Improving Drupal Performances
 
Pain Driven Development by Alexandr Sugak
Pain Driven Development by Alexandr SugakPain Driven Development by Alexandr Sugak
Pain Driven Development by Alexandr Sugak
 
Fewd week4 slides
Fewd week4 slidesFewd week4 slides
Fewd week4 slides
 
Workshop - The Little Pattern That Could.pdf
Workshop - The Little Pattern That Could.pdfWorkshop - The Little Pattern That Could.pdf
Workshop - The Little Pattern That Could.pdf
 
The State of Front-end At CrowdTwist
The State of Front-end At CrowdTwistThe State of Front-end At CrowdTwist
The State of Front-end At CrowdTwist
 
BDD with SpecFlow and Selenium
BDD with SpecFlow and SeleniumBDD with SpecFlow and Selenium
BDD with SpecFlow and Selenium
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure
 
Usable Software Design
Usable Software DesignUsable Software Design
Usable Software Design
 
Node.js meetup 17.05.2017 ember.js - escape the javascript fatigue
Node.js meetup 17.05.2017   ember.js - escape the javascript fatigueNode.js meetup 17.05.2017   ember.js - escape the javascript fatigue
Node.js meetup 17.05.2017 ember.js - escape the javascript fatigue
 
The Perfect Neos Project Setup
The Perfect Neos Project SetupThe Perfect Neos Project Setup
The Perfect Neos Project Setup
 
Lunch and learn as3_frameworks
Lunch and learn as3_frameworksLunch and learn as3_frameworks
Lunch and learn as3_frameworks
 
Ajax Performance
Ajax PerformanceAjax Performance
Ajax Performance
 
Moving Large Apps to React - NYC JS
Moving Large Apps to React - NYC JSMoving Large Apps to React - NYC JS
Moving Large Apps to React - NYC JS
 
Agile
AgileAgile
Agile
 
Ionic framework one day training
Ionic framework one day trainingIonic framework one day training
Ionic framework one day training
 
Recipe of a rockstar developer
Recipe of a rockstar developerRecipe of a rockstar developer
Recipe of a rockstar developer
 
Create first android app with MVVM Architecture
Create first android app with MVVM ArchitectureCreate first android app with MVVM Architecture
Create first android app with MVVM Architecture
 
Ci tips and_tricks_linards_liepins
Ci tips and_tricks_linards_liepinsCi tips and_tricks_linards_liepins
Ci tips and_tricks_linards_liepins
 
Web Test Automation Framework - IndicThreads Conference
Web Test Automation Framework  - IndicThreads ConferenceWeb Test Automation Framework  - IndicThreads Conference
Web Test Automation Framework - IndicThreads Conference
 

Último

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 pastPapp Krisztián
 
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 SimplicityWSO2
 
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...Bert Jan Schrijver
 
%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 midrandmasabamasaba
 
%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 tembisamasabamasaba
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...Health
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...masabamasaba
 
%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 masabamasaba
 
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...WSO2
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...SelfMade bd
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...masabamasaba
 
%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 Stilfonteinmasabamasaba
 
WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...Jittipong Loespradit
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 

Último (20)

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 - 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
 
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...
 
%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
 
%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
 
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
+971565801893>>SAFE AND ORIGINAL ABORTION PILLS FOR SALE IN DUBAI AND ABUDHAB...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
%+27788225528 love spells in Atlanta Psychic Readings, Attraction spells,Brin...
 
%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
 
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...
 
Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
Crypto Cloud Review - How To Earn Up To $500 Per DAY Of Bitcoin 100% On AutoP...
 
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
%+27788225528 love spells in Boston Psychic Readings, Attraction spells,Bring...
 
%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 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?WSO2CON 2024 - Does Open Source Still Matter?
WSO2CON 2024 - Does Open Source Still Matter?
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
WSO2Con2024 - From Code To Cloud: Fast Track Your Cloud Native Journey with C...
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
MarTech Trend 2024 Book : Marketing Technology Trends (2024 Edition) How Data...
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 

Front-End Modernization for Mortals

  • 1. Front-end Modernization FOR MORTALS CO RY G ACK ENH EIMER @ CG ACK
  • 2. About Me Software Engineer @Healthx jQuery Mobile Team Member Author “Node.js Recipes” “Introduction to React” Consultant
  • 3. What’s Covered Motivation for this talk Ideal Workflows vs. Actual Workflows Tackling Monolithic JavaScript Modularization Ideas Making it Backcompat Cherry-picking some new frameworks Maintaining your sanity application
  • 7. Language Choices Ye olde JavaScript Ye Next JavaScript (ES6 and beyond) TypeScript CoffeeScript Dart OtherScript MyNewScript …
  • 9. How do choose? Blog posts Conference Talks Video tutorials Try it yourself Your friend/colleague recommended Framework X is most popular so it is best ANY OF THESE COULD BE VALID FOR YOU
  • 11. … reality sets in The codebase is not primed to accept ◦ bower ◦ browserify ◦ AMD modules ◦ Grunt Tasks, Gulp Tasks, Brocolli. ◦ … It definitely doesn’t support ◦ A full rewrite of all the things ◦ A fully single-page framework ◦ An entirely new workflow
  • 12. Workflow Divergence OR HOW TO ANGER YOUR ENTIRE TEAM
  • 13. Workflow.current Its been tested ◦ The team has been doing it for years ◦ The company is making money doing X for so long ◦ The developers understand it and have bought in ◦ Changing things wholesale will take some adjustment
  • 14. Workflow.next You can either A) Adopt wholesale the processes of someone you ◦ Have seen talk ◦ Read a blog about ◦ Uses Framework X B) Accept that you cannot change everything ◦ allow your process to evolve naturally ◦ adopting new or more modernized processes incrementally ◦ Make modernization an extension of your current work, not a replacement
  • 16. What is a Monolith? It can be anything that hinders the maintainability and stability of your front-end code - A single file for all logic (note: concatenated files on production don’t count) - jQuery bits thrown about on inlined script tags served separately from each server load
  • 17. How to break it up? Download React and everything will just work!
  • 18. How to break it up? … actually, It can be done in some simple, or at least manageable, steps.
  • 20. Take Inventory Do you need these to coexist ◦ API Wrapper ◦ Validation Calls ◦ Date Parsing ◦ Animation/UI hacks
  • 21.
  • 22. Split it out First step is to Split those into manageable chunks for development MyBigApp.validations.js MyBigApp.api.js MyBigApp.uihacks.js
  • 23.
  • 24.
  • 25. Next Step Take what you have and concatenate and minimize them Myapp.validations.js + Myapp.api.js + Myapp.uihacks.js => Myapp.min.js
  • 26. This is enough TO MAKE A MEASURABLE DIFFERENCE
  • 27. How? First! ◦ Your code is immediately more manageable ◦ Your code is immediately more maintainable Second ◦ Your code is minimized on the client
  • 28. I ALREADY KNOW THIS AND DO THIS
  • 30. Step One Concatenation and Minimization may not be enough Next ◦ Modularize better ◦ Do not include all the code all the time ◦ Load modules when needed
  • 31. Step One You already have your code broken apart ◦ Main.js, validations.js, uihacks.js, etc.js Make these load only when needed. There are a ton of ways to do this… I’ll show you a few
  • 32. Leverage jQuery jQuery’s extend method can allow you to merge objects easily
  • 33.
  • 34. Use AMD Modules Require.js is pretty great
  • 35.
  • 36. Using ES6 Using babel.io (or whatever) - https://babeljs.io/
  • 37.
  • 38.
  • 39.
  • 40. Or any number of others… TypeScript modules Browserify – http://browserify.org/ webpack - http://webpack.github.io/ … etc.
  • 41. Just one example - Browserify Using browserify you can utilize CommonJS modules -> require(“module”) like you see in Node.js Browserify creates the require function so you can easily implement this in the browser. You can run: $ browerify myDevFile.js -o bundle.js To get the output you want, or use a tool like watchify to watch a file || directory for changes and automatically create your bundle file. So you can write your code like the following slide and use it in the browser
  • 42.
  • 43. Webpack Similar to browserify, but can also do AMD modules along with CommonJS modules Pick your flavor and enjoy!
  • 44. Change Everything YOU HAVE NOW OPTIMIZED THE MONOLITH AND DECIDE TO CHANGE IT ALL
  • 45. Revisit and Refactor Modernize stale methods Revisit helpers, validators, etc that might not be needed any more Remove that old IE6, Opera (pre-Blink), and other hacks … But what happens when you know there are likely places in the code that are dependent on old hacks, functions, or objects …
  • 47. Deprecation Ideas First ◦ Keep deprecated code around for a release or two (or six) ◦ Educate your team about deprecation ◦ Educate your users about deprecation ◦ Give alternatives
  • 48. Log At least use console.log() console.warn() during dev Log using ajax Log using google analytics custom variables Log using some other method
  • 51. Convert date string What happens in some browsers when the dateStr === “2015-05-14”?
  • 53. IRL we fix this But what if we relied on this method somewhere or we are a third-party library where we have a set of users that rely on it. We might not be able to make a breaking change
  • 54. So we make a new method
  • 55. Backcompat First we need to log that the old function was called ◦ Log via ajax, or analytics ◦ Add a console warning for teammates Then we can call the new method or in this case .apply() the new method
  • 56.
  • 58. Try It Out Side Projects Freelance Gigs Hack time (if you get any)
  • 59. Try It Out You may not get the chance to try full-fledged apps, but at least go through the basic trivial solutions before you settle on one for production This lets you get a taste of how the development flow works with the different frameworks
  • 60. A tale of three apps One freelance gig building a new service ◦ Owner wanted a new front-end for solution X ◦ Thought “Knockout or whatever fits best” ◦ I built first prototypes with the existing jQuery, then Angular, and React
  • 61. Find the Fit This is where it gets difficult It is easy to think X framework is better than Y because it has factor Z If you honestly build a prototype with N number of frameworks, you will find the one that ◦ Fits best with your current solution ◦ Or… will be easy enough to build from scratch ◦ Or… will be able to be used for new development and integrate with the old
  • 62. Example Time SIMPLE USER SELECT IN $, ANGULAR, AND REACT
  • 63.
  • 64.
  • 65.
  • 66.
  • 67.
  • 68. Once You Choose Evangelize to other developers on your team Integrate with modern tools (more on that in a sec) Be happy o/
  • 69. Bottom Line THERE REALLY ISN’T A WRONG ANSWER FOR THE FRAMEWORK YOU CHOOSE AS LONG AS YOU MAKE AN INFORMED DECISION
  • 70. More Important THAN PICKING A NEW FRAMEWORK, OR ANYTHING ELSE REALLY
  • 71. TOOLS NOTHING HAS TO BE TOO FANCY…
  • 72. Testing PLEASE ADD AT LEAST ONE VALUABLE TEST
  • 74. Consistent Code Style ONE SHOULD NOT BE ABLE TO TELL WHO WROTE WHAT CODE
  • 75. Performance testing PERFORMANCE IS NOT A NICE-TO-HAVE FEATURE
  • 76.
  • 77.
  • 78.