Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
The Future of Rails - Take 2
Search
Ryan Bigg
May 10, 2018
Programming
0
96
The Future of Rails - Take 2
The 2nd version of my talk on the Future of Rails. A more streamlined version.
Ryan Bigg
May 10, 2018
Tweet
Share
More Decks by Ryan Bigg
See All by Ryan Bigg
Hiring Juniors - RubyConf Indonesia 2019 Closing Keynote
radar
1
380
Web Directions - Code Leaders - Hiring Juniors
radar
0
530
The Future of Rails
radar
1
100
Exploding Rails
radar
9
1.8k
Hiring Juniors
radar
2
410
The Perfect Coding Test
radar
0
110
Your First Developer Job
radar
1
110
Hiring Juniors
radar
2
270
Rails Pacific - Multitenancy with Rails
radar
0
240
Other Decks in Programming
See All in Programming
各クラウドサービスにおける.NETの対応と見解
ymd65536
0
250
ATDDで素早く安定した デリバリを実現しよう!
tonnsama
1
1.8k
DMMオンラインサロンアプリのSwift化
hayatan
0
170
Lookerは可視化だけじゃない。UIコンポーネントもあるんだ!
ymd65536
1
130
BEエンジニアがFEの業務をできるようになるまでにやったこと
yoshida_ryushin
0
190
快速入門可觀測性
blueswen
0
500
知られざるDMMデータエンジニアの生態 〜かつてツチノコと呼ばれし者〜
takaha4k
1
290
生成AIでGitHubソースコード取得して仕様書を作成
shukob
0
630
Findy Team+ Awardを受賞したかった!ベストプラクティス応募内容をふりかえり、開発生産性向上もふりかえる / Findy Team Plus Award BestPractice and DPE Retrospective 2024
honyanya
0
140
カンファレンス動画鑑賞会のススメ / Osaka.swift #1
hironytic
0
170
EC2からECSへ 念願のコンテナ移行と巨大レガシーPHPアプリケーションの再構築
sumiyae
3
580
歴史と現在から考えるスケーラブルなソフトウェア開発のプラクティス
i10416
0
300
Featured
See All Featured
Dealing with People You Can't Stand - Big Design 2015
cassininazir
365
25k
No one is an island. Learnings from fostering a developers community.
thoeni
19
3.1k
Producing Creativity
orderedlist
PRO
343
39k
Large-scale JavaScript Application Architecture
addyosmani
510
110k
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Automating Front-end Workflow
addyosmani
1366
200k
Designing on Purpose - Digital PM Summit 2013
jponch
116
7.1k
The Myth of the Modular Monolith - Day 2 Keynote - Rails World 2024
eileencodes
19
2.3k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
29
960
Agile that works and the tools we love
rasmusluckow
328
21k
Statistics for Hackers
jakevdp
797
220k
Designing for humans not robots
tammielis
250
25k
Transcript
Mentor / Author / Developer
FUTURE PREDICTIONS ARE OFTEN WRONG
ISN’T RAILS THE FUTURE OF RAILS AS YOU KNOW IT
TODAY
TO KNOW THE FUTURE LOOK TO THE PAST
APIs
APPLICATION PROGRAMMING INTERFACE
APIs ARE HOW PROGRAMS TALK TO EACH OTHER
Your App API Third Party App
APIs ARE AN AGREED CONTRACT
Your App Third Party App API “Can you give me
data about employees?”
API “Sure, here’s my data” Third Party App Your App
SOAP
“Please send me all your employee data” In the past…
(1998) SOAP APIs
<?xml version='1.0' encoding='UTF-8'?> <S:Envelope xmlns:S="http:// schemas.xmlsoap.org/soap/ envelope/"> <S:Body> <GetEmployeeData />
</S:Body> </S:Envelope> In the past… (1998) SOAP APIs
--uuid:1fe211a2-9207-4981-b1ba-95c51dc9dadd Content-Type: text/xml <?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http:// schemas.xmlsoap.org/soap/envelope/"><S:Body /></S:Envelope> --uuid:1fe211a2-9207-4981-b1ba-95c51dc9dadd
Content-Id:<
[email protected]
> Content-Type: application/octet-stream Content-Transfer-Encoding: binary "User/Employee ID","First Name","Employment Details Hire Date","Username","Division","Company Country","Location","Department","Cost Center","Team","Supervisor","Manager User Sys ID","Contract Type","Gender" --uuid:1fe211a2-9207-4981-b1ba-95c51dc9dadd-- In the past… (1998) SOAP APIs
--uuid:1fe211a2-9207-4981-b1ba-95c51dc9dadd Content-Type: text/xml <?xml version='1.0' encoding='UTF-8'?><S:Envelope xmlns:S="http:// schemas.xmlsoap.org/soap/envelope/"><S:Body /></S:Envelope> --uuid:1fe211a2-9207-4981-b1ba-95c51dc9dadd
Content-Id:<
[email protected]
> Content-Type: application/octet-stream Content-Transfer-Encoding: binary "User/Employee ID","First Name","Employment Details Hire Date","Username","Division","Company Country","Location","Department","Cost Center","Team","Supervisor","Manager User Sys ID","Contract Type","Gender" --uuid:1fe211a2-9207-4981-b1ba-95c51dc9dadd-- SOAP APIs In the past… (1998)
SOAP SIMPLE
Retrieved: Tuesday, 8th May, 2018. --uuid:1fe211a2-9207-4981-b1ba-95c51dc9dadd Content-Type: text/xml <?xml version='1.0'
encoding='UTF-8'?><S:Envelope xmlns:S="http:// schemas.xmlsoap.org/soap/envelope/"><S:Body /></S:Envelope> --uuid:1fe211a2-9207-4981-b1ba-95c51dc9dadd Content-Id:<
[email protected]
> Content-Type: application/octet-stream Content-Transfer-Encoding: binary "User/Employee ID","First Name","Employment Details Hire Date","Username","Division","Company Country","Location","Department","Cost Center","Team","Supervisor","Manager User Sys ID","Contract Type","Gender" --uuid:1fe211a2-9207-4981-b1ba-95c51dc9dadd--
SOAP IS NOT A GOOD API
Q: “DO YOU KNOW SOAP?” A: NOPE NOPE NOP
None
None
None
None
JSON IS GOOD
[ { "User/Employee ID": "ryan001", "First Name": "Ryan", "Username": "ryanbigg",
. . . } . . . ] And then… (circa 2001)
JSON JAVASCRIPT
JSON Third Party App Your App “Can you give me
data about employees?”
JSON “Sure, here’s my data” Third Party App Your App
[ { "User/Employee ID": "ryan001", "First Name": "Ryan", "Username": "ryanbigg", . . . } . . . ]
HAPPENED THEN RAILS HAPPENED
A browser JavaScript, CSS, Images, and Rails The Monolith And
then and then (circa 2011) Database Makes your app look great Makes your app do stuff
A browser React App Frontend App Backend App Now… (2018)
The Duolith Database Rails App
A browser React App Frontend App Backend App Now… (2018)
Database Rails App Makes your app look great Makes your app do stuff
A browser React App Frontend App Backend App Now… (2018)
Database Rails App SeparaEon of Concerns
Rails Apps In the past
Rails Apps Now
A browser React App Frontend App Backend App The Duolith
Database Rails App Now… (2018)
A browser Frontend App Backend App “Views”, CSS, JS, etc.
Controllers, models, etc. React App Database Rails App Now… (2018)
HOW DO THESE THINGS TALK ? A browser React App
??? Database Rails App
APIs ARE HOW PROGRAMS TALK TO EACH OTHER Slide #7:
A browser React App JSON API Recently… Database Rails App
A browser React App “Show me a post” Recently… Database
Rails App
A browser React App “Okay, here’s the post” Recently… Database
Rails App
JSON APIs POST COMMENT #1 COMMENT #2 GET /api/posts/1 GET
/api/posts/1/comments
GET /api/posts/1 { "id": 1, "title": "Hello World", "body": "This
is my blog's first post." "author": "Ryan Bigg" } JSON APIs
GET /api/posts/1/comments [ { text: "Great first post!", by: "Totally
not Ryan" }, ... ] JSON APIs
A browser React App /api/posts/:id /api/comments … Currently… JSON APIs
Need to build lots of these… Database Rails App /api/posts
EVERYONE DOES THIS
EVEN FACEBOOK
WELL… THEY DID
GET /api/posts/1 { "id": 1, "title": "Hello World", "body": "This
is my blog's first post." "author": "Ryan Bigg" } JSON APIs Problem #1
GET /api/posts/1 { "id": 1, "title": "Hello World", "body": "This
is my blog's first post." "author": "Ryan Bigg”, “comments”: [ { “id”: 1, ... } ] } JSON APIs Problem #2
JSON APIs POST COMMENT #1 COMMENT #2 GET /api/posts/1 GET
/api/posts/1/comments
Facebook iOS App Facebook Servers 1. Get news feed items
2. Here are your items 3. Get comments 4. Here are the comments 5. Fetch user data 6. Here are the users
JSON IS GOOD BUT WE CAN DO BETTER
None
/graphql Now (and the future) Only one endpoint (born 2012)
Database Rails App A browser React App
Fetching a Post query postQuery { post(id: 1) { id
title body author } } { "data": { "post": { "id": 1, "title": "Hello World", "body": "First post!”, "author": "Ryan Bigg", } } } Query Response GRAPHQL
query postQuery { post(id: 1) { id title body author
} } { "data": { "post": { "id": 1, "title": "Hello World", "author": "Ryan Bigg", } } } Query Response GRAPHQL Ignoring a field
Post + Comments query postQuery { post(id: 1) { id
title body author comments { text by } } } { "data": { "post": { "id": 1, "title": "Hello World", "body": "First post!”, "author": "Ryan Bigg", "comments": [ { text: "Great first post!", by: "Totally not Ryan" }, ... ] } } } Query Response GRAPHQL
GRAPHQL POST COMMENT #1 COMMENT #2 POST /graphql
query postQuery { ... } query commentQuery { comment(id: 1)
{ text user } } { "data": { “post”: { ... }, “comment”: { text: "Great first post!", user: "Totally not Ryan” } } } Query Response GRAPHQL Two queries at the same Eme
Facebook iOS App Facebook Servers 1. Get news feed items,
their comments and their users 2. Here’s everything
GRAPHQL IS BEST
ISN’T RAILS THE FUTURE OF RAILS AS YOU KNOW IT
TODAY
Rails Apps Now
The future… A browser React App Frontend App Backend App
Database Rails App
✉:
[email protected]
Thanks! : @ryanbigg ▶: hIp:/ /bit.ly/radar-for
hIps:/ /developer.github.com/v3/ API Examples REST + JSON hIps:/ /developer.github.com/v4/ GRAPHQL
hIps:/ /www.howtographql.com/ Learn these: GraphQL hIps:/ /reactjs.org/tutorial/tutorial.html React
hIps:/ /www.sandimetz.com/99boIles/ Read these: 99 BOTTLES hIps:/ /www.poodr.com PRACTICAL OBJECT-ORIENTED
DESIGN IN RUBY
hIps:/ /bit.ly/exploding-rails-talk hIps:/ /speakerdeck.com/radar/exploding-rails hIps:/ /leanpub.com/exploding-rails Exploding Rails hIps:/ /github.com/radar/twist-v2
MY EXAMPLE APPLICATION