slides

Transcription

slides
Web Development:
You’re (Still) Doing it Wrong
Stefan Tilkov | innoQ | @stilkov
Thursday 17 October 13
Annoying your users
Thursday 17 October 13
Forbid the use of the back
and forward buttons
Thursday 17 October 13
Send them to the home page
when they hit “refresh”
Thursday 17 October 13
… or ensure the browser
pops up a warning window
Thursday 17 October 13
Make sure they can’t open a
second browser window
Thursday 17 October 13
Let them see UI chrome and
ads first, content last
Thursday 17 October 13
Make sure they can’t
bookmark or send a link
Thursday 17 October 13
Don’t let Google index
anything
Thursday 17 October 13
Ensure disabling JavaScript
gives them a blank page
Thursday 17 October 13
Things that seem like a good
idea, but aren’t
Thursday 17 October 13
Fix HTTP’s basic flaw: its
statelessness
Thursday 17 October 13
Go beyond the page model
because we’re r/w now
Thursday 17 October 13
Avoid CSS because who
understands how it works?
Thursday 17 October 13
Avoid HTML because that’s
so 20th century
Thursday 17 October 13
Avoid JavaScript because it’s
not for real programmers
Thursday 17 October 13
Go beyond Client/Server and
introduce bidirectional,
binary communication
Thursday 17 October 13
Let’s take a step back
Thursday 17 October 13
Let’s build a generic client runtime
Define a protocol so it can work with any server
Allow it to mix services from different backends
Define a generic, declarative data format
Separate content and layout
Allow for extensibility with client-side scripting
Make it work on any device, with any resolution
Thursday 17 October 13
We’re not done yet
Thursday 17 October 13
Standardize it, with (rough) consensus
Ensure there are multiple client, server and
intermediary implementations to choose from
Have every client OS ship with an implementation of
the generic client
Let every programming environment support it
Thursday 17 October 13
How hard can it be?
Thursday 17 October 13
Competing with the Web may
not be the best idea
Thursday 17 October 13
My personal theory as to
why things suck so much:
Thursday 17 October 13
1. Hiding “Details”
Thursday 17 October 13
2. Preserving Expertise
Thursday 17 October 13
3. Misjudging Skills
Thursday 17 October 13
Web-centric web UIs
Thursday 17 October 13
Server-side
components
Avoid HTML, JS, CSS
Trade Familiarity for Complexity
Session-centric
ROCA
Server-side POSH
Client-side components
Web-centric
Single Page
Apps
Advanced Client Frameworks
Server-side REST APIs
Thursday 17 October 13
ROCA
(Resource-oriented Client Architecture)
Thursday 17 October 13
Make your HTML semantic
Thursday 17 October 13
Content
HTML
Thursday 17 October 13
Layout
CSS
Minimal load times
Accessibility
Self-descriptiveness
Readability
Thursday 17 October 13
“HTML?”
“I don’t do that –
I’m a programmer.”
Thursday 17 October 13
<order>
<shippingAddress>Paris, France</shippingAddress>
<items>
<item>
<productDescription>iPad</productDescription>
<quantity>1</quantity>
<price>699</price>
</item>
</items>
<link href="http://om.example.com/cancellations"
rel="cancel" />
<link href="https://om.example.com/orders/123/payment"
rel="payment" />
</order>
Thursday 17 October 13
<html xmlns="http://www.w3.org/1999/xhtml">
<body>
<div class="order">
<p class="shippingAddress">Paris, France</p>
<ul class="items">
<li class="item">
<p class="productDescription">iPad</p>
<p class="quantity">1</p>
<p class="price">699</p>
</li>
</ul>
<a href="http://om.example.com/cancellations"
rel="cancel">cancel</a>
<a href="https://om.example.com/orders/123/payment"
rel="payment">payment</a>
</div>
</body>
</html>
Thursday 17 October 13
Operations
WSDL
WS-* XML
SOAP
Service Interface
Service Logic
Parameters
Messages
Business Rules
Data Access
Data
Resources
HTTP
JSON
XML
Hypermedia
Representations
Thursday 17 October 13
Client Logic
Service Interface
Thursday 17 October 13
Service Interface
Client Logic
Service Interface
Thursday 17 October 13
Service Interface
Client Logic
Service Interface
Thursday 17 October 13
Service Interface
Presentation Logic
Orchestration Logic
Service Interface
Thursday 17 October 13
Service Interface
Presentation Logic
Orchestration Logic
Thursday 17 October 13
Orchestration Logic
Presentation Logic
Business Logic
Thursday 17 October 13
Business Logic
Use Javascript unobtrusively
Thursday 17 October 13
<a href="javascript:doSomething();">
Some Link
</a>
Thursday 17 October 13
<a href="#"
onclick="doSomething();">
Some Link
</a>
Thursday 17 October 13
<a href="/some-resource"
onclick="doSomething(this.href);">
Some Link
</a>
Thursday 17 October 13
<a href="/some-resource"
class="whatever">
Some Link
</a>
Thursday 17 October 13
<a href="/some-resource"
class="whatever">
Some Link
</a>
+
$("a.whatever").click(function() {
doSomething(this.href);
});
Thursday 17 October 13
<div id="tabs">
<ul>
<li><a href="#tabs-1">Nunc tincidunt</a></li>
<li><a href="#tabs-2">Proin dolor</a></li>
<li><a href="#tabs-3">Aenean lacinia</a></li>
</ul>
<div id="tabs-1">
<p>Proin elit arcu, rutrum commodo, vehicula ...</p>
</div>
<div id="tabs-2">
<p>Morbi tincidunt, dui sit amet facilisis feugiat, odio ...</p>
</div>
<div id="tabs-3">
<p>Mauris eleifend est et turpis. Duis id erat ...</p>
</div>
+
$("#tabs").tabs();
Thursday 17 October 13
Thursday 17 October 13
<div class="filter-column">
<label for="project">Project</label>
<select class="multiselect" id="project"
name="project" size="5" multiple>
<option>DISCOVER</option>
<option>IMPROVE</option>
<option >MAGENTA</option>
<option>ROCA</option>
<option>ROCKET</option>
</select>
</div>
$('.multiselect', context).each(function() {
$(this).multiselect({
selectedList: 2,
checkAllText: "Alle",
uncheckAllText: "Keinen"
}).multiselectfilter({label:"",
width:"200px"});
});
Thursday 17 October 13
Content
HTML
Thursday 17 October 13
Layout
CSS
Content
HTML
Layout
CSS
Behavior
JavaScript
Thursday 17 October 13
Server / Backend
responds
with
styles
Base
Markup
Layout/CSS
HTML
Ajax
initializes
styles
JS component
Methods
Events
JS glue code
Component 2
Thursday 17 October 13
Component 3
...
Or: Just go the SPA way …
Thursday 17 October 13
Browser
GET /
application/json
Filter
Application
GET /
Google
text/html
GET /
text/html
JS-to-HTML
Thursday 17 October 13
application/json
Thursday 17 October 13
Use URIs to identify a single
meaningful concept
Thursday 17 October 13
http://.../A
A
Thursday 17 October 13
http://.../A
B
A
Thursday 17 October 13
C
?
http://.../B
http://.../A
B
A
b
C
c
+ AJAX + CSS
Thursday 17 October 13
http://.../C
http://.../A
B
A
Thursday 17 October 13
C
Don’t disable Browser
Features – use them
Thursday 17 October 13
Multiple tabs & windows
Bookmarks
Back/Forward/Refresh
Personalization
Menus
Thursday 17 October 13
ROCA
http://roca-style.org/
Thursday 17 October 13
Now get serious, please.
When to use what?
Thursday 17 October 13
Single Page Apps: Good reasons
Pure JavaScript Programming Model
Server-side data API
“Closed”, desktop-style app
Browser as portable runtime platform
Offline capability
Thursday 17 October 13
Single Page Apps: Bad reasons
“That’s how you do it in 2013”
“Progressive enhancement is dead”
Required for modern, interactive UIs
Thursday 17 October 13
ROCA: Bad reasons
RESTfulness
Accessibility
Thursday 17 October 13
ROCA: Good reasons
Use of browser features
General web affinity
Separation of concerns
Front-end integration
Technology independence
SEO
Thursday 17 October 13
In summary …
Thursday 17 October 13
Not everything new is good,
not everything old is bad.
(Surprise.)
Thursday 17 October 13
Don’t repeat the mistakes we
used to make on the server
on the client.
Thursday 17 October 13
Learning details of how the
web works might be time
well spent.
Thursday 17 October 13
Working with the web is a lot
easier than fighting it.
Thursday 17 October 13
Q&A
Stefan Tilkov, @stilkov
[email protected]
Phone: +49 170 471 2625
www.innoq.com
innoQ Deutschland GmbH
Krischerstr. 100
40789 Monheim am Rhein
Germany
Phone: +49 2173 3366-0
Ohlauer Straße 43
10999 Berlin
Germany
Phone: +49 2173 3366-0
Robert-Bosch-Straße 7
Germany
Phone: +49 2173 3366-0
Radlkoferstraße 2
D-81373 München
Telefon +49 (0) 89 741185-270
innoQ Schweiz GmbH
Gewerbestr. 11
CH-6330 Cham
Switzerland
Phone: +41 41 743 0116
[email protected]
Thursday 17 October 13

Similar documents