Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Decouple trial from Split::Helper #286

Merged
merged 9 commits into from
Jan 3, 2015
Merged

Decouple trial from Split::Helper #286

merged 9 commits into from
Jan 3, 2015

Conversation

joshdover
Copy link
Contributor

This closes #285

A decent amount of refactoring done here, but it should clean things up quite a bit. No changes were made to the helper API and all of the specs are passing.

This refactoring further decouples the view helper from the inner
workings and detials of starting an experiment. This completes the
work needed to allow for an experiment to be started by an arbitrary
class.
The goals that are being completed are not actually properties of
the Trial object and should be used as context for completing a
Trial from the helper.
The complexity and confusion of having multiple methods involved
in the alternative choosing process replaced by one method that
is guaranteed to only create side effects once.
Summary:
Allow RedisAdapter to be used outside of a session context
Remove unnecessary duplicate methods
Add debugger gem
Refactor finding experiments from Helper to ExperimentCatalog
Refactor experiment starting process from Helper to Trial

This refactoring further decouples the view helper from the inner
workings and detials of starting an experiment. This completes the
work needed to allow for an experiment to be started by an arbitrary
class.

This code is pretty rough and there is a lot of refactoring that
this gem needs to make me happy. But this gets that process started
and gets us the funtionality we need.

All but one spec are currently passing. It's a spec we don't really
care about for our own purposes, but I'll have it fixed before
doing a PR to the main split fork.

Reviewers: tyler

Reviewed By: tyler

Differential Revision: http://code.204.io/D122
@coveralls
Copy link

Coverage Status

Coverage decreased (-63.95%) when pulling 7681280 on asku:master into 43638df on andrew:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-63.95%) when pulling 7681280 on asku:master into 43638df on andrew:master.

@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) when pulling 2bd0781 on asku:master into 43638df on andrew:master.

1 similar comment
@coveralls
Copy link

Coverage Status

Coverage decreased (-0.05%) when pulling 2bd0781 on asku:master into 43638df on andrew:master.

@joshdover
Copy link
Contributor Author

An illustrated example of what this PR allows me to do. We have an experiment where we are split testing users to test how receiving a notification effects their long-term behavior. This runs in a background job and sends notifications to users who are not actually logged in (it's the current user's friends).

ab_user    = Split::Persistence.adapter.new(nil, user.tracking_id)
experiment = Split::ExperimentCatalog.find(:friend_post_notification)
trial      = Split::Trial.new(user: ab_user, experiment: experiment)
send_notification(user) if trial.choose!

@andrew
Copy link
Member

andrew commented Jan 3, 2015

This looks great @joshdover, thanks very much. I'll look at getting a new release out for this in a few days. 🎉

andrew added a commit that referenced this pull request Jan 3, 2015
Decouple trial from Split::Helper
@andrew andrew merged commit 7381903 into splitrb:master Jan 3, 2015
@andrew
Copy link
Member

andrew commented Jan 10, 2015

@joshdover I've released this as part of v1.1.0 🎉 https://github.com/andrew/split/releases/tag/v1.1.0

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Starting experiments is coupled tightly to Split::Helper
4 participants