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
370
Web Directions - Code Leaders - Hiring Juniors
radar
0
520
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
100
Hiring Juniors
radar
2
270
Rails Pacific - Multitenancy with Rails
radar
0
240
Other Decks in Programming
See All in Programming
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
2
450
fs2-io を試してたらバグを見つけて直した話
chencmd
0
240
PSR-15 はあなたのための ものではない? - phpcon2024
myamagishi
0
180
週次リリースを実現するための グローバルアプリ開発
tera_ny
1
110
Haze - Real time background blurring
chrisbanes
1
520
Итераторы в Go 1.23: зачем они нужны, как использовать, и насколько они быстрые?
lamodatech
0
960
Monixと常駐プログラムの勘どころ / Scalaわいわい勉強会 #4
stoneream
0
290
Cloudflare MCP ServerでClaude Desktop からWeb APIを構築
kutakutat
1
570
アクターシステムに頼らずEvent Sourcingする方法について
j5ik2o
4
350
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
340
採用事例の少ないSvelteを選んだ理由と それを正解にするためにやっていること
oekazuma
2
1.1k
競技プログラミングへのお誘い@阪大BOOSTセミナー
kotamanegi
0
360
Featured
See All Featured
Thoughts on Productivity
jonyablonski
68
4.4k
[RailsConf 2023] Rails as a piece of cake
palkan
53
5.1k
Adopting Sorbet at Scale
ufuk
73
9.1k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
Easily Structure & Communicate Ideas using Wireframe
afnizarnur
191
16k
Facilitating Awesome Meetings
lara
50
6.1k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Build The Right Thing And Hit Your Dates
maggiecrowley
33
2.4k
Building an army of robots
kneath
302
44k
Bash Introduction
62gerente
609
210k
A Philosophy of Restraint
colly
203
16k
Bootstrapping a Software Product
garrettdimon
PRO
305
110k
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