SlideShare a Scribd company logo
1 of 74
Download to read offline
Building Rich User Experiences
                                      without
                              JavaScript Spaghetti


                                   by Jared Faris
                                   @jaredthenerd




Saturday, March 17, 12
About me




Saturday, March 17, 12
JavaScript




Saturday, March 17, 12
Designers




Saturday, March 17, 12
Developers




Saturday, March 17, 12
The Problem
        Designers tend to think in terms of appearance. Good
                     ones think about usability.

        Only the very best ones think about programmability.


       Developers make it worse by not thinking about design




Saturday, March 17, 12
A Typical Product Lifecycle
                          Somewhat dramatized...




Saturday, March 17, 12
Designer   Developer




Saturday, March 17, 12
We need this
                           feature




Saturday, March 17, 12
I got this




Saturday, March 17, 12
?




Saturday, March 17, 12
Tweaking time...




Saturday, March 17, 12
I got another
                           great idea




Saturday, March 17, 12
Now you tell
                            me




Saturday, March 17, 12
The developer bolts on some more code




Saturday, March 17, 12
And another
                           thing...




Saturday, March 17, 12
grrr




Saturday, March 17, 12
We don’t
                          ‘really’
                         need this




Saturday, March 17, 12
Uh, yeah we
                              do




Saturday, March 17, 12
Saturday, March 17, 12
The developer bolts on some more code




Saturday, March 17, 12
Some time passes

                                ‘Some time’ is defined as:
                  Just long enough that the developer doesn’t remember
                            exactly how his original code works.




Saturday, March 17, 12
I’ve got a new
                             feature




Saturday, March 17, 12
Angry developers
                         can really do this.
                          IT managers be
                              warned.




Saturday, March 17, 12
Protective Beret




Saturday, March 17, 12
More messy code




Saturday, March 17, 12
The last bug




                         Oh wait, one more




Saturday, March 17, 12
Finally




Saturday, March 17, 12
The next day...




Saturday, March 17, 12
Saturday, March 17, 12
Two weeks pass.




Saturday, March 17, 12
I’ve got a new
                             feature
                                          Gahh!




Saturday, March 17, 12
Saturday, March 17, 12
No developers were harmed in the making
                              of this dramatic reenactment.




Saturday, March 17, 12
Additional Features + Short Sighted Architecting
                        = Horrible JavaScript Spaghetti




Saturday, March 17, 12
Why does this happen?

                          This is where you earn audience participation points.




Saturday, March 17, 12
Some Reasons

              • JavaScript isn’t real code
              • We don’t treat client side things as real features
              • We can’t easily test it




Saturday, March 17, 12
This really all boils down to one thing.


                                  We developers suck.




Saturday, March 17, 12
Bonus second lesson


               We developers suck at interacting with designers
                             (or stakeholders).




Saturday, March 17, 12
Three JavaScript Principles

                              • Decouple everything
                              • Make it testable
                              • Push events, not state




Saturday, March 17, 12
Decouple Everything

                    Start thinking about UI pieces as individual JS objects.
                           Remove dependencies between objects.
                           Apply your OO best practices here too.




Saturday, March 17, 12
Make It Testable

                          Separate DOM dependent stuff into a single layer.
                         Put the rest of the stuff in classes that you can test.




Saturday, March 17, 12
Push Events, Not State

                           Know about the Law of Demeter.
                       Let controls worry about their own state.
                 Inform other controls that “X happened to Y”, not “Y is
                                       in X state”




Saturday, March 17, 12
Some Patterns




Saturday, March 17, 12
Mediator Pattern
                   "The essence of the Mediator Pattern is to "Define an
                   object that encapsulates how a set of objects interact.
                   Mediator promotes loose coupling by keeping objects
                    from referring to each other explicitly, and it lets you
                           vary their interaction independently."
                         -Design Patterns: Elements of Reusable Object-Oriented Software




Saturday, March 17, 12
NavControlMediator

                            itemSelected()




                             unselectAll()




                         Events from some
                           other object
Saturday, March 17, 12
Observer Pattern
                 "Define a one-to-many dependency between objects so
                  that when one object changes state, all its dependents
                         are notified and updated automatically."
                         -Design Patterns: Elements of Reusable Object-Oriented Software




                              Think jQuery $(‘.something’).click()


