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
Nitty Gritty Service Building
Search
Sponsored
·
Ship Features Fearlessly
Turn features on and off without deploys. Used by thousands of Ruby developers.
→
Lauren Voswinkel
August 12, 2014
Programming
260
0
Share
Embed
Copy iframe code
Copy JS code
Copy link
Start on current slide
Nitty Gritty Service Building
Lauren Voswinkel
August 12, 2014
More Decks by Lauren Voswinkel
See All by Lauren Voswinkel
Advanced Javascript Basics
valarissa
1
230
Putting Off Persistence
valarissa
1
190
Other Decks in Programming
See All in Programming
エージェンティックRAGにAWSで入門しよう!
har1101
8
1.1k
AIとRubyの静的型付け
ukin0k0
0
540
AI時代の仕事技芸論 — ソフトウェア開発で「遊ぶように働く」職人的熟達のすすめ
kuranuki
1
620
Lemonade + Foundry Toolkit でお手軽アプリ開発
seosoft
1
310
プラグインで拡張される Context をtype-safe にする難しさと設計判断
kazupon
2
590
軽量Java基盤の設計 DIコンテナに頼らない、長期保守と1秒起動の実現 JJUG CCC 2026 Spring
macha64
0
460
関係性から理解する"同一性"の型用語たち
pvcresin
2
640
Language Server 使ってる? 〜VSCode と Zed の場合〜 / Are you using a Language Server? ~For VS Code and Zed~
handlename
0
760
AIチームを指揮するOSS「TAKT」活用術 / How to Use “TAKT,” an OSS Tool for Orchestrating AI Teams
nrslib
6
830
権限チェックの一貫性を型で守る TypeScript による多層防御
mnch
4
1.1k
tsserverとは何だったのか、これからどうなるのか
nowaki28
1
450
Spec Driven Development | AI Summit Lisbon
danielsogl
PRO
0
150
Featured
See All Featured
Designing for Timeless Needs
cassininazir
1
250
The untapped power of vector embeddings
frankvandijk
2
1.7k
The SEO Collaboration Effect
kristinabergwall1
1
480
ReactJS: Keep Simple. Everything can be a component!
pedronauck
666
130k
Faster Mobile Websites
deanohume
310
31k
<Decoding/> the Language of Devs - We Love SEO 2024
nikkihalliwell
1
240
No one is an island. Learnings from fostering a developers community.
thoeni
21
3.7k
Google's AI Overviews - The New Search
badams
0
1k
A Soul's Torment
seathinner
6
2.9k
What the history of the web can teach us about the future of AI
inesmontani
PRO
1
600
We Are The Robots
honzajavorek
0
240
Navigating Algorithm Shifts & AI Overviews - #SMXNext
aleyda
1
1.3k
Transcript
Nitty Gritty Service Building Lauren Voswinkel @laurenvoswinkel Github: valarissa
None
Service! Oriented! Architecture
Service?
Unassociated
Loosely Coupled
Self- Contained
Unit of Functionality
Singularly! Focused! Application
Benefits
Benefits • Asynchronous*
Benefits • Asynchronous* • Parallelize-able
Benefits • Asynchronous* • Parallelize-able • Loose Coupling
Benefits • Asynchronous* • Parallelize-able • Loose Coupling • Faster
Tests*
Benefits • Asynchronous* • Parallelize-able • Loose Coupling • Faster
Tests* • Easier to Extend/Change
Benefits • Asynchronous* • Parallelize-able • Loose Coupling • Faster
Tests* • Easier to Extend/Change • Increased Velocity
None
HOW?!
None
So many services!
New API,! New Possibilities
Dog Food! Client
Let’s Get! Started
Building a Service 1. Determine what the service will do
Services should do one thing well
Services should do ONE thing well
Building a Service 1. Determine what the Service Does 2.
Create Endpoints for Service
What are the endpoints of your service?
Build Controllers
Determine Request Options
Filters for Response?
Multiple Objects Per Request?
ActiveModel ::Serializers! ! https://github.com/rails-api/active_model_serializers
ActiveModel::Serializers
Write Tests
Write Tests
Contract Your Service Fulfills
Building a Service 1. Determine what the Service Does 2.
Create Endpoints for Service 3. Create Client Models
Don’t Use Plain Responses
WARNING: Evil Magic
None
None
None
CAUTION:! Great For Rapid- Prototyping…! ! Terrible For! Everything Else
Write Tests
Proof That Service Hasn’t Changed
SonJay! https://github.com/stevecj/son_jay
SonJay
SonJay
Building a Service 1. Determine what the Service Does 2.
Create Endpoints for Service 3. Create Client Models 4. Create Communication Layer
Find a gem
Typhoeus! https://github.com/typhoeus/typhoeus
Concurrent Requests
WRAP THE GEM
WRAP.! THE.! GEM.
ActiveRecord! 2.3 -> 3.x
BONUS STEP!
Client Models
+
Communication! Layer
=
None
Errr…
None
Building a Service 1. Determine what the Service Does 2.
Create Endpoints for Service 3. Create Client Models 4. Create Communication Layer 5. Sever Dependencies
Replace DB Calls With Service Calls
Create the Gap
None
CAUTION:! Multi-Request! Server Needed
WEBrick- Wall
Building a Service 1. Determine what the Service Does 2.
Create Endpoints for Service 3. Create Client Models 4. Create Communication Layer 5. Sever Dependencies 6. Improve Service Performance
Round-Trip > DB Call
Tools
StackProf! https://github.com/tmm1/stackprof! ! (Ruby 2.1+)
PerfTools.rb! https://github.com/tmm1/perftools.rb! ! (All Other Rubies)
PerfTools
PerfTools
PerfTools
PerfTools
Building a Service 1. Determine what the service will do
2. Create Endpoints for Service 3. Create Client Models 4. Create Communication Layer 5. Sever Dependencies 6. Improve Performance 7. Transfer Client and/or Service
Extract! From Original Codebase
Extract Tables/ Database
Figure Out How To Keep Multiple Databases In Sync
…
Please?
I have no clue how to do that part…
Give a talk on that maybe?
Thanks!
Lauren Voswinkel @laurenvoswinkel