SlideShare a Scribd company logo
1 of 95
Download to read offline
Modern web
development
• Web standards
• Semantics
• Separating layers
• Unobtrusive JavaScript
• Performance
Web standards
What are web standards?
There aren’t any Web Standards,
    only Recommendations
“A W3C Recommendation is a specification
or set of guidelines that, after extensive
consensus-building, has received the
endorsement of W3C Members and the
Director. W3C recommends the wide
deployment of its Recommendations.”
                                   – W3C
• Valid HTML/XHTML code
• Semantically correct code
• Separation of content, presentation
  and interaction
DOCTYPEs decide rendering mode
• Quirks Mode
• Standards Mode
  (HTML 5: No Quirks Mode)


• Almost Standards Mode
  (HTML 5: "Limited Quirks Mode")


• IE 7 Mode
  ("mostly" a frozen copy of the mode that was the standards mode in IE7)


• XML Mode
  For the application/xhtml+xml Content-Type (not available in Internet
  Explorer)
• Strict doctypes render Standards Mode
• Transitional XHTML doctypes render
  Almost Standards Mode
• Other/No doctypes render Quirks Mode
Activating Browser Modes with Doctype
Semantics
“I have a dream for the Web [in which
computers] become capable of analyzing all
the data on the Web – the content, links, and
transactions between people and
computers.”
                    – Tim Berners-Lee, 1999
• Use meaningful names and elements
• Applies to all code
<table cellspacing="0" cellpadding="0">

 <tr>


 
 <td class="heading">SWDC</td>


 </tr>


 <tr>


 
 <td>Content</td>


 </tr>

</table>
<div class="heading">SWDC</div>

<div class="content">Content</div>
<h1>SWDC</h1>

<p>Content</p>
<h2 class="h3">News</h2>
<h2 class="additional-content">News</h2>
<div class="additional-content">


 <h2>News</h2>

</div>
<div class="left">


 Navigation

</div>

<div class="right">


 Content

</div>
<div class="navigation">


 Navigation

</div>

<div class="main-content">


 Content

</div>
Separating layers
• HTML (content)
• CSS (presentation)
• JavaScript (interaction)
Why separating layers?
• Code maintainability
• Overview
• Structure
• Performance
<div style="color: red">


 Very important

</div>
<div class="important">


 Very important

</div>
Unobtrusive JavaScript
• No JavaScript code in the HTML code
• No inline events on elements
• Progressive enhancement
<a href="javascript:doStuff()">

 Magic
</a>
<a href="#" onclick="doStuff(); return
false">

 Magic
</a>
<a href="stuff.html" onclick="doStuff();
return false">

 Magic
</a>
<a href="stuff.html" class="magic">

 Magic
</a>
window.onload = function () {

 var magic =
getElementsByClassName("magic");

    for (var i=0, l=magic.length; i<l; i++) {

    
   magic.onclick = function () {

    
   
    doStuff();

    
   
    return false;

    
   };

    }
};
JavaScript-dependent elements should be
        generated with JavaScript
var link = document.createElement("a");

link.innerHTML = "Get more content";

link.onclick = function () {


    // JavaScript magic

};

document.body.appendChild(link);
Why it should work
without JavaScript
A little case study of Sony Ericsson
JavaScript available
No JavaScript
<!-- SonyEricsson logo code -->

<div id="selogo" class="floatleft"
onclick="document.location.href='/cws/
home?lc=sv&cc=se';" style="cursor:
pointer;">

 <img src="/cws/images/spacer.gif"
style="height: 30px; width: 155px;"
alt="Sony Ericsson"/>

</div>
JavaScript available
No JavaScript
Google result
Performance
• CSS sprites
• Image optimizing
• gzip
• Expires headers
• ETags
• Deployment configuration
CSS Sprites
• Combine several images into one
• Position through CSS
.save {


 background: url(sprite.png) no-repeat 0 0;

}

.delete {


 background: url(sprite.png) no-repeat 0 -100px;

}

.info {


 background: url(sprite.png) no-repeat 0 -200px;

}
Upload images, get sprite and CSS:

      CSS Sprite Generator
Image optimizing
• Combines many open-source optimizers
• Lossless compression
• Removing superfluous metadata
DN.se
DN.se start page:

Could save 370 kb/unique page load

Has 1 186 730 unique visitors/week


