Slide 1

Slide 1 text

Rails vs. The Client Noel Rappin Table XI @noelrap Wednesday, May 1, 13

Slide 2

Slide 2 text

Here's my problem: Wednesday, May 1, 13

Slide 3

Slide 3 text

I want my users to have a "rich client experience" Wednesday, May 1, 13

Slide 4

Slide 4 text

@dhh: "If it's document based, structure it like Basecamp" Wednesday, May 1, 13

Slide 5

Slide 5 text

1. Key based cache expiration 2. Russian doll nested caching 3. JavaScript decoration of shared caches 4. Turbolinks 5. Polling for JS Updates Wednesday, May 1, 13

Slide 6

Slide 6 text

@wycats: "Rails makes a great API serving JSON to a browser" Wednesday, May 1, 13

Slide 7

Slide 7 text

The locus of innovation is in the client Wednesday, May 1, 13

Slide 8

Slide 8 text

Build HTML in the browser using HTML Avoid ad-hoc JavaScript Avoid Backbone Stop hiding from JavaScript Wednesday, May 1, 13

Slide 9

Slide 9 text

Wednesday, May 1, 13

Slide 10

Slide 10 text

@noelrap: "I just want to write my e- commerce site" Wednesday, May 1, 13

Slide 11

Slide 11 text

Traditional Rails App Ember App Hybrid JS App Traditional Rails + Backbone Wednesday, May 1, 13

Slide 12

Slide 12 text

http://imgs.xkcd.com/comics/duty_calls.png User Data Stuff Wednesday, May 1, 13

Slide 13

Slide 13 text

http://imgs.xkcd.com/comics/duty_calls.png User Data Client Stuff Server Stuff Wednesday, May 1, 13

Slide 14

Slide 14 text

http://imgs.xkcd.com/comics/duty_calls.png User Data Client Stuff Server Stuff Wednesday, May 1, 13

Slide 15

Slide 15 text

http://imgs.xkcd.com/comics/duty_calls.png User Data Client Stuff Server Stuff Wednesday, May 1, 13

Slide 16

Slide 16 text

http://imgs.xkcd.com/comics/duty_calls.png User Data Client Stuff Server Stuff JS Ruby Wednesday, May 1, 13

Slide 17

Slide 17 text

Avoiding JavaScript Wednesday, May 1, 13

Slide 18

Slide 18 text

Avoiding Complex MVC Structures Wednesday, May 1, 13

Slide 19

Slide 19 text

Where does the heart of your application live? Wednesday, May 1, 13

Slide 20

Slide 20 text

Wednesday, May 1, 13

Slide 21

Slide 21 text

But it's still a fraught question... Wednesday, May 1, 13

Slide 22

Slide 22 text

Wednesday, May 1, 13

Slide 23

Slide 23 text

Wednesday, May 1, 13

Slide 24

Slide 24 text

Wednesday, May 1, 13

Slide 25

Slide 25 text

Do we even need Rails? Wednesday, May 1, 13

Slide 26

Slide 26 text

rails::api Wednesday, May 1, 13

Slide 27

Slide 27 text

logging params parsing reloading security sessions sending files thread safety caching cookies url writing redirection renderers callbacks active record layouts Wednesday, May 1, 13

Slide 28

Slide 28 text

Complexity Wednesday, May 1, 13

Slide 29

Slide 29 text

You can make things more complex, you can't make them less complex Wednesday, May 1, 13

Slide 30

Slide 30 text

How can you best manage complexity? Wednesday, May 1, 13

Slide 31

Slide 31 text

Simplicity is being able to deal with components separately Wednesday, May 1, 13

Slide 32

Slide 32 text

Simplicity is using simple structures Wednesday, May 1, 13

Slide 33

Slide 33 text

Simplicity is consistency Wednesday, May 1, 13

Slide 34

Slide 34 text

Server-side uses simpler JavaScript structures Wednesday, May 1, 13

Slide 35

Slide 35 text

Server side has three distinct output modes Wednesday, May 1, 13

Slide 36

Slide 36 text

HTML JavaScript JSON Wednesday, May 1, 13

Slide 37

Slide 37 text

Client side has generally one mode of interaction Wednesday, May 1, 13

Slide 38

Slide 38 text

But, business logic can be duplicated Wednesday, May 1, 13

Slide 39

Slide 39 text

It's not clear that one side or the other requires less code Wednesday, May 1, 13

Slide 40

Slide 40 text

Speed Wednesday, May 1, 13

Slide 41

Slide 41 text

Both sides claim speed Wednesday, May 1, 13

Slide 42

Slide 42 text

Server side interaction is proportional to user clicks Wednesday, May 1, 13

Slide 43

Slide 43 text

Client side interaction is proportional to new data requirements Wednesday, May 1, 13

Slide 44

Slide 44 text

Optimized for... Wednesday, May 1, 13

Slide 45

Slide 45 text

Server style is optimized for least disruption to Rails Wednesday, May 1, 13

Slide 46

Slide 46 text

Client style is optimized for simplicity of Server logic Wednesday, May 1, 13

Slide 47

Slide 47 text

Questions To Ask Wednesday, May 1, 13

Slide 48

Slide 48 text

Is the representation of your data stable? Wednesday, May 1, 13

Slide 49

Slide 49 text

Is interaction with the server primarily notification? Wednesday, May 1, 13

Slide 50

Slide 50 text

Do client components interact? Wednesday, May 1, 13

Slide 51

Slide 51 text

What do you already have? Wednesday, May 1, 13

Slide 52

Slide 52 text

Will a hybrid approach work? Wednesday, May 1, 13

Slide 53

Slide 53 text

Takeaways Wednesday, May 1, 13

Slide 54

Slide 54 text

There's no excuse for re- downloading assets Wednesday, May 1, 13

Slide 55

Slide 55 text

It'd help if the JS frameworks were more polished Wednesday, May 1, 13

Slide 56

Slide 56 text

http://www.noelrappin.com @noelrap RAILSCONF25 http://www.tablexi.com http://www.tablexi.com/blog/category/xi-to-eye/ http://www.devpressed.com @tablexi Wednesday, May 1, 13