Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Speaker Deck
PRO
Sign in
Sign up for free
【2018/09/18 Otemachi.rb#9】君(退会したユーザ)の名は。
Shu OGAWARA
September 18, 2018
Technology
0
410
【2018/09/18 Otemachi.rb#9】君(退会したユーザ)の名は。
2018/09/18のOtemachi.rb#9での発表資料です。久しぶりのRailsネタです。
Shu OGAWARA
September 18, 2018
Tweet
Share
More Decks by Shu OGAWARA
See All by Shu OGAWARA
ActiveSupport::Concernで開くメタプログラミングの扉 #heiseirubykaigi / The door of meta-programing is opened by ActiveSupport::Concern
expajp
1
1.6k
実践Railsアプリケーション設計 #meetup_rails / Practical Rails Application Design
expajp
4
33k
【2019/07/06 TamaRuby会議01】brainf*ck処理系で理解するパターンマッチングをつかった疎結合な実装
expajp
2
2.1k
その正規表現、異議あり! 〜 ReDoSについて
expajp
2
3.8k
【2018/12/08 RailsDM】「あの人」に学ぶ!駆け出しRailsエンジニアの日常の過ごし方
expajp
8
1.1k
【2018/07/29 TokyuRuby会議12】Project Eulerから生まれたワンライナーたち
expajp
0
440
【2018/07/10 Otemachi.rb#8】情報収集どうしてますか?
expajp
0
570
しくじり先生「新卒2年目の転職」
expajp
3
2.8k
【2018/06/12 Otemachi.rb#7】はじめての機能開発でわかった3つのこと
expajp
0
390
Other Decks in Technology
See All in Technology
PHPのimmutable arrayとは
hnw
1
150
ユーザーテストガイドライン VERSION 2.0
kouzoukaikaku
0
1.2k
書籍を書きました。 そう、VS Codeで。
takumanakagame
4
4.4k
Hatena Engineer Seminar #23 「チームとプロダクトを育てる Mackerel 開発合宿」
arthur1
0
460
OCI DevOps 概要 / OCI DevOps overview
oracle4engineer
PRO
0
490
Periodic Multi-Agent Path Planning
hziwara
0
110
あつめたデータをどう扱うか
skrb
2
160
SmartHRからOktaへのSCIM連携で作り出すHRドリブンのアカウント管理
jousysmiler
1
120
re:Inventで発表があったIoT事例の紹介と考察
kizawa2020
0
180
創業1年目のスタートアップでAWSコストを抑えるために取り組んでいること / How to Keep AWS Costs Down at a Startup
yuj1osm
3
2.1k
グローバルチームことはじめ / Bootstrapping a global team
tasshi
1
690
メドレー エンジニア採用資料/ Medley Engineer Guide
medley
3
5.1k
Featured
See All Featured
Design and Strategy: How to Deal with People Who Don’t "Get" Design
morganepeng
109
16k
How GitHub Uses GitHub to Build GitHub
holman
465
280k
The Invisible Side of Design
smashingmag
292
48k
Optimizing for Happiness
mojombo
365
64k
Fireside Chat
paigeccino
16
1.8k
VelocityConf: Rendering Performance Case Studies
addyosmani
317
22k
Docker and Python
trallard
30
1.9k
Three Pipe Problems
jasonvnalue
89
8.9k
Designing for humans not robots
tammielis
245
24k
Building an army of robots
kneath
301
40k
How to train your dragon (web standard)
notwaldorf
66
4.3k
Robots, Beer and Maslow
schacon
154
7.3k
Transcript
܅ ͷ ໊ ɻ ୀձͨ͠Ϣʔβ 0UFNBDIJSC 4IV0("8"3" !FYQBKQ 1IPUPCZ/FJM3PTFOTUFDI
PO6OTQMBTI
1 !
Rails
n & %(@expajp) – ! – 3
– Ruby/Rails(1 • Project Euler 100 • Vue.js+ – # ' " – *$ )
CM
View
n post creatornil
n post
n DB posts ! user_id NULL " 0 #
n post
n DB posts ! user_id NULL " 0 #
,
n B83+,.02@A' " % – ,.020 ;E(15*,47<: $#D=
n View6-/)'C9 ? " % &" – View!6-/)'? – DRY>%
n & #$ n
'!" %
N+1
N+1 Q . L S 0 N Q . 11
N+1 / Eager Loading - Rails Webook https://ruby-rails.hatenadiary.com/entry/20141108/1415418367 ’’
N+1 n DB
→
٫Լʂ
CTO
n Active Record/. creator_id0 - * n Decorator,#4(
*&!)$+ " → post'%*&!)30$+ → DRY21
Active Record
Decorator
View
ҟٞ͋Γʂ
CH*-&0c$a2&16$ >TO@L&Kg\N MB/&K$ ;5&F Z$ [Ra2 VI% 43$QWU *-&P
D$a2Gb# $ $ SY9X`d$=^!A]?(.+'),JE" $a2&<7:f_<$ The WyCash Portfolio Management System http://c2.com/doc/oopsla92.html heSY8TO - Wikipedia ’’
n 06:?)<5DE n Decorator7*F2(> +'
[email protected]
% –
"#! . n gem9(,38C – B/) & ;A3 $/=
NullUser, SystemUser
n Decorator Post creator n User
full_name n Post NullUser, SystemUser – full_name ! n creator User, NullUser, SystemUser
User
NullUser, SystemUser
Post
!
n DB5-6 & %!* #($). –
View,1 '! n 70+4 "*/ 32
n )$ " !'( n
View#*%&
1. 2.
3. NullUser, SystemUser
!
n ;&B5$ – ?< 12$'*/+-@ – full_nameA03 %
n ;D …… – 89" FE – DRY" n ;&,(-.4=6,). C :$# >7 !
n (#&')!% #@ n Rails0-= – *"$!,E?28DRYF<251A
– I74C>6 n +3D 9:HJ;B – /.G+3D