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
DCI Like a BOSS - BostonRB lightning talk
Search
Patrick Robertson
September 20, 2012
Technology
0
64
DCI Like a BOSS - BostonRB lightning talk
quick talk on DCI for BostonRB lightning talk night.
Patrick Robertson
September 20, 2012
Tweet
Share
More Decks by Patrick Robertson
See All by Patrick Robertson
CORS + EmberJS
patricksroberts
0
180
Building Extractable Libraries in Rail - Railsconf
patricksroberts
8
570
Five Gems - BostonRB lightning talk
patricksroberts
2
410
Building Extractable Libraries in Rails - BostonRB
patricksroberts
1
210
This Month in Ruby - December 2012
patricksroberts
0
160
BostonRB Intro - November 2012
patricksroberts
0
190
Building Extractable Libraries in Rails - DCRUG
patricksroberts
2
180
Building Extractable Libraries in Rails
patricksroberts
15
1.8k
Hitch - BostonRB Lighting talk
patricksroberts
1
120
Other Decks in Technology
See All in Technology
地理空間データ可視化・解析・活用ソリューション Pacific Spatial Solutions (PSS)
pacificspatialsolutions
0
330
LLM開発・活用の舞台裏@2024.04.25
yushin_n
3
1.1k
ワールドカフェI /チューターを改良する / World Café I and Improving the Tutors
ks91
PRO
0
150
FrontDoorとWebAppsを組み合わせた際のリダイレクト処理の注意点
kenichirokimura
1
720
IaCジェネレーターとBedrockで詳細設計書を生成してみた
tsukasa_ishimaru
4
880
Babylon.js JAPAN活動紹介 (2024/4)
limes2018
1
110
認知症フレンドリーテックとスタックチャン
naokiuc
0
170
非同期推論システムによるコスト削減と信頼性向上
koki_nishihara
1
360
Gradle Build Scanを使ってビルドのことを知ろう potatotips #87
tomorrowkey
2
150
Azure犬駆動開発の記録/GlobalAzureFukuoka2024_20240420
nina01
1
240
いつか使うかも貯金してたらめちゃめちゃ機能が増えてた話
riyaamemiya
0
610
障害対応をちょっとずつよくしていくための 演習の作りかた
heleeen
1
1.6k
Featured
See All Featured
Rails Girls Zürich Keynote
gr2m
91
13k
Build The Right Thing And Hit Your Dates
maggiecrowley
25
2k
The Language of Interfaces
destraynor
151
23k
A designer walks into a library…
pauljervisheath
201
23k
Bootstrapping a Software Product
garrettdimon
PRO
302
110k
Agile that works and the tools we love
rasmusluckow
325
20k
Fireside Chat
paigeccino
22
2.6k
Fontdeck: Realign not Redesign
paulrobertlloyd
76
4.9k
A better future with KSS
kneath
231
16k
Designing the Hi-DPI Web
ddemaree
276
33k
The World Runs on Bad Software
bkeepers
PRO
61
6.7k
The Cult of Friendly URLs
andyhume
74
5.7k
Transcript
DCI
Hello There! I’m @patricksroberts. I work at @iorahealth. I co-organize
@bostonrb.
DATA CONTEXT INTERACTION
DCI is a strategy to separate what your system does
from what your system is.
The Old and Busted Way
# app/models/user.rb class User < ActiveRecord::Base validates_presence_of :twitter_handle def tweet
TwitterWrangler.add_to_queue twitter_handle, twitter message end private def twitter_message “Today my BMI is #{body_mass_index} and I’m #{percent_of_body_mass_index_goal} from my goal of #{body_mass_index_goal}!” end end
THE NEW HOTNESS
DATA
# app/models/user.rb class User < ActiveRecord::Base validates_presence_of :twitter_handle end
ROLE
# app/roles/twit_user.rb module TwitUser def twitter_message “Today my BMI is
#{body_mass_index} and I’m #{percent_of_body_mass_index_goal} from my goal of #{body_mass_index_goal}!” end end
CONTEXT
# app/contexts/bmi_update_tweet.rb class BmiUpdateTweet attr_reader :user def initialize(user) @user =
user @user.extend TwitUser end def call TwitterWrangler.add_to_queue @user.twitter_handle, @user.twitter_message end end
INTERACTION
# app/controllers/tweets_controller.rb class TweetsController < ApplicationController def update user =
User.find(params[:id]) BmiUpdateTweet.new(user).call respond_with :ok end end