SlideShare uma empresa Scribd logo
1 de 39
Refactoring to a
Single Page Application
Marcello Teodori
ROME 18-19 MARCH 2016
Agenda
● a few definitions
● my experience in Workshare
● some take aways
● current state and future
● what’s your experience?
Your traditional web application built
on server side technology, whether
MVC or component based...
A definition for a “Multi Page Application”
“A single-page application (SPA) is a web application or
web site that fits on a single web page with the goal of
providing a more fluent user experience similar to a
desktop application.
In a SPA, either all necessary code – HTML, JavaScript,
and CSS – is retrieved with a single page load.”
Single Page Application on WikiPedia
“Code refactoring is the process of
restructuring existing computer code –
changing the factoring – without changing
its external behavior.
Refactoring improves nonfunctional
attributes of the software.”
(Code) Refactoring on WikiPedia
A refactoring tale: Workshare
1999
Workshare
Doc Comparison and
Metadata Cleaning
Desktop Products
Apr 2012
SkyDox acquisition
Document Sharing SaaS
Ruby monolith #1
aka Cirrus
Nov 2012
IdeaPlane acquisition
Enterprise Social
Network
Java monolith
aka Social
Dec 2014
Dealroom acquisition
Legal Transaction WFE
Ruby monolith #2
aka Transact
now
Scaling
microservices on BE
SPA on FE
Cirrus
● Typical Rails
Application
● Does a Lot :)
○ including REST API!
● Does Too Much :(
● “Leverages”
ActiveRecord!
● You know the end of
the story...
Baaang!
The Masterplan!
● a spike on a SPA
○ called “supernova-ui”
○ validate we can do JavaScript
● phasing out all server side tech
producing front-end code
● migrate backend to microservices
○ Cirrus already provides JSON API
○ Social doesn’t and becomes first
microservice: Groups API
Let’s start!
Moving backend to microservices
Wally
Users Search
Groups
Social
Cards
Homepage Cards
Cirrus
Sign On
Users
Users Search
Activities
Storage
Files & Folders
Figitus
ADAPT BUILD
EXTRACT
...and embrace JavaScript!
And for the frontend
TAKE #1:
setup a front-end build
Node allows front-end developers to take control
● pick your favourite javascript build
template
○ ex. a yeoman generator
● launch a development server
○ ex. via grunt-contrib-connect
● proxy your current web app or API
○ ex. via grunt-connect-proxy
● overlay your changes
JavaScript dependency management FTW!
chimera core-ui
files-ui groups-ui dealroom-ui
new-ui
Chimera, the myth of a style guide
TAKE #2:
build a client-side
application layout
Define your main application layout, client-side
● you will need some basic API
○ user API
○ account API
● application layout
○ topbar
○ sidebar
○ user menu
○ content
● a good candidate for offline
The Workshare Application Layout
topbar
contentsidebar
user
menu
TAKE #3:
leave login where it is
Authentication is complex, you don’t want to break it!
● typical web form login
● CSRF protection
● authentication via cookie
● support auth cookie on API
● single-sign on flows
● vanity domains
TAKE #4:
integrate pages via iframe
iframe are ugly but can be useful...
● content access when on same origin
● native API to communicate
○ window.postMessage
● easy to detect
○ window === window.parent
● listen to URL/hash changes
is a backend dev available? cool!
● create a custom page format
○ (ex. nova)
● serve a naked version of your page
with just the main content
○ in Rails :layout => false
● in your url_helper modify your href to
send a message via javascript to
your parent application
isn’t a backend dev available? oh no!
● load iframe as hidden
● hide application chrome and anything
which is not your main content
● patch CSS if necessary
● patch links to route on SPA
● repeat on URL/hash change
TAKE #5:
reuse your test suite
No refactoring without a proper test suite!
● Robot Framework
○ API tests
○ FE tests via WebDriver
● BDD style test definitions
● Re-use with minimal changes
○ if element selector don’t change!
○ adapt custom keywords
■ Navigate To (new URLs)
■ Locate Element (switch to iframe)
TAKE #6:
Apache (or nginx)
is your friend
● map existing URLs you want to keep
● define your strategy to serve your SPA
○ on a subcontext /new-ui
○ on the root
■ via a custom header x-new-ui=true
■ on a different server
● proxy APIs and iframe pages
○ keep same origin
○ no need for CORS headers
It’s deployment time! From Node to Apache/nginx
TAKE #7:
manage new development
Evolve existing multi page URLs to single
● inject CSS from parent window
● build views in your SPA
● instantiate in multi page
● inject in parent DOM
● it’s really hard but a temporary
workaround until APIs are
available!
Now or Never:
current state and future
3 years later and 42 microservices after...
● refactoring well is a long and
sloooow process...
● ...but we release weekly!
● the SPA approach allows iterating
much faster
● also designers with front-end skills
can easily build prototypes!
What didn’t work so well
● login pages must be fast!
● FOUC (flash of unstyled content)
● existing “SPAlets” taking full
control of the page (we had some
GWT ones) are hard to integrate
● IE9 and hash URLs
● bundle JavaScript in chunks
Disclaimer! Problems we didn’t have to solve
● it’s a web application, not a website
● URLs are forever
● SEO
○ googlebot crawls #! URLs
○ what about the others?
● browsers with JavaScript disabled
● IE less than 9
● first render speed
● should we go isomorphic?
TAKE #8:
build an amazing team!
Frontend and Backend teams working together
the Web Squad builds
the web frontend user
interface...
…but the Cirrus Squad
provides the API our
features build upon!
A Futurama Halloween!
Thanks!
ROME 18-19 MARCH 2016
contacts
marcello.teodori@gmail.com
@magomarcelo
All pictures belong
to their respective authors

Mais conteúdo relacionado

Mais procurados

10 Useful Front End Development Tools for Web Apps | 2020
10 Useful Front End Development Tools for Web Apps | 202010 Useful Front End Development Tools for Web Apps | 2020
10 Useful Front End Development Tools for Web Apps | 2020Claritus Consulting
 
Pavel Prischepa. Wodby
Pavel Prischepa. WodbyPavel Prischepa. Wodby
Pavel Prischepa. Wodbyi20 Group
 
The Saga of JavaScript and TypeScript: Part 1
The Saga of JavaScript and TypeScript: Part 1The Saga of JavaScript and TypeScript: Part 1
The Saga of JavaScript and TypeScript: Part 1Haci Murat Yaman
 
Headless Drupal: A modern approach to (micro)services and APIs
Headless Drupal: A modern approach to (micro)services and APIsHeadless Drupal: A modern approach to (micro)services and APIs
Headless Drupal: A modern approach to (micro)services and APIssparkfabrik
 
Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)Tech Triveni
 
