Hacker News new | past | comments | ask | show | jobs | submit login

This is the critical difference.

One of the simplest examples is that you could have a Login domain model that handles login-related business logic, that mutates properties in the User ORM model.

All your login-related business logic code goes in the Login model, and any "the data _must_ look like this or be transformed like that" logic can go in the ORM model. If some other service wants to do anything related to the login process, it should be calling into the Login domain model, not accessing the User ORM model directly.




> "the data _must_ look like this or be transformed like that" logic can go in the ORM model

I would rather implement the Repository pattern and leave the poor model as a plain data structure.


What's a difference between this domain model and the service then? In your example you'd have a Login service and all the code related to login would have to go through the Login service, right? Why do you need the additional domain model layer?




Consider applying for YC's Spring batch! Applications are open till Feb 11.

Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: