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
170
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
TanStack Routerに移行するのかい しないのかい、どっちなんだい! / Are you going to migrate to TanStack Router or not? Which one is it?
kaminashi
0
590
ISUCONに強くなるかもしれない日々の過ごしかた/Findy ISUCON 2024-11-14
fujiwara3
8
870
オープンソースAIとは何か? --「オープンソースAIの定義 v1.0」詳細解説
shujisado
9
910
ExaDB-D dbaascli で出来ること
oracle4engineer
PRO
0
3.8k
Lambda10周年!Lambdaは何をもたらしたか
smt7174
2
110
OCI Vault 概要
oracle4engineer
PRO
0
9.7k
アジャイルでの品質の進化 Agile in Motion vol.1/20241118 Hiroyuki Sato
shift_evolve
0
130
【Pycon mini 東海 2024】Google Colaboratoryで試すVLM
kazuhitotakahashi
2
500
Lexical Analysis
shigashiyama
1
150
AIチャットボット開発への生成AI活用
ryomrt
0
170
The Role of Developer Relations in AI Product Success.
giftojabu1
0
120
Can We Measure Developer Productivity?
ewolff
1
150
Featured
See All Featured
CSS Pre-Processors: Stylus, Less & Sass
bermonpainter
356
29k
Happy Clients
brianwarren
98
6.7k
Refactoring Trust on Your Teams (GOTO; Chicago 2020)
rmw
31
2.7k
A Philosophy of Restraint
colly
203
16k
BBQ
matthewcrist
85
9.3k
StorybookのUI Testing Handbookを読んだ
zakiyama
27
5.3k
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
232
17k
Producing Creativity
orderedlist
PRO
341
39k
Writing Fast Ruby
sferik
627
61k
How to Ace a Technical Interview
jacobian
276
23k
Facilitating Awesome Meetings
lara
50
6.1k
Into the Great Unknown - MozCon
thekraken
32
1.5k
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 ࡞Γ్தͰ͕͢ɺɺɺ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