-
Notifications
You must be signed in to change notification settings - Fork 0
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
Immutability FTW #19
Labels
Comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
A subtle issue you can find in most ORMs today is that you mutate model instances as you go and sync them with the remote database from time to time. It seems like an easy and convenient approach, but falls short if a model instance is used concurrently (esp. dangerous in JS with async code everywhere!).
Consider this:
You can easily spend an hour of debugging to recognize the issue. And fixing it may be even harder.
So I'd like to propose a different approach:
The setter methods could probably be easily derived from the field name. You could also track the change operations (
setName
,setBirthday
, ...) since the last database sync and have a change history. Might be nice for debugging and to only update fields in the database that have actually changed.The text was updated successfully, but these errors were encountered: