Programmers Stack Exchange is a question and answer site for professional programmers interested in conceptual questions about software development. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Models in an MVC application gets kind of hard to test when validation of data and persistence of data is baked together in the model. I would like to test those separately to prevent doing integration testing instead of actual unit testing.

What patterns are available to keep validation and persistence separated?

share|improve this question
up vote 1 down vote accepted

You may want to take a look at the persistance and validation mechanisms used by the Eclipse Modeling Framework (EMF). Model persistance and validation are fully separated concerns, and there is good support for plugging in your own custom validation code.

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.