370 * 1 186 730 ≈ 418 GB per week!
smusher
• Commandline through smush.it API
  for whole folders
Smush.it now part of YSlow for Firebug
gzip:
 • Apache: mod_deflate
 • IIS 7: HTTP Compression
# Alternative 1

AddOutputFilterByType DEFLATE text/html text/
plain text/css text/javascript application/x-
javascript


# Alternative 2

SetOutputFilter DEFLATE
DeflateFilterNote ratio
SetEnvIfNoCase Request_URI .(?:gif|jpe?g|PNG)$ 
     no-gzip dont-vary
SetEnvIfNoCase Request_URI 
     .(?:exe|t?gz|zip|bz2|sit|rar)$ 
     no-gzip dont-vary
SetEnvIfNoCase Request_URI .pdf$ no-gzip dont-
vary
Expires headers:
• Apache: mod_expires
• IIS 7: HTTP Expires
# Alternative 1

ExpiresActive   On
ExpiresByType   text/css "access plus 3 days"
ExpiresByType   application/x-javascript "access
plus 3 days"
ExpiresByType   image/gif "access plus 3 days"
ExpiresByType   image/png "access plus 3 days"
ExpiresByType   image/jpeg "access plus 3 days"


# Alternative 2

ExpiresActive On
ExpiresDefault "access plus 3 days
Setting/removing ETags:
• Apache: FileETag     MTime Size
   alternatively FileETag none
• For IIS: Mdutil.exe
JavaScript deployment:
• Concatenating
• Minifying
Concatenating:
•   cat jquery.js base.js > all.js

• Concatenate Text Files using C#
Minifying:
• JSMin
• YUI Compressor
Building Web Applications With Apache Ant
Autokatalogen.se
DN.se
Yahoo!
• Best Practices for Speeding Up
   Your Web Site
Tools
Firebug
YSlow
HTML Validator
Inline Code Finder
Firefinder
Obstacles
Redmond...
Acid2 Test
• 31 October 2005: 
 Safari 2.0.2
• 28 March 2006: 
 
 Konqueror 3.5.2
• 20 June 2006: 

 
 Opera 9.0
• 17 June 2008: 

 
 Mozilla Firefox 3.0
• 19 March 2009: 
 
 Internet Explorer 8
Acid3 Test
•   DOM Level 2 Traversal (subtests 1-6)                   •   Unicode 5.0 UTF-16 (subtest 68)


•   DOM Level 2 Range (subtests 7-11)                      •   Unicode 5.0 UTF-8 (subtest 70)


•   Content-Type: image/png; text/plain (subtest 14, 15)   •   HTML 4.0 Transitional (subtest 71)


•   <object> handling and HTTP status codes (subtest 16)   •   HTML 4.01 Strict


•   DOM Level 2 Core (subtests 17, 21)                     •   SVG 1.1 (subtests 74, 78)


•   DOM Level 2 Events (subtests 17, 30-32)                •   SVG 1.1 Fonts (subtests 77, 79)


•   CSS Selectors (subtests 33-40)                         •   SMIL 2.1 (subtests 75-76)


•   DOM Level 2 Style (subtest 45)                         •   ECMAScript Conformance (subtests 81-96)


•   DOM Level 2 HTML (subtest 60)                          •   Data URI scheme (subtest 97)


•   DOM Level 2 Views                                      •   XHTML 1.0 Strict (subtest 98)


•   ECMAScript GC (subtests 26-27)                         •   HTTP 1.1 Protocol
• Safari                 • Firefox
  
 3.2.3: 

 77/100       
 3.0.10:
 71/100
  
 4 beta: 
 100/100      
 3.5 beta: 
94/100

• Chrome                 • Internet Explorer
  
 1.0: 
 
 79/100        
 8:
 
 
 20/100
  
 2 beta: 
 100/100      
 No beta

• Opera
  
 9.64:
 
 85/100
  
 10 beta: 
 100/100
Doctypes & rendering
Rendering by voting
IE8 and the X-UA-Compatible situation
Multiple IE
Summary
• Web standards
• Semantics
• Separating layers
• Unobtrusive JavaScript
• Performance
Robert Nyman
                                robert@robertnyman.com
                                    robertnyman.com

