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
Lauren Voswinkel
August 12, 2014
Programming
0
260
Nitty Gritty Service Building
Lauren Voswinkel
August 12, 2014
Tweet
Share
More Decks by Lauren Voswinkel
See All by Lauren Voswinkel
Advanced Javascript Basics
valarissa
1
230
Putting Off Persistence
valarissa
1
180
Other Decks in Programming
See All in Programming
iOSエンジニア向けの英語学習アプリを作る!
yukawashouhei
0
200
登壇は dynamic! な営みである / speech is dynamic
da1chi
0
320
オープンソースソフトウェアへの解像度🔬
utam0k
15
2.8k
Flutterで分数(Fraction)を表示する方法
koukimiura
0
130
Domain-centric? Why Hexagonal, Onion, and Clean Architecture Are Answers to the Wrong Question
olivergierke
2
840
Le côté obscur des IA génératives
pascallemerrer
0
140
Devvox Belgium - Agentic AI Patterns
kdubois
1
120
非同期jobをtransaction内で 呼ぶなよ!絶対に呼ぶなよ!
alstrocrack
0
900
Devoxx BE - Local Development in the AI Era
kdubois
0
130
CSC509 Lecture 06
javiergs
PRO
0
260
Things You Thought You Didn’t Need To Care About That Have a Big Impact On Your Job
hollycummins
0
230
なぜあの開発者はDevRelに伴走し続けるのか / Why Does That Developer Keep Running Alongside DevRel?
nrslib
3
400
Featured
See All Featured
Building a Scalable Design System with Sketch
lauravandoore
463
33k
[RailsConf 2023] Rails as a piece of cake
palkan
57
5.9k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
35
3.2k
Why You Should Never Use an ORM
jnunemaker
PRO
59
9.6k
Automating Front-end Workflow
addyosmani
1371
200k
Large-scale JavaScript Application Architecture
addyosmani
514
110k
Done Done
chrislema
185
16k
Building Applications with DynamoDB
mza
96
6.7k
Building Better People: How to give real-time feedback that sticks.
wjessup
369
20k
Bootstrapping a Software Product
garrettdimon
PRO
307
110k
Stop Working from a Prison Cell
hatefulcrawdad
271
21k
The Cost Of JavaScript in 2023
addyosmani
54
9k
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