Performance optimization of vue.js apps with modern js
Performance optimization of vue.js apps with modern jsPerformance optimization of vue.js apps with modern js
Performance optimization of vue.js apps with modern jsFilip Rakowski
 
ENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScript
ENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScriptENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScript
ENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScriptHoracio Gonzalez
 
MongoDB Jump Start
MongoDB Jump StartMongoDB Jump Start
MongoDB Jump StartHaim Michael
 
The Full Stack Web Development
The Full Stack Web DevelopmentThe Full Stack Web Development
The Full Stack Web DevelopmentSam Dias
 
PWA basics for developers
PWA basics for developersPWA basics for developers
PWA basics for developersFilip Rakowski
 
Amsterdam.js talk: node webkit
Amsterdam.js talk: node webkitAmsterdam.js talk: node webkit
Amsterdam.js talk: node webkitFabian Jakobs
 
Node.js Crash Course (Jump Start)
Node.js Crash Course (Jump Start) Node.js Crash Course (Jump Start)
Node.js Crash Course (Jump Start) Haim Michael
 
Agriya services
Agriya servicesAgriya services
Agriya servicesiScripts
 
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)Brian Culver
 
Devoxx France - Web Components, Polymer et Material Design
Devoxx France -  Web Components, Polymer et Material DesignDevoxx France -  Web Components, Polymer et Material Design
Devoxx France - Web Components, Polymer et Material DesignHoracio Gonzalez
 

Mais procurados (20)

10 Useful Front End Development Tools for Web Apps | 2020
10 Useful Front End Development Tools for Web Apps | 202010 Useful Front End Development Tools for Web Apps | 2020
10 Useful Front End Development Tools for Web Apps | 2020
 
Js frameworks
Js frameworksJs frameworks
Js frameworks
 
Pavel Prischepa. Wodby
Pavel Prischepa. WodbyPavel Prischepa. Wodby
Pavel Prischepa. Wodby
 
The Saga of JavaScript and TypeScript: Part 1
The Saga of JavaScript and TypeScript: Part 1The Saga of JavaScript and TypeScript: Part 1
The Saga of JavaScript and TypeScript: Part 1
 
