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 swifter way of A/B testing implementation
Search
gaopin
March 08, 2018
Technology
2
1.4k
The swifter way of A/B testing implementation
Try! Swift after talks
gaopin
March 08, 2018
Tweet
Share
More Decks by gaopin
See All by gaopin
draft for devsummi
gaopin1534
0
140
XCTestを目的別で分けるすすめ
gaopin1534
0
3.3k
静的解析の話
gaopin1534
0
180
RxSwiftってどうなってるの?
gaopin1534
1
310
Drag'n'Drop'n'iPhone
gaopin1534
0
130
OBJ-C戦線異常なし@DevLOVE 199
gaopin1534
1
130
Other Decks in Technology
See All in Technology
comilioとCloudflare、そして未来へと向けて
oliver_diary
6
450
いま現場PMのあなたが、 経営と向き合うPMになるために 必要なこと、腹をくくること
hiro93n
9
7.7k
自社 200 記事を元に整理した読みやすいテックブログを書くための Tips 集
masakihirose
2
330
Cloudflareで実現する AIエージェント ワークフロー基盤
kmd09
0
290
Amazon Q Developerで.NET Frameworkプロジェクトをモダナイズしてみた
kenichirokimura
1
200
2025年に挑戦したいこと
molmolken
0
160
re:Invent2024 KeynoteのAmazon Q Developer考察
yusukeshimizu
1
150
Formal Development of Operating Systems in Rust
riru
1
420
Oracle Exadata Database Service(Dedicated Infrastructure):サービス概要のご紹介
oracle4engineer
PRO
0
12k
iPadOS18でフローティングタブバーを解除してみた
sansantech
PRO
1
150
機械学習を「社会実装」するということ 2025年版 / Social Implementation of Machine Learning 2025 Version
moepy_stats
5
1.3k
【NGK2025S】動物園(PINTO_model_zoo)に遊びに行こう
kazuhitotakahashi
0
240
Featured
See All Featured
The Straight Up "How To Draw Better" Workshop
denniskardys
232
140k
jQuery: Nuts, Bolts and Bling
dougneiner
62
7.6k
The World Runs on Bad Software
bkeepers
PRO
66
11k
Keith and Marios Guide to Fast Websites
keithpitt
410
22k
How to Ace a Technical Interview
jacobian
276
23k
StorybookのUI Testing Handbookを読んだ
zakiyama
28
5.4k
A Modern Web Designer's Workflow
chriscoyier
693
190k
Responsive Adventures: Dirty Tricks From The Dark Corners of Front-End
smashingmag
251
21k
Chrome DevTools: State of the Union 2024 - Debugging React & Beyond
addyosmani
3
240
Unsuck your backbone
ammeep
669
57k
Typedesign – Prime Four
hannesfritz
40
2.5k
GraphQLとの向き合い方2022年版
quramy
44
13k
Transcript
The swifter way of A/B testing implementation Kouhei Takamatsu(@gaopin1534)
ࣗݾհ • ߴদฏ(gaopin1534) • ਓࡐܥاۀۈ • iOSྺ1͘Β͍ • ͱͱPHPͱ͔Rubyͱ͔ͱྑ͠ •
try! Swift2018ϘϥϯςΟΞελοϑͯ͠·ͨ͠ • ΟεΩʔͱ͔Ϗʔϧ͕͖
by Martin Abegglen (https://goo.gl/VwaMZP)
ABςετ by Silly Deity (https://goo.gl/HsJgy3)
͍ࣺͯͷfunc طଘϩδοΫΛԚછ͢Δذ ͿΒΓABςετআ٫ͷཱྀ ԿͷABςετͬͯΔΜ͚ͬʁ ͦͷABɺςετίʔυॻ͚Δʁ ςετίʔυ͍ͦͦΔʁ
໘͍͘͞
ष͍ͷʹ֖ by Erwin Soo (https://goo.gl/1AS3mE)
ABTesterProtocol associatedtype ABTestPatternType: ABTestPatternProtocol associatedtype ABTestKey: ABTestKeyProtocol func getCurrentPatternKey() ->
ABTestKey A/B test logic functions extension ABTesterProtocol { private func getTargetPattern() -> ABTestPatternType? { return getCurrentPatternKey().pattern as? Self.ABTestPatternType } }
ABTesterKeyProtocol: RawRepresentable associatedtype ABTestPatternType: ABTestPatternProtocol var pattern: ABTestPatternType { get
} ϩάͱͷ࿈݁͘͢͠ɺ ͔ͭenum͑ΑײΛग़ͨ͢Ί RawRepresentableʹ४ڌ
ABTesterPatternClass: ABTestPatternProtocol ॻ͘ABςετύλʔϯ͝ͱʹ࣮ ࣮ࡍͷϩδοΫશ෦͜͜ʹ DefaultΛҰͭ࡞Γɺଞύλʔϯͦͷࢠʹ શύλʔϯΫϥε͕ಉ͡funcΛ࣋ͭͷ͕ຯḩ A/B test logic functions
class CertainABTestPatternDefault: ABTestPatternProtocol { func getLabel() -> String { return
"Live long and prosper." } } class CertainABTestPatternB: CertainABTestPatternDefault { override func getLabel() -> String { return "May the force be with us.” } }
struct CertainABTester: ABTesterProtocol { func getCurrentPatternKey() -> SomeABTestKey { return
.a } typealias ABTestPatternType = SomeABTestPatternDefault typealias ABTestKey = SomeABTestKey func getLable() -> String { return getCurrentPatternKey().pattern.getLabel() } }
SomeTester: ABTesterProtocol SomeTestKey: ABTestKeyProtocol var patternͰબ getCurrentKey PatternDefault: ABTestPatternProtocol PatternB:
PatternDefault ϩδοΫݺͿ ᶃ ᶄ ᶅ
if ABTestManager().getPattern(of: .someABTest) == "B" { label.text = "foo" }
else { label.text = "bar" } ͜Ε͕
lebel.text = SomeABTester().getLabel() ͜͏ͳΔ
Կ͕خ͍͠ʁ • ύλʔϯΛফͯ͠Default͕ੜ͖ͯΕͱΓ͋͑ͣյ Εͳ͍ • ABςετ୯ҐͰཧͰ͖ͯɺશ෦ด͡ࠐΊΕΔ • ABͲ͔ͬͪʹدͤΔͱ͖έʔεΛফ͚ͩ͢ • ύλʔϯআ࣌ʹABTesterͬͯ͠·͏͕ɺޙʑফ
͖͢ͷ͕ϚʔΩϯάͰ͖͍ͯΔঢ়ଶʹͳ͍ͬͯΔ
Կ͕೦ʁ • ϦϑΝΫλ͢Δ༐ؾ͕ͳ͚ΕӬԕʹABTester͕ Γଓ͚Δ • ͠͠ҾͰselfͱ͔Λ͢ඞཁ͕͋Δ • ໘͍͘͞ͷͰಋೖ࣌ʹݏ͕ΒΕΔ • Ұ൪ൃද͔ͨͬͨ͠ʮSwiftͰ࣏ฤʯʹଓ͘
https://github.com/ gaopin1534/Yebisw ࡞Γ్தͰ͕͢ɺɺɺ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