mattt / SkyLab

Multivariate & A/B Testing for iOS and Mac

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Synchronous AB tests with SkyLab

marklarr opened this issue · comments

All of SkyLab's methods rely on blocks -- which is a great structure for control-flow between tests. Things look a little strange, though, once you want something synchronously. ie,

- (BOOL)showNewFancyButton 
{
     BOOL showNewFancyButton;
    [SkyLab abTestWithName:@"ShowNewFancyButton" A:^{
        showNewFancyButton = YES;
    } B:^{
        showNewFancyButton = NO;
    }]

    return showNewFancyButton;
}

Looking at the implementation of SkyLab, the above code will work just fine, but we thought it's a little weird to rely on blocks to run synchronously (even though we know the implementation does).

Do you think it'd be cool for SkyLabs to have non-block counterparts to its block-based methods? Or would you just suggest doing synchronous operations like above?

To be clear: nothing about blocks imply synchronous or asynchronous execution—they're just a means of passing behavior.

The intended usage is to listen for SkyLabWillRunTestNotification / SkyLabDidRunTestNotification notifications and configure your reporter to note the variables for the current user, so that the results may be correctly tabulated.

Although the property implementation you pasted in works, it should not be used. Instead, only introduce tested behavior through the block interfaces provided.

Thanks for the response. It's not so much about blocks implying asynchronous behavior as it is blocks leaving open the possibility for asynchronous behavior.

We'll look into the notifications.