Headless Drupal: A modern approach to (micro)services and APIs
Headless Drupal: A modern approach to (micro)services and APIsHeadless Drupal: A modern approach to (micro)services and APIs
Headless Drupal: A modern approach to (micro)services and APIs
 
WebMatrix
WebMatrixWebMatrix
WebMatrix
 
.Net Core
.Net Core.Net Core
.Net Core
 
React Native
React NativeReact Native
React Native
 
Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)Micro Frontends Architecture - Jitendra kumawat (Guavus)
Micro Frontends Architecture - Jitendra kumawat (Guavus)
 
Performance optimization of vue.js apps with modern js
Performance optimization of vue.js apps with modern jsPerformance optimization of vue.js apps with modern js
Performance optimization of vue.js apps with modern js
 
ENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScript
ENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScriptENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScript
ENIB 2015 2016 - CAI Web S02E03- Forge JS 1/4 - La forge JavaScript
 
MongoDB Jump Start
MongoDB Jump StartMongoDB Jump Start
MongoDB Jump Start
 
The Full Stack Web Development
The Full Stack Web DevelopmentThe Full Stack Web Development
The Full Stack Web Development
 
PWA basics for developers
PWA basics for developersPWA basics for developers
PWA basics for developers
 
Open source day in .NET
Open source day in .NETOpen source day in .NET
Open source day in .NET
 
Amsterdam.js talk: node webkit
Amsterdam.js talk: node webkitAmsterdam.js talk: node webkit
Amsterdam.js talk: node webkit
 
Node.js Crash Course (Jump Start)
Node.js Crash Course (Jump Start) Node.js Crash Course (Jump Start)
Node.js Crash Course (Jump Start)
 
Agriya services
Agriya servicesAgriya services
Agriya services
 
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
Convert your Full Trust Solutions to the SharePoint Framework (SPFx)
 
Devoxx France - Web Components, Polymer et Material Design
Devoxx France -  Web Components, Polymer et Material DesignDevoxx France -  Web Components, Polymer et Material Design
Devoxx France - Web Components, Polymer et Material Design
 

Destaque

taula de formats Marina Uguet A1
taula de formats Marina Uguet A1taula de formats Marina Uguet A1
taula de formats Marina Uguet A1Uguet
 
Compromiso por la nueva evangelizacion del mundo de hoy
Compromiso por la nueva evangelizacion del mundo de hoyCompromiso por la nueva evangelizacion del mundo de hoy
Compromiso por la nueva evangelizacion del mundo de hoy0104257746
 
Infografia Claves para construir los programas de trabajo en un SPA
Infografia Claves para construir los programas de trabajo en un SPAInfografia Claves para construir los programas de trabajo en un SPA
Infografia Claves para construir los programas de trabajo en un SPAJ. Javier Alvarez Martínez
 
Presentación en la Audiencia Pública 2009 - Desarrollo Economico
Presentación en la Audiencia Pública 2009 - Desarrollo EconomicoPresentación en la Audiencia Pública 2009 - Desarrollo Economico
Presentación en la Audiencia Pública 2009 - Desarrollo EconomicoGobierno Regional de Apurimac
 
Infografia Acuerdos de colaboracion entre SPAs (vigilancia de la salud)
Infografia Acuerdos de colaboracion entre SPAs (vigilancia de la salud)Infografia Acuerdos de colaboracion entre SPAs (vigilancia de la salud)
Infografia Acuerdos de colaboracion entre SPAs (vigilancia de la salud)J. Javier Alvarez Martínez
 
New Laser Brocher
New Laser BrocherNew Laser Brocher
New Laser BrocherGeorge Tank
 
Apeim nse-2003-2004-lima
Apeim nse-2003-2004-limaApeim nse-2003-2004-lima
Apeim nse-2003-2004-limazonas8
 
New american-stramline-destinations-glossary-part-a
New american-stramline-destinations-glossary-part-aNew american-stramline-destinations-glossary-part-a
New american-stramline-destinations-glossary-part-aBefriend Ever
 
Rocket piano advanced v1.2
Rocket piano advanced v1.2Rocket piano advanced v1.2
Rocket piano advanced v1.2Jenny Pham
 
Humming earthquakes incident - حادثة الطنين من الزلازل والاهتزاز وتصدع الأبن...
 Humming earthquakes incident - حادثة الطنين من الزلازل والاهتزاز وتصدع الأبن... Humming earthquakes incident - حادثة الطنين من الزلازل والاهتزاز وتصدع الأبن...
