SlideShare a Scribd company logo
1 of 47
Download to read offline
OBJECT-ORIENTED CSS
                        for High Performance Websites and Applications




                                                             Nicole Sullivan
Wednesday, April 29, 2009
GOOD NEWS
                CSS and front-end architecture have a huge impact on
                                   performance.




Wednesday, April 29, 2009
AND BAD
  NEWS




              If I don’t do my job right, I can slow your site down to a crawl
Wednesday, April 29, 2009
REQUIRE EXPERT ABILITY
               JUST TO GET STARTED.
                            this is not a sign of maturity.




Wednesday, April 29, 2009
FILE SIZE JUST KEEPS
                          GETTING BIGGER
                   As the site evolves we continuously modify the CSS.




Wednesday, April 29, 2009
CODE RE-USE IS ALMOST
              NONEXISTENT
                            people don’t trust other developers code.




Wednesday, April 29, 2009
CODE IS TOO FRAGILE.
       Even the cleanest code gets ruined by the first non-expert to
                                 touch it.




Wednesday, April 29, 2009
WHAT IS THE MOST
                 IMPORTANT MISTAKE
                TALENTED CODERS ARE
                      MAKING?
                            Writing really clever modules.




Wednesday, April 29, 2009
THE SIZE OF THEIR CSS
                     WILL INCREASE
            in a 1:1 relationship with the number of blocks, pages, and
                               complexity of content.




Wednesday, April 29, 2009
“JAVASCRIPT DOESN’T SUCK
                            You’re just doing it wrong.” -- Doug Crockford




Wednesday, April 29, 2009
“JAVASCRIPT DOESN’T SUCK
                            You’re just doing it wrong.” -- Doug Crockford




Wednesday, April 29, 2009
CSS
         “JAVASCRIPT DOESN’T SUCK
                            You’re just doing it wrong.” -- Doug Crockford




Wednesday, April 29, 2009
O(n)
                            Natural to you, but not to designers.




Wednesday, April 29, 2009
CALCULATING
                            COMPLEXITY IN CSS
                              All solutions are not created equal




Wednesday, April 29, 2009
FRONT END ARCHITECTURE
       NEEDS TO BE RIGHT
             Even best practices, like CSS sprites, can have unintended
                                    consequences.




Wednesday, April 29, 2009
WHOA!




Wednesday, April 29, 2009
Wednesday, April 29, 2009
Wednesday, April 29, 2009
LET’S SORT THIS OUT.
               In what ways have the solutions introduced complexity?




Wednesday, April 29, 2009
4x HTTP
               REQUESTS
          Four images where one is
                  enough




Wednesday, April 29, 2009
4x HTTP
               REQUESTS
          Four images where one is
                  enough




Wednesday, April 29, 2009
1x HTTP
                 REQUEST
       because background color is
           tied to border color




       2x CSS CODE
                 because structure is
                 duplicated for both


Wednesday, April 29, 2009
1x HTTP
                 REQUEST
       because background color is
           tied to border color




       2x CSS CODE
                 because structure is
                 duplicated for both


Wednesday, April 29, 2009
EXTRA
                    WEIGHT
           because sprites duplicate
                iconography




       2x CSS CODE
    because the two cannot share
           the same CSS


Wednesday, April 29, 2009
EXTRA
                    WEIGHT
           because sprites duplicate
                iconography




       2x CSS CODE
    because the two cannot share
           the same CSS


Wednesday, April 29, 2009
EXTRA
                    WEIGHT
    because sprites include text as
               images




             EXTRA CSS
     because each button requires
             its own CSS


Wednesday, April 29, 2009
EXTRA
                    WEIGHT
    because sprites include text as
               images




             EXTRA CSS
     because each button requires
             its own CSS


Wednesday, April 29, 2009
3 METRICS


    1. HTTP requests

    2. Size of images

    3. Size of the CSS




Wednesday, April 29, 2009
OBJECT-ORIENTED CSS
                       CAN HELP




Wednesday, April 29, 2009
CREATE A COMPONENT
                     LIBRARY
                            of reusable “legos”




Wednesday, April 29, 2009
SEPARATE CONTAINER
                     AND CONTENT




Wednesday, April 29, 2009
Contour blocks               Background blocks       Content Objects -
                                                    headings, paragraphs, lists, headers,
                                                          footers, buttons, etc.


                                                        Capital of the Canterbury region and the largest city
                                                        on the South Island (population just over 300,000)
                                                        exudes a palpable air of gentility and a connectedness
                                                        with the mother country.
                                                        Read more...




                            X                       X



                                        1:n