Saturday, March 17, 12
NavControlMediator

                            itemSelected()
                            viewModel




                             unselectAll()




                         Events from some
                           other object
Saturday, March 17, 12
Knockout.js Template Example




Saturday, March 17, 12
Pub/Sub + Fairy Dust = Service Bus

                           Pub/Sub is great to make sure events propagate.
                         It stats to get brittle with lots of different controls.




Saturday, March 17, 12
Way Too Much Pubbing and Subbing




Saturday, March 17, 12
Service Bus

                 A service bus is another layer that sits outside controls.
                  Controls that want to communicate speak through it.
                  Your controls are then only coupled to a single thing.




Saturday, March 17, 12
Postal.js




Saturday, March 17, 12
Service Bus + Mediator
                • Controls no longer need to know about others.
                • We can remove/replace controls individually.
                • We can add controls that listen to the same events
                without modifying the publisher.
                • We can re-use pieces more easily because they work
                in a standard way.




Saturday, March 17, 12
NavControlMediator

                          itemSelected()
                          viewModel



                                                 Service Bus
                           unselectAll()




                           Events from some
                             other object



                                ReportMediator

                               itemChanged()
                               viewModel




                                unselectAll()




Saturday, March 17, 12
HistoryControl
                         NavControlMediator

                          itemSelected()
                          viewModel



                                                 Service Bus
                           unselectAll()




                           Events from some
                             other object



                                ReportMediator

                               itemChanged()
                               viewModel




                                unselectAll()




Saturday, March 17, 12
Questions About Patterns?




Saturday, March 17, 12
A Typical Product Lifecycle
                              Round Two




Saturday, March 17, 12
We need this
                           feature




Saturday, March 17, 12
I got a few
                          questions




Saturday, March 17, 12
?




Saturday, March 17, 12
Tweaking time...




Saturday, March 17, 12
I got another
                           great idea




Saturday, March 17, 12
Ok, Cool




Saturday, March 17, 12
And another
                           thing...




Saturday, March 17, 12
Done.




Saturday, March 17, 12
Two weeks pass...




Saturday, March 17, 12
I’ve got a new
                             feature




Saturday, March 17, 12
No worries.




Saturday, March 17, 12
Wha? Ohhhk.




Saturday, March 17, 12
A short time later...




Saturday, March 17, 12
Saturday, March 17, 12
Special thanks to




                         He did the frame art
                               Blame me for
                              everything else




Saturday, March 17, 12
Knockout.js - Observer pattern (pub/sub)
                                 http://knockoutjs.com/

                                   Postal.js - Service bus
                           https://github.com/ifandelse/postal.js

                                          My Stuff
                                      @jaredthenerd
                                    jfaris@gmail.com
                               https://github.com/jaredfaris
                                 http://jaredthenerd.com

Saturday, March 17, 12

More Related Content

Viewers also liked

Profile Innovative Hr Solution
Profile Innovative Hr SolutionProfile Innovative Hr Solution
Profile Innovative Hr Solution
SACHDEVNILESH
 
Tom butler bowdon_-_50_knig_i_velikih_idej__www.freemba.ru_
Tom butler bowdon_-_50_knig_i_velikih_idej__www.freemba.ru_Tom butler bowdon_-_50_knig_i_velikih_idej__www.freemba.ru_
Tom butler bowdon_-_50_knig_i_velikih_idej__www.freemba.ru_
anmarketers
 
De Duurzame Stad volgens HKB
De Duurzame Stad volgens HKBDe Duurzame Stad volgens HKB
De Duurzame Stad volgens HKB
HKblabla
 
Javascript spaghetti stirtrek_5_17
Javascript  spaghetti stirtrek_5_17Javascript  spaghetti stirtrek_5_17
Javascript spaghetti stirtrek_5_17
Jared Faris
 
Dossier cicle superior
Dossier cicle superiorDossier cicle superior
Dossier cicle superior
david
 
Dossier c.i. 2010 11
Dossier c.i. 2010 11Dossier c.i. 2010 11
Dossier c.i. 2010 11
david
 

Viewers also liked (20)