Humming earthquakes incident - حادثة الطنين من الزلازل والاهتزاز وتصدع الأبن...Dr.Youssef Hammida
 
Dual Systems Design Shear wall-Frame InterAction تصميم الجملة القصية الثنائية...
Dual Systems Design Shear wall-Frame InterAction تصميم الجملة القصية الثنائية...Dual Systems Design Shear wall-Frame InterAction تصميم الجملة القصية الثنائية...
Dual Systems Design Shear wall-Frame InterAction تصميم الجملة القصية الثنائية...Dr.Youssef Hammida
 
Taller De Circulo Magico
Taller De Circulo MagicoTaller De Circulo Magico
Taller De Circulo MagicoAlejandro Vera
 

Destaque (19)

taula de formats Marina Uguet A1
taula de formats Marina Uguet A1taula de formats Marina Uguet A1
taula de formats Marina Uguet A1
 
Compromiso por la nueva evangelizacion del mundo de hoy
Compromiso por la nueva evangelizacion del mundo de hoyCompromiso por la nueva evangelizacion del mundo de hoy
Compromiso por la nueva evangelizacion del mundo de hoy
 
API seeks LTRs
API seeks LTRsAPI seeks LTRs
API seeks LTRs
 
Clase demostrativa pancho
Clase demostrativa panchoClase demostrativa pancho
Clase demostrativa pancho
 
Fitokarantena brecl 93
Fitokarantena brecl 93Fitokarantena brecl 93
Fitokarantena brecl 93
 
Social Media in Action
Social Media in ActionSocial Media in Action
Social Media in Action
 
Infografia Claves para construir los programas de trabajo en un SPA
Infografia Claves para construir los programas de trabajo en un SPAInfografia Claves para construir los programas de trabajo en un SPA
Infografia Claves para construir los programas de trabajo en un SPA
 
Of cult... blady jeff
Of cult... blady jeffOf cult... blady jeff
Of cult... blady jeff
 
Presentación en la Audiencia Pública 2009 - Desarrollo Economico
Presentación en la Audiencia Pública 2009 - Desarrollo EconomicoPresentación en la Audiencia Pública 2009 - Desarrollo Economico
Presentación en la Audiencia Pública 2009 - Desarrollo Economico
 
Infografia Acuerdos de colaboracion entre SPAs (vigilancia de la salud)
Infografia Acuerdos de colaboracion entre SPAs (vigilancia de la salud)Infografia Acuerdos de colaboracion entre SPAs (vigilancia de la salud)
Infografia Acuerdos de colaboracion entre SPAs (vigilancia de la salud)
 
New Laser Brocher
New Laser BrocherNew Laser Brocher
New Laser Brocher
 
Apeim nse-2003-2004-lima
Apeim nse-2003-2004-limaApeim nse-2003-2004-lima
Apeim nse-2003-2004-lima
 
New american-stramline-destinations-glossary-part-a
New american-stramline-destinations-glossary-part-aNew american-stramline-destinations-glossary-part-a
New american-stramline-destinations-glossary-part-a
 
Rocket piano advanced v1.2
Rocket piano advanced v1.2Rocket piano advanced v1.2
Rocket piano advanced v1.2
 
Humming earthquakes incident - حادثة الطنين من الزلازل والاهتزاز وتصدع الأبن...
 Humming earthquakes incident - حادثة الطنين من الزلازل والاهتزاز وتصدع الأبن... Humming earthquakes incident - حادثة الطنين من الزلازل والاهتزاز وتصدع الأبن...
Humming earthquakes incident - حادثة الطنين من الزلازل والاهتزاز وتصدع الأبن...
 
Dual Systems Design Shear wall-Frame InterAction تصميم الجملة القصية الثنائية...
Dual Systems Design Shear wall-Frame InterAction تصميم الجملة القصية الثنائية...Dual Systems Design Shear wall-Frame InterAction تصميم الجملة القصية الثنائية...
Dual Systems Design Shear wall-Frame InterAction تصميم الجملة القصية الثنائية...
 
Taller De Circulo Magico
Taller De Circulo MagicoTaller De Circulo Magico
Taller De Circulo Magico
 
+654354
+654354+654354
+654354
 
Sp loc-o7-04-jesus ensenadelasactitudes
Sp loc-o7-04-jesus ensenadelasactitudesSp loc-o7-04-jesus ensenadelasactitudes
Sp loc-o7-04-jesus ensenadelasactitudes
 