Images:

          http://www.flickr.com/photos/mringlein/316476217/

          http://blog.tmcnet.com/blog/tom-keating/movabletype/movable-type-vs-wordpress-war-heats-up.asp

          http://www.yardbarker.com/other_sports/articles/LIST_BEST_Players_to_ever_wear_the_number/292924

          http://jimberkin.wordpress.com/2007/09/19/yet-another-reason-i-hate-lawyers/

          http://share-sports.3ds.com/2008/03/31/philippe-fuchs-tunes-workouts-for-better-results-with-heart-rate-variability-monitoring/

          http://hsivonen.iki.fi/doctype/ie8-mode.png

          http://www.stalepopcorn.co.uk/competitions/win-stuff-the-neverending-story-on-dvd/

More Related Content

What's hot

What's hot (20)

Web Development
Web DevelopmentWeb Development
Web Development
 
Web Development with HTML5, CSS3 & JavaScript
Web Development with HTML5, CSS3 & JavaScriptWeb Development with HTML5, CSS3 & JavaScript
Web Development with HTML5, CSS3 & JavaScript
 
Introduction to the Web API
Introduction to the Web APIIntroduction to the Web API
Introduction to the Web API
 
Introduction to angular with a simple but complete project
Introduction to angular with a simple but complete projectIntroduction to angular with a simple but complete project
Introduction to angular with a simple but complete project
 
Reactjs
ReactjsReactjs
Reactjs
 
Express js
Express jsExpress js
Express js
 
Intro to React
Intro to ReactIntro to React
Intro to React
 
ASP.NET MVC Presentation
ASP.NET MVC PresentationASP.NET MVC Presentation
ASP.NET MVC Presentation
 
React Development with the MERN Stack
React Development with the MERN StackReact Development with the MERN Stack
React Development with the MERN Stack
 
React JS - A quick introduction tutorial
React JS - A quick introduction tutorialReact JS - A quick introduction tutorial
React JS - A quick introduction tutorial
 
WEB I - 01 - Introduction to Web Development
WEB I - 01 - Introduction to Web DevelopmentWEB I - 01 - Introduction to Web Development
WEB I - 01 - Introduction to Web Development
 
Web development | Derin Dolen
Web development | Derin Dolen Web development | Derin Dolen
Web development | Derin Dolen
 
Javascript
JavascriptJavascript
Javascript
 
Introduction to Node.js
Introduction to Node.jsIntroduction to Node.js
Introduction to Node.js
 
Web development
Web developmentWeb development
Web development
 
Introduction to CSS3
Introduction to CSS3Introduction to CSS3
Introduction to CSS3
 
What is JavaScript? Edureka
What is JavaScript? EdurekaWhat is JavaScript? Edureka
What is JavaScript? Edureka
 
Web development using javaScript, React js, Node js, HTML, CSS and SQL
Web development using javaScript, React js, Node js, HTML, CSS and SQLWeb development using javaScript, React js, Node js, HTML, CSS and SQL
Web development using javaScript, React js, Node js, HTML, CSS and SQL
 
Web api
Web apiWeb api
Web api
 
Express JS Rest API Tutorial
Express JS Rest API TutorialExpress JS Rest API Tutorial
Express JS Rest API Tutorial
 

Similar to Modern Web Development

Talk Paris Infovis 091207132953 Phpapp01(2)
Talk Paris Infovis 091207132953 Phpapp01(2)Talk Paris Infovis 091207132953 Phpapp01(2)
Talk Paris Infovis 091207132953 Phpapp01(2)
johnnybiz
 
CTU June 2011 - Things that Every ASP.NET Developer Should Know
CTU June 2011 - Things that Every ASP.NET Developer Should KnowCTU June 2011 - Things that Every ASP.NET Developer Should Know
CTU June 2011 - Things that Every ASP.NET Developer Should Know
Spiffy
 
High performance website
High performance websiteHigh performance website
High performance website
Chamnap Chhorn
 

Similar to Modern Web Development (20)

Ease into HTML5 and CSS3
Ease into HTML5 and CSS3Ease into HTML5 and CSS3
Ease into HTML5 and CSS3
 
Html5 more than just html5 v final
Html5  more than just html5 v finalHtml5  more than just html5 v final
Html5 more than just html5 v final
 
Break out of The Box - Part 2
Break out of The Box - Part 2Break out of The Box - Part 2
Break out of The Box - Part 2
 
