My application is currently quite a mess and I'm trying to untangle it all. My current idea is that I should have 3 separate layers:
- data layer that knows how to keep stuff in database (and handle data schema changes, so it's not really that trivial)
- domain layer (is that correct name?) that does all the magic changing the objects and processing events triggered by user requests
- presentation layer that knows how to show to user only what that user is allowed to know (some data is hidden from user just because)
My initial idea was that having a data object I can build domain object from it, then build a view object from that one and then serve it to user. However I'm now thinking about building view object directly from data object.
- If the user just queries some information, I fetch the data from database, get the nice presentation of it, then serve it to user. Not touching the domain layer at all.
- If user performs an action, I fetch the data, build models from it, do the magic object interaction, save it all back to data layer, then wrap it into presentation and serve.
How bad is such design?
Unfortunately I am not well-versed in software architecture/design terminology thus I might be failing to find the answer just because I don't know how to name things.
Edit: I don't mean to discard the Model part completely. I just mean that I will have Model sitting on Data and View sitting on Data too.