Semelhante a Refactoring to a SPA

Decoupled Architecture and WordPress
Decoupled Architecture and WordPressDecoupled Architecture and WordPress
Decoupled Architecture and WordPressPantheon
 
Exploring pwa for shopware
Exploring pwa for shopwareExploring pwa for shopware
Exploring pwa for shopwareSander Mangel
 
Industrial Training.pptx
Industrial Training.pptxIndustrial Training.pptx
Industrial Training.pptxSamraatBansal1
 
Design Summit - Technology Vision - Oleg Barenboim and Jason Frey
Design Summit - Technology Vision - Oleg Barenboim and Jason FreyDesign Summit - Technology Vision - Oleg Barenboim and Jason Frey
Design Summit - Technology Vision - Oleg Barenboim and Jason FreyManageIQ
 
Sp sat philly2019
Sp sat philly2019Sp sat philly2019
Sp sat philly2019Peter_1020
 
5 Powerful Backend Frameworks for Web App Development in 2022
5 Powerful Backend Frameworks for Web App Development in 20225 Powerful Backend Frameworks for Web App Development in 2022
5 Powerful Backend Frameworks for Web App Development in 202275waytechnologies
 
WordPress as a Headless CMS - Bronson Quick
WordPress as a Headless CMS - Bronson QuickWordPress as a Headless CMS - Bronson Quick
WordPress as a Headless CMS - Bronson QuickWordCamp Sydney
 
Progressive web applications
Progressive web applicationsProgressive web applications
Progressive web applicationsTom Martin
 
Going from Classic to Modern. 10 Things you must know before you commit
Going from Classic to Modern. 10 Things you must know before you commitGoing from Classic to Modern. 10 Things you must know before you commit
Going from Classic to Modern. 10 Things you must know before you commitspsnyc
 
Spsat nyc19 190621150118
Spsat nyc19 190621150118Spsat nyc19 190621150118
Spsat nyc19 190621150118Peter_1020
 
List of Web Technologies used in Web Development
List of Web Technologies used in Web DevelopmentList of Web Technologies used in Web Development
List of Web Technologies used in Web DevelopmentJayapal Reddy Nimmakayala
 
Top Node.JS Frameworks to Look at in 2020
Top Node.JS Frameworks to Look at in 2020Top Node.JS Frameworks to Look at in 2020
Top Node.JS Frameworks to Look at in 2020Roshani Patel
 
Important Backend Frameworks To Remember For Businesses In 2023
Important Backend Frameworks To Remember For Businesses In 2023Important Backend Frameworks To Remember For Businesses In 2023
Important Backend Frameworks To Remember For Businesses In 2023Netizens Technologies
 
Angular webinar - Credo Systemz
Angular webinar - Credo SystemzAngular webinar - Credo Systemz
Angular webinar - Credo SystemzTraining Institute
 
Introduction to Web Frameworks
Introduction to Web FrameworksIntroduction to Web Frameworks
Introduction to Web FrameworksSarika Jadhav
 

Semelhante a Refactoring to a SPA (20)

APIs for mobile
APIs for mobileAPIs for mobile
APIs for mobile
 
Web summit.pptx
Web summit.pptxWeb summit.pptx
Web summit.pptx
 
Decoupled Architecture and WordPress
Decoupled Architecture and WordPressDecoupled Architecture and WordPress
Decoupled Architecture and WordPress
 
Exploring pwa for shopware
Exploring pwa for shopwareExploring pwa for shopware
Exploring pwa for shopware
 
Industrial Training.pptx
Industrial Training.pptxIndustrial Training.pptx
Industrial Training.pptx
 
Design Summit - Technology Vision - Oleg Barenboim and Jason Frey
Design Summit - Technology Vision - Oleg Barenboim and Jason FreyDesign Summit - Technology Vision - Oleg Barenboim and Jason Frey
Design Summit - Technology Vision - Oleg Barenboim and Jason Frey
 
Sp sat philly2019
Sp sat philly2019Sp sat philly2019
Sp sat philly2019
 
5 Powerful Backend Frameworks for Web App Development in 2022
5 Powerful Backend Frameworks for Web App Development in 20225 Powerful Backend Frameworks for Web App Development in 2022
5 Powerful Backend Frameworks for Web App Development in 2022
 
