views:

74

answers:

1

I really like these two patterns.

The drawback of Repository pattern is its cost(takes more time then Active record). Benefit is higher abstraction which really helps on complicated business logic.

The drawback of Active record is that lower testability(db interaction is required) and harder in handling complicated domain logic.

Is it acceptable to take the best of these two patterns to be used in the same application?

I was thinking about using Active record for simple CRUDs and Repository for complicated domain objects.

The idea behind this intention is to keep cost of code lower but still have a good code.

A: 

I don't think it's wrong but once you have a Repository component it doesn't seem more work to get the simpler domain objects to work with it too.

koen