I have a simple REST application with a single controller. The application needs to fetch data from a Database, convert it to JSON and return this to the caller.
I need to decide what layers I should use. This is what I have so far:
Presentation layer: Contains the
Controller which uses a
Delegate that in turn calls a
Delegate is part of the presentation layer.
Service layer: Contains the
Service that has business logic to get the data/information that was requested by the caller. This is calling the
DAO layer: I actually only need to read from the Database (for now). So this contains the logic to read a
Stream from the database and map that to a Domain object.
Domain layer: Contain model objects. Simple POJO's.
This is the first time I actually need to think about package layers, architecture etc. I have read a lot lately regarding these things and I am getting confused the more I read.
- Am I on the right track here? Does this make any sense? Keep in mind that this is a very simple Application right now.
Do I even need the
Delegate? Can't I just call the
Any help is appreciated. Thanks.