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

Callbacks #2

Open
tpendragon opened this issue Mar 3, 2015 · 2 comments
Open

Callbacks #2

tpendragon opened this issue Mar 3, 2015 · 2 comments

Comments

@tpendragon
Copy link

When are they appropriate? Ever? Troubles, concerns, when they work well.

@tpendragon
Copy link
Author

This is in reference to before_save/after_save etc.

@jechols
Copy link
Contributor

jechols commented Mar 3, 2015

I think there are very valid reasons when a thing has to happen before/during/after save/create/update/etc. The real question is: would we want these things on the data model?

Looking at the vocab work, we have a term wrapper that gives us a "save" method. Adding a "before save" callback would be as easy as just putting a line of code in there (if that is our definitive object for persisting terms, anyway).

In cases where we have so little logic we don't abstract anything, a callback might indeed be the right choice. But once we're feeling like we need those abstractions, I'd say callbacks should be the exception, not the rule.

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

No branches or pull requests

2 participants