Web Development: Youre (Still) Doing it Wrong Stefan Tilkov | innoQ - - PowerPoint PPT Presentation

web development you re still doing it wrong
SMART_READER_LITE
LIVE PREVIEW

Web Development: Youre (Still) Doing it Wrong Stefan Tilkov | innoQ - - PowerPoint PPT Presentation

Web Development: Youre (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


slide-1
SLIDE 1

Web Development: You’re (Still) Doing it Wrong

Stefan Tilkov | innoQ | @stilkov

Thursday 17 October 13

slide-2
SLIDE 2

Annoying your users

Thursday 17 October 13

slide-3
SLIDE 3

Forbid the use of the back and forward buttons

Thursday 17 October 13

slide-4
SLIDE 4

Send them to the home page when they hit “refresh”

Thursday 17 October 13

slide-5
SLIDE 5

… or ensure the browser pops up a warning window

Thursday 17 October 13

slide-6
SLIDE 6

Make sure they can’t open a second browser window

Thursday 17 October 13

slide-7
SLIDE 7

Let them see UI chrome and ads fjrst, content last

Thursday 17 October 13

slide-8
SLIDE 8

Make sure they can’t bookmark or send a link

Thursday 17 October 13

slide-9
SLIDE 9

Don’t let Google index anything

Thursday 17 October 13

slide-10
SLIDE 10

Ensure disabling JavaScript gives them a blank page

Thursday 17 October 13

slide-11
SLIDE 11

Things that seem like a good idea, but aren’t

Thursday 17 October 13

slide-12
SLIDE 12

Fix HTTP’s basic flaw: its statelessness

Thursday 17 October 13

slide-13
SLIDE 13

Go beyond the page model because we’re r/w now

Thursday 17 October 13

slide-14
SLIDE 14

Avoid CSS because who understands how it works?

Thursday 17 October 13

slide-15
SLIDE 15

Avoid HTML because that’s so 20th century

Thursday 17 October 13

slide-16
SLIDE 16

Avoid JavaScript because it’s not for real programmers

Thursday 17 October 13

slide-17
SLIDE 17

Go beyond Client/Server and introduce bidirectional, binary communication

Thursday 17 October 13

slide-18
SLIDE 18

Let’s take a step back

Thursday 17 October 13

slide-19
SLIDE 19

Let’s build a generic client runtime Defjne a protocol so it can work with any server Allow it to mix services from difgerent backends Defjne 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

slide-20
SLIDE 20

We’re not done yet

Thursday 17 October 13

slide-21
SLIDE 21

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

slide-22
SLIDE 22

How hard can it be?

Thursday 17 October 13

slide-23
SLIDE 23

Competing with the Web may not be the best idea

Thursday 17 October 13

slide-24
SLIDE 24

My personal theory as to why things suck so much:

Thursday 17 October 13

slide-25
SLIDE 25
  • 1. Hiding “Details”

Thursday 17 October 13

slide-26
SLIDE 26
  • 2. Preserving Expertise

Thursday 17 October 13

slide-27
SLIDE 27
  • 3. Misjudging Skills

Thursday 17 October 13

slide-28
SLIDE 28

Web-centric web UIs

Thursday 17 October 13

slide-29
SLIDE 29

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

slide-30
SLIDE 30

ROCA

(Resource-oriented Client Architecture)

Thursday 17 October 13

slide-31
SLIDE 31

Make your HTML semantic

Thursday 17 October 13

slide-32
SLIDE 32

CSS HTML Content Layout

Thursday 17 October 13

slide-33
SLIDE 33

Minimal load times Accessibility Self-descriptiveness Readability

Thursday 17 October 13

slide-34
SLIDE 34

“HTML?” “I don’t do that – I’m a programmer.”

Thursday 17 October 13

slide-35
SLIDE 35

<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

slide-36
SLIDE 36

<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

slide-37
SLIDE 37

Data Data Access Business Rules Service Logic Service Interface

WSDL SOAP WS-* XML

Operations Parameters Messages

HTTP JSON XML

Resources Hypermedia Representations

Thursday 17 October 13

slide-38
SLIDE 38

Service Interface Service Interface Client Logic

Thursday 17 October 13

slide-39
SLIDE 39

Service Interface Service Interface Client Logic

Thursday 17 October 13

slide-40
SLIDE 40

Service Interface Service Interface Client Logic

Thursday 17 October 13

slide-41
SLIDE 41

Service Interface Service Interface Presentation Logic Orchestration Logic

Thursday 17 October 13

slide-42
SLIDE 42

Orchestration Logic Orchestration Logic Presentation Logic

Thursday 17 October 13

slide-43
SLIDE 43

Business Logic Business Logic Presentation Logic

Thursday 17 October 13

slide-44
SLIDE 44

Use Javascript unobtrusively

Thursday 17 October 13

slide-45
SLIDE 45

<a href="javascript:doSomething();"> Some Link </a>

Thursday 17 October 13

slide-46
SLIDE 46

<a href="#"

  • nclick="doSomething();">

Some Link </a>

Thursday 17 October 13

slide-47
SLIDE 47

<a href="/some-resource"

  • nclick="doSomething(this.href);">

Some Link </a>

Thursday 17 October 13

slide-48
SLIDE 48

<a href="/some-resource" class="whatever"> Some Link </a>

Thursday 17 October 13

slide-49
SLIDE 49

$("a.whatever").click(function() { doSomething(this.href); });

+

<a href="/some-resource" class="whatever"> Some Link </a>

Thursday 17 October 13

slide-50
SLIDE 50

<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

slide-51
SLIDE 51

Thursday 17 October 13

slide-52
SLIDE 52

$('.multiselect', context).each(function() { $(this).multiselect({ selectedList: 2, checkAllText: "Alle", uncheckAllText: "Keinen" }).multiselectfilter({label:"", width:"200px"}); }); <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>

Thursday 17 October 13

slide-53
SLIDE 53

CSS HTML Content Layout

Thursday 17 October 13

slide-54
SLIDE 54

JavaScript CSS HTML Content Behavior Layout

Thursday 17 October 13

slide-55
SLIDE 55

JS component JS glue code HTML

Events Methods

Component 2 Component 3 ... Layout/CSS

styles styles

Server / Backend

Ajax

initializes Base Markup responds with

Thursday 17 October 13

slide-56
SLIDE 56

Or: Just go the SPA way …

Thursday 17 October 13

slide-57
SLIDE 57

Application Browser Google GET / application/json Filter GET / text/html text/html GET / application/json JS-to-HTML

Thursday 17 October 13

slide-58
SLIDE 58

Thursday 17 October 13

slide-59
SLIDE 59

Use URIs to identify a single meaningful concept

Thursday 17 October 13

slide-60
SLIDE 60

A

http:/ /.../A

Thursday 17 October 13

slide-61
SLIDE 61

A B C

http:/ /.../A

?

Thursday 17 October 13

slide-62
SLIDE 62

A

http:/ /.../A

C

http:/ /.../C

B

http:/ /.../B

b c

+ AJAX + CSS

Thursday 17 October 13

slide-63
SLIDE 63

A B C

http:/ /.../A

Thursday 17 October 13

slide-64
SLIDE 64

Don’t disable Browser Features – use them

Thursday 17 October 13

slide-65
SLIDE 65

Multiple tabs & windows Bookmarks Back/Forward/Refresh Personalization Menus

Thursday 17 October 13

slide-66
SLIDE 66

ROCA

http:/ /roca-style.org/

Thursday 17 October 13

slide-67
SLIDE 67

Now get serious, please. When to use what?

Thursday 17 October 13

slide-68
SLIDE 68

Pure JavaScript Programming Model Server-side data API “Closed”, desktop-style app Browser as portable runtime platform Ofgline capability

Single Page Apps: Good reasons

Thursday 17 October 13

slide-69
SLIDE 69

“That’s how you do it in 2013” “Progressive enhancement is dead” Required for modern, interactive UIs

Single Page Apps: Bad reasons

Thursday 17 October 13

slide-70
SLIDE 70

RESTfulness Accessibility

ROCA: Bad reasons

Thursday 17 October 13

slide-71
SLIDE 71

Use of browser features General web affjnity Separation of concerns Front-end integration Technology independence SEO

ROCA: Good reasons

Thursday 17 October 13

slide-72
SLIDE 72

In summary …

Thursday 17 October 13

slide-73
SLIDE 73

Not everything new is good, not everything old is bad. (Surprise.)

Thursday 17 October 13

slide-74
SLIDE 74

Don’t repeat the mistakes we used to make on the server

  • n the client.

Thursday 17 October 13

slide-75
SLIDE 75

Learning details of how the web works might be time well spent.

Thursday 17 October 13

slide-76
SLIDE 76

Working with the web is a lot easier than fjghting it.

Thursday 17 October 13

slide-77
SLIDE 77

Q&A

Stefan Tilkov, @stilkov stefan.tilkov@innoq.com Phone: +49 170 471 2625

innoQ Deutschland GmbH

  • Krischerstr. 100

40789 Monheim am Rhein Germany Phone: +49 2173 3366-0

innoQ Schweiz GmbH info@innoq.com

  • Gewerbestr. 11

CH-6330 Cham Switzerland Phone: +41 41 743 0116

www.innoq.com

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

Thursday 17 October 13