SlideShare une entreprise Scribd logo
1  sur  67
Télécharger pour lire hors ligne
Web-First
 Design
Patterns
Michael Mahemoff @mahemoff +mahemoff
Be Very Afraid
Evolution of Design Patterns

The Mother of All Design Principles

 The Mother of All Design Patterns

        Web-First Patterns
            Pattern-Fu
Static Websites
Interactive Websites
Single Page Apps
Modularity
 Principle
Tight Coupling
Tight Coupling
#highCohesion
     #lowCoupling
#modularity #isolation
#separationOfConcerns
#widget #webComponent
#domainObject #module
A runtime configuration
Mediator
Good: No more coupling
Good: No more coupling
Good: Reuse elsewhere
Test
        Driver




Good: We can test!
Semantic
 Events
 Pattern
eventA   eventB   eventC
shop
                                 cart




 item                                      item
added                                    changed
        eventA      eventB      eventC

                 item removed
#observer #listener
 #events #pubsub
 #mvc #messaging
Web-First
Automagic
   Event
Registration
eventA   eventB   eventC



The Problem: Event Registration
Timer = {

    init: function() {
      listen(“pageLoad”, this.onPageLoad);
      listen(“trialStart”, this.onTrialStart);
      listen(“trialEnd”, this.onTrialEnd);
    }

}




The Problem: Event Registration
Timer = {
      pageLoad: function() { … }
      trialStart: function() { … }
      trialEnd: function() { … }
    }




Solution: Automagic Registration
AppMediator = {

       init: function() {

           var components=[Trial, Counter, …]
           var handlers = {
             init: [],
             trialStart: [],
             trialEnd: []
           }

           for (eventType in handlers) {
             components.forEach(function(component) {
               if (component[eventType])
                 handlers[eventType].push(component);
             }
           }

       }

       fire: function(eventType) { … }

   }

Solution: Automagic Registration
Timer = {
  pageLoad: function() { … }
  onTrialStart: function() { … }
  onTrialEnd: function() { … }
}
Timer = {
    pageLoad: function() { … }
    onTrialStart: function() { … }
    onTrialEnd: function() { … }
  }




       An example of
Convention Over Configuration
OOCSSS
credit: Nicole Sullivan
h1 {
  background: blue;
  font-family: arial;
}

#account h1 {
  background: red;
}

#account h1:hover {
  border-color: black;
}


          The Problem:
           CSS Jungle
.account {
  background: #f9a;
}

.heading {
  color: #882;
}




          Solution:
 Use classes, not IDs or Tags
.account {
  background: #f9a;
}

.heading {
  color: #882;
}




           Solution:
       Avoid hierarchies
Classy
HTML
Logged in?
                                               Show name



Allowed to rate?                        Managing your page?
  Show thumbs                            Show edit controls


                   Leaving a comment?
                     Show textarea
             The Problem:
          Complex Display Logic
function startEditing() {
  $(‘.titleInput’).show();
  $(‘.mixPanel’).slideDown();
  $(‘.comments’).fadeOut();
}

function stopEditing() {
  $(‘.titleInput’).hide();
  $(‘.mixPanel’).slideUp();
  $(‘.comments’).fadeIn();
}


      The Problem:
   Complex Display Logic