WordPress as a Headless CMS - Bronson Quick
WordPress as a Headless CMS - Bronson QuickWordPress as a Headless CMS - Bronson Quick
WordPress as a Headless CMS - Bronson Quick
 
Progressive web applications
Progressive web applicationsProgressive web applications
Progressive web applications
 
Going from Classic to Modern. 10 Things you must know before you commit
Going from Classic to Modern. 10 Things you must know before you commitGoing from Classic to Modern. 10 Things you must know before you commit
Going from Classic to Modern. 10 Things you must know before you commit
 
Spsat nyc19 190621150118
Spsat nyc19 190621150118Spsat nyc19 190621150118
Spsat nyc19 190621150118
 
List of Web Technologies used in Web Development
List of Web Technologies used in Web DevelopmentList of Web Technologies used in Web Development
List of Web Technologies used in Web Development
 
Always on! ... or not?
Always on! ... or not?Always on! ... or not?
Always on! ... or not?
 
Top Node.JS Frameworks to Look at in 2020
Top Node.JS Frameworks to Look at in 2020Top Node.JS Frameworks to Look at in 2020
Top Node.JS Frameworks to Look at in 2020
 
Important Backend Frameworks To Remember For Businesses In 2023
Important Backend Frameworks To Remember For Businesses In 2023Important Backend Frameworks To Remember For Businesses In 2023
Important Backend Frameworks To Remember For Businesses In 2023
 
Angular webinar - Credo Systemz
Angular webinar - Credo SystemzAngular webinar - Credo Systemz
Angular webinar - Credo Systemz
 
Introduction to Web Frameworks
Introduction to Web FrameworksIntroduction to Web Frameworks
Introduction to Web Frameworks
 
AFTAB AHMED.pptx
AFTAB AHMED.pptxAFTAB AHMED.pptx
AFTAB AHMED.pptx
 
Webdevelopment
WebdevelopmentWebdevelopment
Webdevelopment
 

Mais de Marcello Teodori

Anatomy of an APS 2 appication
Anatomy of an APS 2 appicationAnatomy of an APS 2 appication
Anatomy of an APS 2 appicationMarcello Teodori
 
Wicket from Designer to Developer
Wicket from Designer to DeveloperWicket from Designer to Developer
Wicket from Designer to DeveloperMarcello Teodori
 
m2eclipse: integrazione maven2 in eclipse IDE
m2eclipse: integrazione maven2 in eclipse IDEm2eclipse: integrazione maven2 in eclipse IDE
m2eclipse: integrazione maven2 in eclipse IDEMarcello Teodori
 
JBoss Seam, un framework per Java EE 5
JBoss Seam, un framework per Java EE 5JBoss Seam, un framework per Java EE 5
JBoss Seam, un framework per Java EE 5Marcello Teodori
 
Struttin' on, novità in casa Struts
Struttin' on, novità in casa StrutsStruttin' on, novità in casa Struts
Struttin' on, novità in casa StrutsMarcello Teodori
 
Sviluppare su OpenOffice.org con Java
Sviluppare su OpenOffice.org con JavaSviluppare su OpenOffice.org con Java
Sviluppare su OpenOffice.org con JavaMarcello Teodori
 
Un backend per tutte le stagioni con Spring
Un backend per tutte le stagioni con SpringUn backend per tutte le stagioni con Spring
Un backend per tutte le stagioni con SpringMarcello Teodori
 
Streaming in Java e Flex con Red5
Streaming in Java e Flex con Red5Streaming in Java e Flex con Red5
Streaming in Java e Flex con Red5Marcello Teodori
 

Mais de Marcello Teodori (13)

Anatomy of an APS 2 appication
Anatomy of an APS 2 appicationAnatomy of an APS 2 appication
Anatomy of an APS 2 appication
 
Wicket from Designer to Developer
Wicket from Designer to DeveloperWicket from Designer to Developer
Wicket from Designer to Developer
 
Software Factory in a Box
Software Factory in a BoxSoftware Factory in a Box
Software Factory in a Box
 
Groovy & Grails
Groovy & GrailsGroovy & Grails
Groovy & Grails
 
m2eclipse: integrazione maven2 in eclipse IDE
m2eclipse: integrazione maven2 in eclipse IDEm2eclipse: integrazione maven2 in eclipse IDE
m2eclipse: integrazione maven2 in eclipse IDE
 
JBoss Seam, un framework per Java EE 5
JBoss Seam, un framework per Java EE 5JBoss Seam, un framework per Java EE 5
JBoss Seam, un framework per Java EE 5
 