Wednesday, April 29, 2009
EXTEND OBJECTS: APPLY
               MULTIPLE CLASSES




Wednesday, April 29, 2009
MEDIA
                            Extending objects, a simple
                                    example.


Wednesday, April 29, 2009
<!-- media -->
<div class=quot;media mediaExtquot;>
  <img class=quot;fixedMediaquot; src=quot;myImg.pngquot; />

 <div class=quot;bodyquot;>

 
 ...

 </div>
</div>




Wednesday, April 29, 2009
SEPARATE STRUCTURE
                         FROM SKIN
                            two separate classes




Wednesday, April 29, 2009
block
                                          inner
                                                  hd



          STRUCTURE
    Solves browser bugs, positions                bd
      presentational elems, and
    generally does the heavy lifting
                of CSS.
                                                  ft




Wednesday, April 29, 2009
SKIN
                        Makes it pretty.

       The goal is very predictable
      skins, complexity is absorbed
       by the structure object and
          shared across the site.


Wednesday, April 29, 2009
/* ----- simple (extends mod) ----- */
  .simple .inner {
     border:1px solid gray;
     -moz-border-radius: 7px;
     -webkit-border-radius: 7px;
     border-radius: 7px;
  }
  .simple b{
    *background-image:url(skin/mod/corners.png);
  }




Wednesday, April 29, 2009
AVOID LOCATION
                            DEPENDENT STYLES
                              to keep CSS file size in check




Wednesday, April 29, 2009
Heading should not become a
                            A                                       Heading

                                     in another part of the page.




Wednesday, April 29, 2009
CONSISTENCY
          Writing more rules to
      overwrite the crazy rules from
                 before.

          e.g. Heading should behave
          predictably in any module.


Wednesday, April 29, 2009
#weatherModule h2{...}
                            #weatherModule h3{...}
                            #weatherModule p{...}
                            #tabs h2{...}
                            #tabs h3{...}
                            #tabs p{...}


                            +1 FOR MODULARITY,
                             BUT STILL BROKEN
Wednesday, April 29, 2009
DEMO
Wednesday, April 29, 2009
PHOTO CREDITS


    • “South                Carolina” by Army.Mil

    • “So          Happy Together” by kalandrakas

    • “sometimes, a               hug is all what we need” by kalandrakas




Wednesday, April 29, 2009
PHOTO CREDITS

        “You Crack Me Up” by http://flickr.com/photos/nickwheeleroz/2474196275/in/photostream/
    •

        “red lego” by http://flickr.com/photos/niznoz/5753993/
    •

        “Pablo’s cubism period began at three” by http://flickr.com/photos/wwworks/2475349116/in/
    •
        set-72157608035966422/

        “Kuwait water tower” by http://flickr.com/photos/asam/327911794/
    •

        idigit_teddy: http://www.flickr.com/photos/design_inspiration/238542495/
    •

        lucianvenutian: http://www.flickr.com/photos/lucianvenutian/1142630637/
    •

        Gimli_36: http://www.flickr.com/photos/navillot/1878124531/
    •

        NathanFromDeVryEET: http://www.flickr.com/photos/thatguyfromcchs08/2300190277/
    •

        Stabilo Boss: http://flickr.com/photos/stabilo-boss/101793494/in/set-72057594060779001/
    •



Wednesday, April 29, 2009
LET’S KEEP TALKING...
                                       http://stubbornella.org
                              http://github.com/stubbornella/oocss/
                                      nicole@stubbornella.org
                                   “stubbornella” on the web...
                             twitter, dopplr, slideshare, everywhere...



Wednesday, April 29, 2009

More Related Content

Similar to Object Oriented Css For High Performance Websites And Applications

SASS: The Next Wave in Styling and Theming
SASS: The Next Wave in Styling and ThemingSASS: The Next Wave in Styling and Theming
SASS: The Next Wave in Styling and ThemingSencha
 
Scaling with Postgres
Scaling with PostgresScaling with Postgres
Scaling with Postgreselliando dias
 
Agile2009
Agile2009Agile2009
Agile2009twh
 
