Upgrade to Pro — share decks privately, control downloads, hide ads and more …

How (not) to A/B Test

How (not) to A/B Test

Deck from my talk given at the SLUG meetup! Video here: https://youtu.be/NVQuBow1B10

Avatar for Kyle Bashour

Kyle Bashour

March 27, 2019

Other Decks in Programming

Transcript

  1. How (not) to A/B Test Lessons learned in experimentation at

    Lyft Kyle Bashour • @kylebshr • 27 March 2019
  2. Experiment Setup // App launch: download assignment FeatureFlag.yellowSignUpButton.on { button.setStyle(background:

    .yellow, text: .black) } .off { button.setStyle(background: .blue, text: .white) } @kylebshr
  3. Experiment Setup // App launch: download assignment // Only expose

    once feature flag is accessed FeatureFlag.yellowSignUpButton.on { button.setStyle(background: .yellow, text: .black) } .off { button.setStyle(background: .blue, text: .white) } @kylebshr
  4. Sidenote // main.swift import UIKit UIApplicationMain( CommandLine.argc, CommandLine.unsafeArgv, nil, //

    Or a UIApplication subclass NSStringFromClass(MyAppDelegate.self) ) @kylebshr
  5. Implementation protocol GraphDisplaying { func display(_ data: [Int]) func bezierCurve(from

    points: [Int]) ... } class BarGraphView: UIView, GraphDisplaying {...} @kylebshr
  6. Implementation typealias GraphView = UIView & GraphDisplaying final class DemandGraphView:

    UIView { private let graphView: GraphView override init(frame: CGRect) { self.graphView = BarGraphView() super.init(frame: frame) } func display(_ model: DemandViewModel) { self.graphView.display(model.demand) } } @kylebshr
  7. Implementation final class DemandGraphView: UIView { private let graphView: GraphView

    override init(frame: CGRect) { if FeatureFlag.demandGraphV2.getValue() { self.graphView = InteractiveBarGraphView() } else { self.graphView = BarGraphView() } super.init(frame: frame) } func display(_ model: DemandViewModel) { self.graphView.display(model.demand) } } @kylebshr
  8. Implementation private lazy var newsFeedViewController = NewsfeedFeedViewController() private lazy var

    incentivesViewController = IncentivesViewController() override func viewDidLoad() { FeatureFlag.homeTabIncentives.on { self.setUpIncentivesPanel() } .off { self.setUpNewsFeedPanel() } } @kylebshr
  9. Swift Recap • Learned what @UIApplicationMain does • Protocols can

    help with clean A/B structure • In other cases, lazy instantiation can help @kylebshr