Rich Internet Application
Rich Internet ApplicationRich Internet Application
Rich Internet Application
 
Struttin' on, novità in casa Struts
Struttin' on, novità in casa StrutsStruttin' on, novità in casa Struts
Struttin' on, novità in casa Struts
 
Java sul tuo Mac
Java sul tuo MacJava sul tuo Mac
Java sul tuo Mac
 
Sviluppare su OpenOffice.org con Java
Sviluppare su OpenOffice.org con JavaSviluppare su OpenOffice.org con Java
Sviluppare su OpenOffice.org con Java
 
Un backend per tutte le stagioni con Spring
Un backend per tutte le stagioni con SpringUn backend per tutte le stagioni con Spring
Un backend per tutte le stagioni con Spring
 
Streaming in Java e Flex con Red5
Streaming in Java e Flex con Red5Streaming in Java e Flex con Red5
Streaming in Java e Flex con Red5
 
Spring e Flex
Spring e FlexSpring e Flex
Spring e Flex
 

Último

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonetsnaman860154
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdfChristopherTHyatt
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityPrincipled Technologies
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfEnterprise Knowledge
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationRadu Cotescu
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Servicegiselly40
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking MenDelhi Call girls
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?Antenna Manufacturer Coco
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Enterprise Knowledge
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsMaria Levchenko
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024The Digital Insurer
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024The Digital Insurer
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsEnterprise Knowledge
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 

Último (20)

How to convert PDF to text with Nanonets
How to convert PDF to text with NanonetsHow to convert PDF to text with Nanonets
How to convert PDF to text with Nanonets
 
Evaluating the top large language models.pdf
Evaluating the top large language models.pdfEvaluating the top large language models.pdf
Evaluating the top large language models.pdf
 
Boost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivityBoost PC performance: How more available memory can improve productivity
Boost PC performance: How more available memory can improve productivity
 
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdfThe Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
The Role of Taxonomy and Ontology in Semantic Layers - Heather Hedden.pdf
 
Scaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organizationScaling API-first – The story of a global engineering organization
Scaling API-first – The story of a global engineering organization
 
CNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of ServiceCNv6 Instructor Chapter 6 Quality of Service
CNv6 Instructor Chapter 6 Quality of Service
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men08448380779 Call Girls In Civil Lines Women Seeking Men
08448380779 Call Girls In Civil Lines Women Seeking Men
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?What Are The Drone Anti-jamming Systems Technology?
What Are The Drone Anti-jamming Systems Technology?
 
Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...Driving Behavioral Change for Information Management through Data-Driven Gree...
Driving Behavioral Change for Information Management through Data-Driven Gree...
 
Handwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed textsHandwritten Text Recognition for manuscripts and early printed texts
Handwritten Text Recognition for manuscripts and early printed texts
 
Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
Bajaj Allianz Life Insurance Company - Insurer Innovation Award 2024
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
IAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI SolutionsIAC 2024 - IA Fast Track to Search Focused AI Solutions
IAC 2024 - IA Fast Track to Search Focused AI Solutions
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 