Beautiful Web Typography (#4)
Beautiful Web Typography (#4)Beautiful Web Typography (#4)
Beautiful Web Typography (#4)Pascal Klein
 
Mobile Mountains - OverTheAir 2009
Mobile Mountains - OverTheAir 2009Mobile Mountains - OverTheAir 2009
Mobile Mountains - OverTheAir 2009twh
 
Agenda2.Key
Agenda2.KeyAgenda2.Key
Agenda2.KeyBill
 
Social Media And Business
Social Media And BusinessSocial Media And Business
Social Media And BusinessBank of Ireland
 
NoTube User Model slides
NoTube User Model slidesNoTube User Model slides
NoTube User Model slidesDan Brickley
 

Similar to Object Oriented Css For High Performance Websites And Applications (14)

Object Oriented CSS
Object Oriented CSSObject Oriented CSS
Object Oriented CSS
 
Alternative Databases
Alternative DatabasesAlternative Databases
Alternative Databases
 
SASS: The Next Wave in Styling and Theming
SASS: The Next Wave in Styling and ThemingSASS: The Next Wave in Styling and Theming
SASS: The Next Wave in Styling and Theming
 
Scaling with Postgres
Scaling with PostgresScaling with Postgres
Scaling with Postgres
 
Agile2009
Agile2009Agile2009
Agile2009
 
Beautiful Web Typography (#4)
Beautiful Web Typography (#4)Beautiful Web Typography (#4)
Beautiful Web Typography (#4)
 
Web Design in 2009
Web Design in 2009Web Design in 2009
Web Design in 2009
 
Mobile Mountains - OverTheAir 2009
Mobile Mountains - OverTheAir 2009Mobile Mountains - OverTheAir 2009
Mobile Mountains - OverTheAir 2009
 
Wk09 Interfacet 29 09
Wk09 Interfacet 29 09Wk09 Interfacet 29 09
Wk09 Interfacet 29 09
 
Agenda2.Key
Agenda2.KeyAgenda2.Key
Agenda2.Key
 
Social Media And Business
Social Media And BusinessSocial Media And Business
Social Media And Business
 
NoTube User Model slides
NoTube User Model slidesNoTube User Model slides
NoTube User Model slides
 
Performance Strategies
Performance StrategiesPerformance Strategies
Performance Strategies
 
Generic Editor
Generic EditorGeneric Editor
Generic Editor
 

More from PerconaPerformance

Drizzles Approach To Improving Performance Of The Server
Drizzles  Approach To  Improving  Performance Of The  ServerDrizzles  Approach To  Improving  Performance Of The  Server
Drizzles Approach To Improving Performance Of The ServerPerconaPerformance
 
E M T Better Performance Monitoring
E M T  Better  Performance  MonitoringE M T  Better  Performance  Monitoring
E M T Better Performance MonitoringPerconaPerformance
 
Covering Indexes Ordersof Magnitude Improvements
Covering  Indexes  Ordersof Magnitude  ImprovementsCovering  Indexes  Ordersof Magnitude  Improvements
Covering Indexes Ordersof Magnitude ImprovementsPerconaPerformance
 
Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And MavenPerconaPerformance
 
Galera Multi Master Synchronous My S Q L Replication Clusters
Galera  Multi Master  Synchronous  My S Q L  Replication  ClustersGalera  Multi Master  Synchronous  My S Q L  Replication  Clusters
Galera Multi Master Synchronous My S Q L Replication ClustersPerconaPerformance
 
My S Q L Replication Getting The Most From Slaves
My S Q L  Replication  Getting  The  Most  From  SlavesMy S Q L  Replication  Getting  The  Most  From  Slaves
My S Q L Replication Getting The Most From SlavesPerconaPerformance
 
Performance Instrumentation Beyond What You Do Now
Performance  Instrumentation  Beyond  What  You  Do  NowPerformance  Instrumentation  Beyond  What  You  Do  Now
Performance Instrumentation Beyond What You Do NowPerconaPerformance
 
Boost Performance With My S Q L 51 Partitions
Boost Performance With  My S Q L 51 PartitionsBoost Performance With  My S Q L 51 Partitions
Boost Performance With My S Q L 51 PartitionsPerconaPerformance
 
Trees And More With Postgre S Q L
Trees And  More With  Postgre S Q LTrees And  More With  Postgre S Q L
Trees And More With Postgre S Q LPerconaPerformance
 
Database Performance With Proxy Architectures
Database  Performance With  Proxy  ArchitecturesDatabase  Performance With  Proxy  Architectures
Database Performance With Proxy ArchitecturesPerconaPerformance
 
Running A Realtime Stats Service On My Sql
Running A Realtime Stats Service On My SqlRunning A Realtime Stats Service On My Sql
Running A Realtime Stats Service On My SqlPerconaPerformance
 
How To Think About Performance
How To Think About PerformanceHow To Think About Performance
How To Think About PerformancePerconaPerformance
 
Your Disk Array Is Slower Than It Should Be
Your Disk Array Is Slower Than It Should BeYour Disk Array Is Slower Than It Should Be
Your Disk Array Is Slower Than It Should BePerconaPerformance
 

More from PerconaPerformance (17)

Drizzles Approach To Improving Performance Of The Server
Drizzles  Approach To  Improving  Performance Of The  ServerDrizzles  Approach To  Improving  Performance Of The  Server
Drizzles Approach To Improving Performance Of The Server
 
E M T Better Performance Monitoring
E M T  Better  Performance  MonitoringE M T  Better  Performance  Monitoring
E M T Better Performance Monitoring
 
Covering Indexes Ordersof Magnitude Improvements
Covering  Indexes  Ordersof Magnitude  ImprovementsCovering  Indexes  Ordersof Magnitude  Improvements
Covering Indexes Ordersof Magnitude Improvements
 
Automated Performance Testing With J Meter And Maven
Automated  Performance  Testing With  J Meter And  MavenAutomated  Performance  Testing With  J Meter And  Maven
Automated Performance Testing With J Meter And Maven
 
Galera Multi Master Synchronous My S Q L Replication Clusters
Galera  Multi Master  Synchronous  My S Q L  Replication  ClustersGalera  Multi Master  Synchronous  My S Q L  Replication  Clusters
Galera Multi Master Synchronous My S Q L Replication Clusters
 
My S Q L Replication Getting The Most From Slaves
My S Q L  Replication  Getting  The  Most  From  SlavesMy S Q L  Replication  Getting  The  Most  From  Slaves
My S Q L Replication Getting The Most From Slaves
 
Performance Instrumentation Beyond What You Do Now
Performance  Instrumentation  Beyond  What  You  Do  NowPerformance  Instrumentation  Beyond  What  You  Do  Now
Performance Instrumentation Beyond What You Do Now
 
Boost Performance With My S Q L 51 Partitions
Boost Performance With  My S Q L 51 PartitionsBoost Performance With  My S Q L 51 Partitions
Boost Performance With My S Q L 51 Partitions
 
High Performance Erlang
High  Performance  ErlangHigh  Performance  Erlang
High Performance Erlang
 
Websites On Speed
Websites On  SpeedWebsites On  Speed
Websites On Speed
 
Trees And More With Postgre S Q L
Trees And  More With  Postgre S Q LTrees And  More With  Postgre S Q L
Trees And More With Postgre S Q L
 
Database Performance With Proxy Architectures
Database  Performance With  Proxy  ArchitecturesDatabase  Performance With  Proxy  Architectures
Database Performance With Proxy Architectures
 
Using Storage Class Memory
Using Storage Class MemoryUsing Storage Class Memory
Using Storage Class Memory
 
Websites On Speed
Websites On SpeedWebsites On Speed
Websites On Speed
 
Running A Realtime Stats Service On My Sql
Running A Realtime Stats Service On My SqlRunning A Realtime Stats Service On My Sql
Running A Realtime Stats Service On My Sql
 
How To Think About Performance
How To Think About PerformanceHow To Think About Performance
How To Think About Performance
 
Your Disk Array Is Slower Than It Should Be
Your Disk Array Is Slower Than It Should BeYour Disk Array Is Slower Than It Should Be
Your Disk Array Is Slower Than It Should Be
 

Recently uploaded

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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 3652toLead Limited
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksSoftradix Technologies
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slidespraypatel2
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountPuma Security, LLC
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesSinan KOZAK
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Hyundai Motor Group
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...HostedbyConfluent
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxMalak Abu Hammad
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsMemoori
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?XfilesPro
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 

Recently uploaded (20)

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
 
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
Tech-Forward - Achieving Business Readiness For Copilot in Microsoft 365
 
Pigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping ElbowsPigging Solutions Piggable Sweeping Elbows
Pigging Solutions Piggable Sweeping Elbows
 
Benefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other FrameworksBenefits Of Flutter Compared To Other Frameworks
Benefits Of Flutter Compared To Other Frameworks
 
Slack Application Development 101 Slides
Slack Application Development 101 SlidesSlack Application Development 101 Slides
Slack Application Development 101 Slides
 
Breaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path MountBreaking the Kubernetes Kill Chain: Host Path Mount
Breaking the Kubernetes Kill Chain: Host Path Mount
 
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
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Unblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen FramesUnblocking The Main Thread Solving ANRs and Frozen Frames
Unblocking The Main Thread Solving ANRs and Frozen Frames
 
Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2Next-generation AAM aircraft unveiled by Supernal, S-A2
Next-generation AAM aircraft unveiled by Supernal, S-A2
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
Transforming Data Streams with Kafka Connect: An Introduction to Single Messa...
 
The Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptxThe Codex of Business Writing Software for Real-World Solutions 2.pptx
The Codex of Business Writing Software for Real-World Solutions 2.pptx
 
AI as an Interface for Commercial Buildings
AI as an Interface for Commercial BuildingsAI as an Interface for Commercial Buildings
AI as an Interface for Commercial Buildings
 
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
Neo4j - How KGs are shaping the future of Generative AI at AWS Summit London ...
 
How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?How to Remove Document Management Hurdles with X-Docs?
How to Remove Document Management Hurdles with X-Docs?
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 

Object Oriented Css For High Performance Websites And Applications

  • 1. OBJECT-ORIENTED CSS for High Performance Websites and Applications Nicole Sullivan Wednesday, April 29, 2009
  • 2. GOOD NEWS CSS and front-end architecture have a huge impact on performance. Wednesday, April 29, 2009
  • 3. AND BAD NEWS If I don’t do my job right, I can slow your site down to a crawl Wednesday, April 29, 2009
  • 4. REQUIRE EXPERT ABILITY JUST TO GET STARTED. this is not a sign of maturity. Wednesday, April 29, 2009
  • 5. FILE SIZE JUST KEEPS GETTING BIGGER As the site evolves we continuously modify the CSS. Wednesday, April 29, 2009
  • 6. CODE RE-USE IS ALMOST NONEXISTENT people don’t trust other developers code. Wednesday, April 29, 2009
  • 7. CODE IS TOO FRAGILE. Even the cleanest code gets ruined by the first non-expert to touch it. Wednesday, April 29, 2009
  • 8. WHAT IS THE MOST IMPORTANT MISTAKE TALENTED CODERS ARE MAKING? Writing really clever modules. Wednesday, April 29, 2009
  • 9. THE SIZE OF THEIR CSS WILL INCREASE in a 1:1 relationship with the number of blocks, pages, and complexity of content. Wednesday, April 29, 2009
  • 10. “JAVASCRIPT DOESN’T SUCK You’re just doing it wrong.” -- Doug Crockford Wednesday, April 29, 2009
  • 11. “JAVASCRIPT DOESN’T SUCK You’re just doing it wrong.” -- Doug Crockford Wednesday, April 29, 2009
  • 12. CSS “JAVASCRIPT DOESN’T SUCK You’re just doing it wrong.” -- Doug Crockford Wednesday, April 29, 2009
  • 13. O(n) Natural to you, but not to designers. Wednesday, April 29, 2009
  • 14. CALCULATING COMPLEXITY IN CSS All solutions are not created equal Wednesday, April 29, 2009
  • 15. FRONT END ARCHITECTURE NEEDS TO BE RIGHT Even best practices, like CSS sprites, can have unintended consequences. Wednesday, April 29, 2009
  • 19. LET’S SORT THIS OUT. In what ways have the solutions introduced complexity? Wednesday, April 29, 2009
  • 20. 4x HTTP REQUESTS Four images where one is enough Wednesday, April 29, 2009
  • 21. 4x HTTP REQUESTS Four images where one is enough Wednesday, April 29, 2009
  • 22. 1x HTTP REQUEST because background color is tied to border color 2x CSS CODE because structure is duplicated for both Wednesday, April 29, 2009
  • 23. 1x HTTP REQUEST because background color is tied to border color 2x CSS CODE because structure is duplicated for both Wednesday, April 29, 2009
  • 24. EXTRA WEIGHT because sprites duplicate iconography 2x CSS CODE because the two cannot share the same CSS Wednesday, April 29, 2009
  • 25. EXTRA WEIGHT because sprites duplicate iconography 2x CSS CODE because the two cannot share the same CSS Wednesday, April 29, 2009
  • 26. EXTRA WEIGHT because sprites include text as images EXTRA CSS because each button requires its own CSS Wednesday, April 29, 2009
  • 27. EXTRA WEIGHT because sprites include text as images EXTRA CSS because each button requires its own CSS Wednesday, April 29, 2009
  • 28. 3 METRICS 1. HTTP requests 2. Size of images 3. Size of the CSS Wednesday, April 29, 2009
  • 29. OBJECT-ORIENTED CSS CAN HELP Wednesday, April 29, 2009
  • 30. CREATE A COMPONENT LIBRARY of reusable “legos” Wednesday, April 29, 2009
  • 31. SEPARATE CONTAINER AND CONTENT Wednesday, April 29, 2009
  • 32. Contour blocks Background blocks Content Objects - headings, paragraphs, lists, headers, footers, buttons, etc. Capital of the Canterbury region and the largest city on the South Island (population just over 300,000) exudes a palpable air of gentility and a connectedness with the mother country. Read more... X X 1:n Wednesday, April 29, 2009
  • 33. EXTEND OBJECTS: APPLY MULTIPLE CLASSES Wednesday, April 29, 2009
  • 34. MEDIA Extending objects, a simple example. Wednesday, April 29, 2009
  • 35. <!-- media --> <div class=quot;media mediaExtquot;> <img class=quot;fixedMediaquot; src=quot;myImg.pngquot; /> <div class=quot;bodyquot;> ... </div> </div> Wednesday, April 29, 2009
  • 36. SEPARATE STRUCTURE FROM SKIN two separate classes Wednesday, April 29, 2009
  • 37. block inner hd STRUCTURE Solves browser bugs, positions bd presentational elems, and generally does the heavy lifting of CSS. ft Wednesday, April 29, 2009
  • 38. SKIN Makes it pretty. The goal is very predictable skins, complexity is absorbed by the structure object and shared across the site. Wednesday, April 29, 2009
  • 39. /* ----- simple (extends mod) ----- */ .simple .inner { border:1px solid gray; -moz-border-radius: 7px; -webkit-border-radius: 7px; border-radius: 7px; } .simple b{ *background-image:url(skin/mod/corners.png); } Wednesday, April 29, 2009
  • 40. AVOID LOCATION DEPENDENT STYLES to keep CSS file size in check Wednesday, April 29, 2009
  • 41. Heading should not become a A Heading in another part of the page. Wednesday, April 29, 2009
  • 42. CONSISTENCY Writing more rules to overwrite the crazy rules from before. e.g. Heading should behave predictably in any module. Wednesday, April 29, 2009
  • 43. #weatherModule h2{...} #weatherModule h3{...} #weatherModule p{...} #tabs h2{...} #tabs h3{...} #tabs p{...} +1 FOR MODULARITY, BUT STILL BROKEN Wednesday, April 29, 2009
  • 45. PHOTO CREDITS • “South Carolina” by Army.Mil • “So Happy Together” by kalandrakas • “sometimes, a hug is all what we need” by kalandrakas Wednesday, April 29, 2009
  • 46. PHOTO CREDITS “You Crack Me Up” by http://flickr.com/photos/nickwheeleroz/2474196275/in/photostream/ • “red lego” by http://flickr.com/photos/niznoz/5753993/ • “Pablo’s cubism period began at three” by http://flickr.com/photos/wwworks/2475349116/in/ • set-72157608035966422/ “Kuwait water tower” by http://flickr.com/photos/asam/327911794/ • idigit_teddy: http://www.flickr.com/photos/design_inspiration/238542495/ • lucianvenutian: http://www.flickr.com/photos/lucianvenutian/1142630637/ • Gimli_36: http://www.flickr.com/photos/navillot/1878124531/ • NathanFromDeVryEET: http://www.flickr.com/photos/thatguyfromcchs08/2300190277/ • Stabilo Boss: http://flickr.com/photos/stabilo-boss/101793494/in/set-72057594060779001/ • Wednesday, April 29, 2009
  • 47. LET’S KEEP TALKING... http://stubbornella.org http://github.com/stubbornella/oocss/ nicole@stubbornella.org “stubbornella” on the web... twitter, dopplr, slideshare, everywhere... Wednesday, April 29, 2009