HTML5 History & Features
HTML5 History & FeaturesHTML5 History & Features
HTML5 History & Features
 
Using Web Standards to create Interactive Data Visualizations for the Web
Using Web Standards to create Interactive Data Visualizations for the WebUsing Web Standards to create Interactive Data Visualizations for the Web
Using Web Standards to create Interactive Data Visualizations for the Web
 
Talk Paris Infovis 091207132953 Phpapp01(2)
Talk Paris Infovis 091207132953 Phpapp01(2)Talk Paris Infovis 091207132953 Phpapp01(2)
Talk Paris Infovis 091207132953 Phpapp01(2)
 
Intro JavaScript
Intro JavaScriptIntro JavaScript
Intro JavaScript
 
Html forfood
Html forfoodHtml forfood
Html forfood
 
CTU June 2011 - Things that Every ASP.NET Developer Should Know
CTU June 2011 - Things that Every ASP.NET Developer Should KnowCTU June 2011 - Things that Every ASP.NET Developer Should Know
CTU June 2011 - Things that Every ASP.NET Developer Should Know
 
HTML5: An Overview
HTML5: An OverviewHTML5: An Overview
HTML5: An Overview
 
Html5 n css3
Html5 n css3Html5 n css3
Html5 n css3
 
Internet Explorer 8
Internet Explorer 8Internet Explorer 8
Internet Explorer 8
 
Generating the Server Response: HTTP Status Codes
Generating the Server Response: HTTP Status CodesGenerating the Server Response: HTTP Status Codes
Generating the Server Response: HTTP Status Codes
 
C# Advanced L09-HTML5+ASP
C# Advanced L09-HTML5+ASPC# Advanced L09-HTML5+ASP
C# Advanced L09-HTML5+ASP
 
Intro to .NET for Government Developers
Intro to .NET for Government DevelopersIntro to .NET for Government Developers
Intro to .NET for Government Developers
 
performance.ppt
performance.pptperformance.ppt
performance.ppt
 
High performance website
High performance websiteHigh performance website
High performance website
 
Rapid development with Rails
Rapid development with RailsRapid development with Rails
Rapid development with Rails
 
Performance (browser)
Performance (browser)Performance (browser)
Performance (browser)
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
 

More from Robert Nyman

More from Robert Nyman (20)

Have you tried listening?
Have you tried listening?Have you tried listening?
Have you tried listening?
 
Building for Your Next Billion - Google I/O 2017
Building for Your Next Billion - Google I/O 2017Building for Your Next Billion - Google I/O 2017
Building for Your Next Billion - Google I/O 2017
 
Introduction to Google Daydream
Introduction to Google DaydreamIntroduction to Google Daydream
Introduction to Google Daydream
 
Predictability for the Web
Predictability for the WebPredictability for the Web
Predictability for the Web
 
The Future of Progressive Web Apps - View Source conference, Berlin 2016
The Future of Progressive Web Apps - View Source conference, Berlin 2016The Future of Progressive Web Apps - View Source conference, Berlin 2016
The Future of Progressive Web Apps - View Source conference, Berlin 2016
 
The Future of the Web - Cold Front conference 2016
The Future of the Web - Cold Front conference 2016The Future of the Web - Cold Front conference 2016
The Future of the Web - Cold Front conference 2016
 
The Future of Progressive Web Apps - Google for Indonesia
The Future of Progressive Web Apps - Google for IndonesiaThe Future of Progressive Web Apps - Google for Indonesia
The Future of Progressive Web Apps - Google for Indonesia
 
Google tech & products
Google tech & productsGoogle tech & products
Google tech & products
 
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
Introduction to Progressive Web Apps, Google Developer Summit, Seoul - South ...
 
Progressive Web Apps keynote, Google Developer Summit, Tokyo, Japan
Progressive Web Apps keynote, Google Developer Summit, Tokyo, JapanProgressive Web Apps keynote, Google Developer Summit, Tokyo, Japan
Progressive Web Apps keynote, Google Developer Summit, Tokyo, Japan
 
The web - What it has, what it lacks and where it must go - keynote at Riga D...
The web - What it has, what it lacks and where it must go - keynote at Riga D...The web - What it has, what it lacks and where it must go - keynote at Riga D...
The web - What it has, what it lacks and where it must go - keynote at Riga D...
 
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
The web - What it has, what it lacks and where it must go - Bulgaria Web Summ...
 
