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
Mermaid x AST x 生成AI = コードとドキュメントの完全同期への道
shibuyamizuho
0
160
HTTP compression in PHP and Symfony apps
dunglas
2
1.7k
Keeping it Ruby: Why Your Product Needs a Ruby SDK - RubyWorld 2024
envek
0
180
PHPで学ぶプログラミングの教訓 / Lessons in Programming Learned through PHP
nrslib
1
150
コンテナをたくさん詰め込んだシステムとランタイムの変化
makihiro
1
120
Refactor your code - refactor yourself
xosofox
1
260
急成長期の品質とスピードを両立するフロントエンド技術基盤
soarteclab
0
930
Scalaから始めるOpenFeature入門 / Scalaわいわい勉強会 #4
arthur1
1
310
Webエンジニア主体のモバイルチームの 生産性を高く保つためにやったこと
igreenwood
0
330
創造的活動から切り拓く新たなキャリア 好きから始めてみる夜勤オペレーターからSREへの転身
yjszk
1
130
CQRS+ES の力を使って効果を感じる / Feel the effects of using the power of CQRS+ES
seike460
PRO
0
120
ゆるやかにgolangci-lintのルールを強くする / Kyoto.go #56
utgwkk
1
370
Featured
See All Featured
The Language of Interfaces
destraynor
154
24k
Save Time (by Creating Custom Rails Generators)
garrettdimon
PRO
28
900
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
29
2k
Designing for Performance
lara
604
68k
How to Think Like a Performance Engineer
csswizardry
22
1.2k
個人開発の失敗を避けるイケてる考え方 / tips for indie hackers
panda_program
95
17k
Fontdeck: Realign not Redesign
paulrobertlloyd
82
5.3k
Rails Girls Zürich Keynote
gr2m
94
13k
YesSQL, Process and Tooling at Scale
rocio
169
14k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.4k
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