Refactoring to a SPA

  • 1. Refactoring to a Single Page Application Marcello Teodori ROME 18-19 MARCH 2016
  • 2. Agenda ● a few definitions ● my experience in Workshare ● some take aways ● current state and future ● what’s your experience?
  • 3. Your traditional web application built on server side technology, whether MVC or component based... A definition for a “Multi Page Application”
  • 4. “A single-page application (SPA) is a web application or web site that fits on a single web page with the goal of providing a more fluent user experience similar to a desktop application. In a SPA, either all necessary code – HTML, JavaScript, and CSS – is retrieved with a single page load.” Single Page Application on WikiPedia
  • 5. “Code refactoring is the process of restructuring existing computer code – changing the factoring – without changing its external behavior. Refactoring improves nonfunctional attributes of the software.” (Code) Refactoring on WikiPedia
  • 6. A refactoring tale: Workshare 1999 Workshare Doc Comparison and Metadata Cleaning Desktop Products Apr 2012 SkyDox acquisition Document Sharing SaaS Ruby monolith #1 aka Cirrus Nov 2012 IdeaPlane acquisition Enterprise Social Network Java monolith aka Social Dec 2014 Dealroom acquisition Legal Transaction WFE Ruby monolith #2 aka Transact now Scaling microservices on BE SPA on FE
  • 7. Cirrus ● Typical Rails Application ● Does a Lot :) ○ including REST API! ● Does Too Much :( ● “Leverages” ActiveRecord! ● You know the end of the story...
  • 9. The Masterplan! ● a spike on a SPA ○ called “supernova-ui” ○ validate we can do JavaScript ● phasing out all server side tech producing front-end code ● migrate backend to microservices ○ Cirrus already provides JSON API ○ Social doesn’t and becomes first microservice: Groups API
  • 11. Moving backend to microservices Wally Users Search Groups Social Cards Homepage Cards Cirrus Sign On Users Users Search Activities Storage Files & Folders Figitus ADAPT BUILD EXTRACT
  • 12. ...and embrace JavaScript! And for the frontend
  • 13. TAKE #1: setup a front-end build
  • 14. Node allows front-end developers to take control ● pick your favourite javascript build template ○ ex. a yeoman generator ● launch a development server ○ ex. via grunt-contrib-connect ● proxy your current web app or API ○ ex. via grunt-connect-proxy ● overlay your changes
  • 15. JavaScript dependency management FTW! chimera core-ui files-ui groups-ui dealroom-ui new-ui
  • 16. Chimera, the myth of a style guide
  • 17. TAKE #2: build a client-side application layout
  • 18. Define your main application layout, client-side ● you will need some basic API ○ user API ○ account API ● application layout ○ topbar ○ sidebar ○ user menu ○ content ● a good candidate for offline
  • 19. The Workshare Application Layout topbar contentsidebar user menu
  • 20. TAKE #3: leave login where it is
  • 21. Authentication is complex, you don’t want to break it! ● typical web form login ● CSRF protection ● authentication via cookie ● support auth cookie on API ● single-sign on flows ● vanity domains
  • 23. iframe are ugly but can be useful... ● content access when on same origin ● native API to communicate ○ window.postMessage ● easy to detect ○ window === window.parent ● listen to URL/hash changes
  • 24. is a backend dev available? cool! ● create a custom page format ○ (ex. nova) ● serve a naked version of your page with just the main content ○ in Rails :layout => false ● in your url_helper modify your href to send a message via javascript to your parent application
  • 25. isn’t a backend dev available? oh no! ● load iframe as hidden ● hide application chrome and anything which is not your main content ● patch CSS if necessary ● patch links to route on SPA ● repeat on URL/hash change
  • 26. TAKE #5: reuse your test suite
  • 27. No refactoring without a proper test suite! ● Robot Framework ○ API tests ○ FE tests via WebDriver ● BDD style test definitions ● Re-use with minimal changes ○ if element selector don’t change! ○ adapt custom keywords ■ Navigate To (new URLs) ■ Locate Element (switch to iframe)
  • 28. TAKE #6: Apache (or nginx) is your friend
  • 29. ● map existing URLs you want to keep ● define your strategy to serve your SPA ○ on a subcontext /new-ui ○ on the root ■ via a custom header x-new-ui=true ■ on a different server ● proxy APIs and iframe pages ○ keep same origin ○ no need for CORS headers It’s deployment time! From Node to Apache/nginx
  • 30. TAKE #7: manage new development
  • 31. Evolve existing multi page URLs to single ● inject CSS from parent window ● build views in your SPA ● instantiate in multi page ● inject in parent DOM ● it’s really hard but a temporary workaround until APIs are available!
  • 32. Now or Never: current state and future
  • 33. 3 years later and 42 microservices after... ● refactoring well is a long and sloooow process... ● ...but we release weekly! ● the SPA approach allows iterating much faster ● also designers with front-end skills can easily build prototypes!
  • 34. What didn’t work so well ● login pages must be fast! ● FOUC (flash of unstyled content) ● existing “SPAlets” taking full control of the page (we had some GWT ones) are hard to integrate ● IE9 and hash URLs ● bundle JavaScript in chunks
  • 35. Disclaimer! Problems we didn’t have to solve ● it’s a web application, not a website ● URLs are forever ● SEO ○ googlebot crawls #! URLs ○ what about the others? ● browsers with JavaScript disabled ● IE less than 9 ● first render speed ● should we go isomorphic?
  • 36. TAKE #8: build an amazing team!
  • 37. Frontend and Backend teams working together the Web Squad builds the web frontend user interface... …but the Cirrus Squad provides the API our features build upon!
  • 39. Thanks! ROME 18-19 MARCH 2016 contacts marcello.teodori@gmail.com @magomarcelo All pictures belong to their respective authors