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
2025年のARグラスの潮流
kotauchisunsun
0
800
【Oracle Cloud ウェビナー】2025年のセキュリティ脅威を読み解く:リスクに備えるためのレジリエンスとデータ保護
oracle4engineer
PRO
1
100
AWS Community Builderのススメ - みんなもCommunity Builderに応募しよう! -
smt7174
0
190
機械学習を「社会実装」するということ 2025年版 / Social Implementation of Machine Learning 2025 Version
moepy_stats
6
1.5k
.NET AspireでAzure Functionsやクラウドリソースを統合する
tsubakimoto_s
0
190
Formal Development of Operating Systems in Rust
riru
1
420
PaaSの歴史と、 アプリケーションプラットフォームのこれから
jacopen
7
1.5k
デジタルアイデンティティ技術 認可・ID連携・認証 応用 / 20250114-OIDF-J-EduWG-TechSWG
oidfj
2
690
TSのコードをRustで書き直した話
askua
3
270
iPadOS18でフローティングタブバーを解除してみた
sansantech
PRO
1
150
生成AI × 旅行 LLMを活用した旅行プラン生成・チャットボット
kominet_ava
0
160
JuliaTokaiとJuliaLangJaの紹介 for NGK2025S
antimon2
1
130
Featured
See All Featured
Let's Do A Bunch of Simple Stuff to Make Websites Faster
chriscoyier
507
140k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
49k
Intergalactic Javascript Robots from Outer Space
tanoku
270
27k
Performance Is Good for Brains [We Love Speed 2024]
tammyeverts
7
570
Improving Core Web Vitals using Speculation Rules API
sergeychernyshev
3
180
Sharpening the Axe: The Primacy of Toolmaking
bcantrill
38
1.9k
How to Create Impact in a Changing Tech Landscape [PerfNow 2023]
tammyeverts
49
2.2k
The Art of Programming - Codeland 2020
erikaheidi
53
13k
Typedesign – Prime Four
hannesfritz
40
2.5k
Exploring the Power of Turbo Streams & Action Cable | RailsConf2023
kevinliebholz
28
4.5k
The World Runs on Bad Software
bkeepers
PRO
66
11k
GitHub's CSS Performance
jonrohan
1030
460k
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 ࡞Γ్தͰ͕͢ɺɺɺ
͝ਗ਼ௌ͋Γ͕ͱ͏͍͟͝·ͨ͠