The web - What it has, what it lacks and where it must go - Istanbul
The web - What it has, what it lacks and where it must go - IstanbulThe web - What it has, what it lacks and where it must go - Istanbul
The web - What it has, what it lacks and where it must go - Istanbul
 
The web - What it has, what it lacks and where it must go
The web - What it has, what it lacks and where it must goThe web - What it has, what it lacks and where it must go
The web - What it has, what it lacks and where it must go
 
Google, the future and possibilities
Google, the future and possibilitiesGoogle, the future and possibilities
Google, the future and possibilities
 
Developer Relations in the Nordics
Developer Relations in the NordicsDeveloper Relations in the Nordics
Developer Relations in the Nordics
 
What is Developer Relations?
What is Developer Relations?What is Developer Relations?
What is Developer Relations?
 
Android TV Introduction - Stockholm Android TV meetup
Android TV Introduction - Stockholm Android TV meetupAndroid TV Introduction - Stockholm Android TV meetup
Android TV Introduction - Stockholm Android TV meetup
 
New improvements for web developers - frontend.fi, Helsinki
New improvements for web developers - frontend.fi, HelsinkiNew improvements for web developers - frontend.fi, Helsinki
New improvements for web developers - frontend.fi, Helsinki
 
Mobile phone trends, user data & developer climate - frontend.fi, Helsinki
Mobile phone trends, user data & developer climate - frontend.fi, HelsinkiMobile phone trends, user data & developer climate - frontend.fi, Helsinki
Mobile phone trends, user data & developer climate - frontend.fi, Helsinki
 

Recently uploaded

Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Peter Udo Diehl
 

Recently uploaded (20)

Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdfLinux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
Linux Foundation Edge _ Overview of FDO Software Components _ Randy at Intel.pdf
 
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
Behind the Scenes From the Manager's Chair: Decoding the Secrets of Successfu...
 
Intro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджераIntro in Product Management - Коротко про професію продакт менеджера
Intro in Product Management - Коротко про професію продакт менеджера
 
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdfSimplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
Simplified FDO Manufacturing Flow with TPMs _ Liam at Infineon.pdf
 
Strategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering TeamsStrategic AI Integration in Engineering Teams
Strategic AI Integration in Engineering Teams
 
Demystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John StaveleyDemystifying gRPC in .Net by John Staveley
Demystifying gRPC in .Net by John Staveley
 
Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024Top 10 Symfony Development Companies 2024
Top 10 Symfony Development Companies 2024
 
Oauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoftOauth 2.0 Introduction and Flows with MuleSoft
Oauth 2.0 Introduction and Flows with MuleSoft
 
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo DiehlFuture Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
Future Visions: Predictions to Guide and Time Tech Innovation, Peter Udo Diehl
 
IESVE for Early Stage Design and Planning
IESVE for Early Stage Design and PlanningIESVE for Early Stage Design and Planning
IESVE for Early Stage Design and Planning
 
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptxWSO2CONMay2024OpenSourceConferenceDebrief.pptx
WSO2CONMay2024OpenSourceConferenceDebrief.pptx
 
Optimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through ObservabilityOptimizing NoSQL Performance Through Observability
Optimizing NoSQL Performance Through Observability
 
AI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří KarpíšekAI revolution and Salesforce, Jiří Karpíšek
AI revolution and Salesforce, Jiří Karpíšek
 
PLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. StartupsPLAI - Acceleration Program for Generative A.I. Startups
PLAI - Acceleration Program for Generative A.I. Startups
 
Google I/O Extended 2024 Warsaw
Google I/O Extended 2024 WarsawGoogle I/O Extended 2024 Warsaw
Google I/O Extended 2024 Warsaw
 
How we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdfHow we scaled to 80K users by doing nothing!.pdf
How we scaled to 80K users by doing nothing!.pdf
 
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya HalderCustom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
Custom Approval Process: A New Perspective, Pavel Hrbacek & Anindya Halder
 
Designing for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at ComcastDesigning for Hardware Accessibility at Comcast
Designing for Hardware Accessibility at Comcast
 
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
Choosing the Right FDO Deployment Model for Your Application _ Geoffrey at In...
 
What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024What's New in Teams Calling, Meetings and Devices April 2024
What's New in Teams Calling, Meetings and Devices April 2024
 

Modern Web Development