Which is a better design pattern for a database wrapper: Save as you go or Save when your done?

Posted by izuriel on Programmers See other posts from Programmers or by izuriel
Published on 2012-04-03T23:22:52Z Indexed on 2012/04/03 23:40 UTC
Read the original article Hit count: 149

Filed under:
|

I know this is probably a bad way to ask this question. I was unable to find another question that addressed this.

The full question is this: We're producing a wrapper for a database and have two different viewpoints on managing data with the wrapper.

The first is that all changes made to a data object in code must be persisted in the database by calling a "save" method to actually save the changes. The other side is that these changes should be save as they are made, so if I change a property it's saved, I change another it's save as well.

What are the pros/cons of either choice and which is the "proper" way to manage the data?

© Programmers or respective owner

Related posts about design-patterns

Related posts about database