I am designing a new application that deals with a lot of business logic.
To avoid the usual entanglement between different application layers that often sneaks into such systems over time, I want to implement clean separation of concerns right from the start. Broadly speaking I want to separate:
- presentation layer
- business logic layer
- data storage and persistence layer
The question I am struggling with most is how to actually implement behavior at the edges cleanly, especially between the business and the data layer. I have seen too many applications where the data layer hands ORM objects to the core layer, effectively tightly coupling the business logic to the ORM.
Should I convert ORM objects to some serialized format (JSON?) and then deserialize that in the business layer into a data structure internal to that layer? Isn't that a lot of overhead?
How do you cleanly implement separation of concerns for medium sized applications? Any advice?