$('html’).addClass(‘editing’);
$('html’).removeClass(‘editing’);



.mixPanel {
  display: none;
}

.editing .mixPanel {
  display: block;
}



  Solution: Root-level class
$('html’).addClass(‘editing’);
$('html’).removeClass(‘editing’);



.comments {
  height: 0;
  position: absolute;
  transition: all 0.5s linear;
}

.editing .comments {
  height: 4em;
}

  Solution: Root-level class
<div class=‘mixPanel forEditing’>
  ...
</div>


.forEditing {
  display: none;
}

.editing .forEditing {
  display: block;
}



        Generalising It
a speculative pattern




  Live
Template
<! accounts.forEach(account) { >
      <li><!= account.balance ></li>
    <! } >


    <ul>
      <li>28.50</li>
      <li>48.50</li>
      <li>78.12</li>
    </ul>



           The Problem:
Even client-side templates are static
<tr>
          <td>28.50</td>
          <td>48.50</td>
          <td>78.12</td>
        </tr>




         The Problem:
Can’t transform representation
<ul class=‘accountTemplate’>
  <li>28.50</li>
  <li>48.50</li>
  <li>78.12</li>
</ul>




     Solution:
Track the template
<ul class=‘accountTemplate’>
     <li>28.50</li>
     <li>48.50</li>
     <li>78.12</li>
   </ul>




          Solution:
Or wait for <template> tag!
METATIPS:
Pattern-Fu
A little chaos is okay
(the world won’t end)
Agile+Lean: Technical Debt
Order out of chaos
Shuhari:
Obey, Detach, Leave
Thankyou
  Michael Mahemoff
    @mahemoff
     +mahemoff

Contenu connexe

Tendances

YQL: Master Of the Mix
YQL: Master Of the MixYQL: Master Of the Mix
YQL: Master Of the Mix
markandey
 
Open expo Novembre 2014
Open expo Novembre 2014Open expo Novembre 2014
Open expo Novembre 2014
manuraynaud
 

Tendances (19)

PWA night vol.11 20191218
PWA night vol.11 20191218PWA night vol.11 20191218
PWA night vol.11 20191218
 
CSS3 and jQuery
CSS3 and jQueryCSS3 and jQuery
CSS3 and jQuery
 
Google Web Toolkit
Google Web ToolkitGoogle Web Toolkit
Google Web Toolkit
 
Functional Web Development using Elm
Functional Web Development using ElmFunctional Web Development using Elm
Functional Web Development using Elm
 
Kiss PageObjects [01-2017]
Kiss PageObjects [01-2017]Kiss PageObjects [01-2017]
Kiss PageObjects [01-2017]
 
Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015Polyglot automation - QA Fest - 2015
Polyglot automation - QA Fest - 2015
 
YQL: Master Of the Mix
YQL: Master Of the MixYQL: Master Of the Mix
YQL: Master Of the Mix
 
Friendlier, Safer WordPress Admin Areas
Friendlier, Safer WordPress Admin AreasFriendlier, Safer WordPress Admin Areas
Friendlier, Safer WordPress Admin Areas
 
jQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends ForeverjQuery and Rails: Best Friends Forever
jQuery and Rails: Best Friends Forever
 
Open expo Novembre 2014
Open expo Novembre 2014Open expo Novembre 2014
Open expo Novembre 2014
 
ES3-2020-P3 TDD Calculator
ES3-2020-P3 TDD CalculatorES3-2020-P3 TDD Calculator
ES3-2020-P3 TDD Calculator
 
Unobtrusive JavaScript
Unobtrusive JavaScriptUnobtrusive JavaScript
Unobtrusive JavaScript
 
Wix Automation - Core
Wix Automation - CoreWix Automation - Core
Wix Automation - Core
 
symfony & jQuery (phpDay)
symfony & jQuery (phpDay)symfony & jQuery (phpDay)
symfony & jQuery (phpDay)
 
Wix Automation - DIY - Testing BI Events
Wix Automation - DIY - Testing BI EventsWix Automation - DIY - Testing BI Events
Wix Automation - DIY - Testing BI Events
 
A (very) opinionated guide to MSBuild and Project Files
A (very) opinionated guide to MSBuild and Project FilesA (very) opinionated guide to MSBuild and Project Files
A (very) opinionated guide to MSBuild and Project Files
 
Lowering in C#: What really happens with your code?, from NDC Oslo 2019
Lowering in C#: What really happens with your code?, from NDC Oslo 2019Lowering in C#: What really happens with your code?, from NDC Oslo 2019
Lowering in C#: What really happens with your code?, from NDC Oslo 2019
 
Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014Page Objects Done Right - selenium conference 2014
Page Objects Done Right - selenium conference 2014
 
amsterdamjs - jQuery 1.5
amsterdamjs - jQuery 1.5amsterdamjs - jQuery 1.5
amsterdamjs - jQuery 1.5
 

En vedette

Top 10 Best Practices with Video in UX
Top 10 Best Practices with Video in UXTop 10 Best Practices with Video in UX
Top 10 Best Practices with Video in UX
J. Schuh
 
Big Design 2012 - From Muppets to Mastery
Big Design 2012 - From Muppets to MasteryBig Design 2012 - From Muppets to Mastery
Big Design 2012 - From Muppets to Mastery
Russ U
 

En vedette (6)

OSCON Presentation: Developing High Performance Websites and Modern Apps with...
OSCON Presentation: Developing High Performance Websites and Modern Apps with...OSCON Presentation: Developing High Performance Websites and Modern Apps with...
OSCON Presentation: Developing High Performance Websites and Modern Apps with...
 
Breaking Into UX
Breaking Into UXBreaking Into UX
Breaking Into UX
 
Top 10 Best Practices with Video in UX
Top 10 Best Practices with Video in UXTop 10 Best Practices with Video in UX
Top 10 Best Practices with Video in UX
 
Design Meets Disability
Design Meets DisabilityDesign Meets Disability
Design Meets Disability
 
Big Design 2012 - From Muppets to Mastery
Big Design 2012 - From Muppets to MasteryBig Design 2012 - From Muppets to Mastery
Big Design 2012 - From Muppets to Mastery
 
Defining New Partnerships
Defining New PartnershipsDefining New Partnerships
Defining New Partnerships
 

Similaire à Web-First Design Patterns

Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
Mahmoud Hamed Mahmoud
 

Similaire à Web-First Design Patterns (20)

Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)Google App Engine in 40 minutes (the absolute essentials)
Google App Engine in 40 minutes (the absolute essentials)
 
Сергей Больщиков "Protractor Tips & Tricks"
Сергей Больщиков "Protractor Tips & Tricks"Сергей Больщиков "Protractor Tips & Tricks"
Сергей Больщиков "Protractor Tips & Tricks"
 
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
Three Simple Chords of Alternative PageObjects and Hardcore of LoadableCompon...
 
PHPConf-TW 2012 # Twig
PHPConf-TW 2012 # TwigPHPConf-TW 2012 # Twig
PHPConf-TW 2012 # Twig
 
Will your code blend? : Toronto Code Camp 2010 : Barry Gervin
Will your code blend? : Toronto Code Camp 2010 : Barry GervinWill your code blend? : Toronto Code Camp 2010 : Barry Gervin
Will your code blend? : Toronto Code Camp 2010 : Barry Gervin
 
GWT MVP Case Study
GWT MVP Case StudyGWT MVP Case Study
GWT MVP Case Study
 
JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"JSLab. Алексей Волков. "React на практике"
JSLab. Алексей Волков. "React на практике"
 
Building user interface with react
Building user interface with reactBuilding user interface with react
Building user interface with react
 
Django quickstart
Django quickstartDjango quickstart
Django quickstart
 
Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development Windows Store app using XAML and C#: Enterprise Product Development
Windows Store app using XAML and C#: Enterprise Product Development
 
Workshop: Building Vaadin add-ons
Workshop: Building Vaadin add-onsWorkshop: Building Vaadin add-ons
Workshop: Building Vaadin add-ons
 
Working Effectively With Legacy Code
Working Effectively With Legacy CodeWorking Effectively With Legacy Code
Working Effectively With Legacy Code
 
Vanjs backbone-powerpoint
Vanjs backbone-powerpointVanjs backbone-powerpoint
Vanjs backbone-powerpoint
 
Continuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with seleniumContinuous integration using thucydides(bdd) with selenium
Continuous integration using thucydides(bdd) with selenium
 
Reactive Type-safe WebComponents
Reactive Type-safe WebComponentsReactive Type-safe WebComponents
Reactive Type-safe WebComponents
 
Backbone Basics with Examples
Backbone Basics with ExamplesBackbone Basics with Examples
Backbone Basics with Examples
 
Developer Joy - How great teams get s%*t done
Developer Joy - How great teams get s%*t doneDeveloper Joy - How great teams get s%*t done
Developer Joy - How great teams get s%*t done
 
The Ring programming language version 1.3 book - Part 30 of 88
The Ring programming language version 1.3 book - Part 30 of 88The Ring programming language version 1.3 book - Part 30 of 88
The Ring programming language version 1.3 book - Part 30 of 88
 
Backbone - TDC 2011 Floripa
Backbone - TDC 2011 FloripaBackbone - TDC 2011 Floripa
Backbone - TDC 2011 Floripa
 
Html css
Html cssHtml css
Html css
 

Dernier

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Victor Rentea
 
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
 

Dernier (20)

Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024Finding Java's Hidden Performance Traps @ DevoxxUK 2024
Finding Java's Hidden Performance Traps @ DevoxxUK 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
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
 
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
Apidays New York 2024 - Accelerating FinTech Innovation by Vasa Krishnan, Fin...
 
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
 
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ..."I see eyes in my soup": How Delivery Hero implemented the safety system for ...
"I see eyes in my soup": How Delivery Hero implemented the safety system for ...
 
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot ModelMcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
Mcleodganj Call Girls 🥰 8617370543 Service Offer VIP Hot Model
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
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...
 
Exploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with MilvusExploring Multimodal Embeddings with Milvus
Exploring Multimodal Embeddings with Milvus
 
MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024MINDCTI Revenue Release Quarter One 2024
MINDCTI Revenue Release Quarter One 2024
 
Platformless Horizons for Digital Adaptability
Platformless Horizons for Digital AdaptabilityPlatformless Horizons for Digital Adaptability
Platformless Horizons for Digital Adaptability
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
DBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor PresentationDBX First Quarter 2024 Investor Presentation
DBX First Quarter 2024 Investor Presentation
 
FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024FWD Group - Insurer Innovation Award 2024
FWD Group - Insurer Innovation Award 2024
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWEREMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
EMPOWERMENT TECHNOLOGY GRADE 11 QUARTER 2 REVIEWER
 
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
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..Understanding the FAA Part 107 License ..
Understanding the FAA Part 107 License ..
 

Web-First Design Patterns