Klasseledelse
KlasseledelseKlasseledelse
Klasseledelse
 
Profile Innovative Hr Solution
Profile Innovative Hr SolutionProfile Innovative Hr Solution
Profile Innovative Hr Solution
 
Jurnal digital
Jurnal digitalJurnal digital
Jurnal digital
 
Tom butler bowdon_-_50_knig_i_velikih_idej__www.freemba.ru_
Tom butler bowdon_-_50_knig_i_velikih_idej__www.freemba.ru_Tom butler bowdon_-_50_knig_i_velikih_idej__www.freemba.ru_
Tom butler bowdon_-_50_knig_i_velikih_idej__www.freemba.ru_
 
Being a gentlemen with girls "the definitive way to express yourself and trea...
Being a gentlemen with girls "the definitive way to express yourself and trea...Being a gentlemen with girls "the definitive way to express yourself and trea...
Being a gentlemen with girls "the definitive way to express yourself and trea...
 
Standup meets startup concept
Standup meets startup conceptStandup meets startup concept
Standup meets startup concept
 
SeedForum Tallinn keynote 05.03.13
SeedForum Tallinn keynote 05.03.13 SeedForum Tallinn keynote 05.03.13
SeedForum Tallinn keynote 05.03.13
 
19.10.2011 ajujaht keynote, raido pikkar
19.10.2011 ajujaht keynote, raido pikkar 19.10.2011 ajujaht keynote, raido pikkar
19.10.2011 ajujaht keynote, raido pikkar
 
Insight uri din online1
Insight uri din online1Insight uri din online1
Insight uri din online1
 
Klasseledelse1
Klasseledelse1Klasseledelse1
Klasseledelse1
 
Push the boundaries of your Business Model& introduction to PM
Push the boundaries of your Business Model& introduction to PM Push the boundaries of your Business Model& introduction to PM
Push the boundaries of your Business Model& introduction to PM
 
Pel eksamen høst 2010
Pel eksamen høst 2010Pel eksamen høst 2010
Pel eksamen høst 2010
 
De Duurzame Stad volgens HKB
De Duurzame Stad volgens HKBDe Duurzame Stad volgens HKB
De Duurzame Stad volgens HKB
 
Use all the buzzwords
Use all the buzzwordsUse all the buzzwords
Use all the buzzwords
 
The Spork / Platypus Average: Content strategy at Red Gate Software
The Spork / Platypus Average: Content strategy at Red Gate SoftwareThe Spork / Platypus Average: Content strategy at Red Gate Software
The Spork / Platypus Average: Content strategy at Red Gate Software
 
Friends info
Friends infoFriends info
Friends info
 
Javascript spaghetti stirtrek_5_17
Javascript  spaghetti stirtrek_5_17Javascript  spaghetti stirtrek_5_17
Javascript spaghetti stirtrek_5_17
 
Prinsip bernoulli 1
Prinsip bernoulli 1Prinsip bernoulli 1
Prinsip bernoulli 1
 
Dossier cicle superior
Dossier cicle superiorDossier cicle superior
Dossier cicle superior
 
Dossier c.i. 2010 11
Dossier c.i. 2010 11Dossier c.i. 2010 11
Dossier c.i. 2010 11
 

Similar to Building Rich User Experiences w/o JavaScript Spaghetti

Engineering Change
Engineering ChangeEngineering Change
Engineering Change
Kellan
 
Ux paper prototyping
Ux paper prototypingUx paper prototyping
Ux paper prototyping
Grace Ng
 
Simonvc basho-nosql-in-a-continuous-delivery-world
Simonvc basho-nosql-in-a-continuous-delivery-worldSimonvc basho-nosql-in-a-continuous-delivery-world
Simonvc basho-nosql-in-a-continuous-delivery-world
Simon Vans-Colina
 
Cleanweb uk worthing
Cleanweb uk worthingCleanweb uk worthing
Cleanweb uk worthing
Cleanweb UK
 
Pinterest arch summit august 2012 - scaling pinterest
Pinterest arch summit   august 2012 - scaling pinterestPinterest arch summit   august 2012 - scaling pinterest
Pinterest arch summit august 2012 - scaling pinterest
drewz lin
 
