I want to start a new project and I just got in touch with Play framework, which has a ruby on rails -like approach that called my attention. I am not an expert in rails, but I think that the productivity in these frameworks are great.
I am following some tutorials but I am wondering: Play has the Model, which is used to populate the view but also used to perform DB queries. I find that somehow awkward, but I noticed that rails has also this approach.
I wonder if using the same entity for Object Relational Mapping and to populate the view may cause troubles. Here are two examples I can think of:
- My view required only a name and an ID from a big entity
- My view requires information from different entities
For the second case, I suppose I would be able to perform a join. But it seems somehow messy: joins in my controller, DB entities being used to populate views.
Am I missing some point here? I mean, these frameworks seem great and I would like to use them, but I wonder if my code wound turn into an spaghetti code. It seems to be on the opposing direction of I learned about separation of concerns.
If I separate in a layered architecture (models for my views, business logic layer and DAO layers), should I keep using play or should I move to something different like Spring?