How to be a Lean Product Developer? @Agile Riga Day 2012
How to be a Lean Product Developer? @Agile Riga Day 2012How to be a Lean Product Developer? @Agile Riga Day 2012
How to be a Lean Product Developer? @Agile Riga Day 2012
Marko Taipale
 

Similar to Building Rich User Experiences w/o JavaScript Spaghetti (20)

Engineering Change
Engineering ChangeEngineering Change
Engineering Change
 
MonadReader: Less is More
MonadReader: Less is MoreMonadReader: Less is More
MonadReader: Less is More
 
Ux paper prototyping
Ux paper prototypingUx paper prototyping
Ux paper prototyping
 
Event based modeling - eng
Event based modeling - engEvent based modeling - eng
Event based modeling - eng
 
Sencha Touch 2
Sencha Touch 2Sencha Touch 2
Sencha Touch 2
 
Sencha Touch 2
Sencha Touch 2Sencha Touch 2
Sencha Touch 2
 
UI Animation principles and practice with GSAP
UI Animation principles and practice with GSAPUI Animation principles and practice with GSAP
UI Animation principles and practice with GSAP
 
Architecting for Change: QCONNYC 2012
Architecting for Change: QCONNYC 2012Architecting for Change: QCONNYC 2012
Architecting for Change: QCONNYC 2012
 
Content and Coding are not Commodities
Content and Coding are not CommoditiesContent and Coding are not Commodities
Content and Coding are not Commodities
 
Simonvc basho-nosql-in-a-continuous-delivery-world
Simonvc basho-nosql-in-a-continuous-delivery-worldSimonvc basho-nosql-in-a-continuous-delivery-world
Simonvc basho-nosql-in-a-continuous-delivery-world
 
Testing mysql creatively in a sandbox
Testing mysql creatively in a sandboxTesting mysql creatively in a sandbox
Testing mysql creatively in a sandbox
 
Cleanweb uk worthing
Cleanweb uk worthingCleanweb uk worthing
Cleanweb uk worthing
 
PyCon talk: Deploy Python apps in 5 min with a PaaS
PyCon talk: Deploy Python apps in 5 min with a PaaSPyCon talk: Deploy Python apps in 5 min with a PaaS
PyCon talk: Deploy Python apps in 5 min with a PaaS
 
Bootstrap tour
Bootstrap tourBootstrap tour
Bootstrap tour
 
Faster mobile sites
Faster mobile sitesFaster mobile sites
Faster mobile sites
 
Beware the Shiny!
Beware the Shiny!Beware the Shiny!
Beware the Shiny!
 
Pundit
PunditPundit
Pundit
 
Responsive Web Design & Workflow
Responsive Web Design & WorkflowResponsive Web Design & Workflow
Responsive Web Design & Workflow
 
Pinterest arch summit august 2012 - scaling pinterest
Pinterest arch summit   august 2012 - scaling pinterestPinterest arch summit   august 2012 - scaling pinterest
Pinterest arch summit august 2012 - scaling pinterest
 
How to be a Lean Product Developer? @Agile Riga Day 2012
How to be a Lean Product Developer? @Agile Riga Day 2012How to be a Lean Product Developer? @Agile Riga Day 2012
How to be a Lean Product Developer? @Agile Riga Day 2012
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024Top 10 Most Downloaded Games on Play Store in 2024
Top 10 Most Downloaded Games on Play Store in 2024
 
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
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024Tata AIG General Insurance Company - Insurer Innovation Award 2024
Tata AIG General Insurance Company - Insurer Innovation Award 2024
 
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
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...Workshop - Best of Both Worlds_ Combine  KG and Vector search for  enhanced R...
Workshop - Best of Both Worlds_ Combine KG and Vector search for enhanced R...
 
The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024The 7 Things I Know About Cyber Security After 25 Years | April 2024
The 7 Things I Know About Cyber Security After 25 Years | April 2024
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
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
 
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
Mastering MySQL Database Architecture: Deep Dive into MySQL Shell and MySQL R...
 
Artificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : UncertaintyArtificial Intelligence Chap.5 : Uncertainty
Artificial Intelligence Chap.5 : Uncertainty
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 

Building Rich User Experiences w/o JavaScript Spaghetti