Reputation: 135
Hello I am currently working on a school project in which we are making a web application. I have a pretty good understanding about 3-tier architecture, but in my business logic layer (BLL) i have almost no logic. I am using most of the raw data i retrieve from my data access layer (DAL) to display in my presentation layer (PL). Currently in my controller classes, i'm just calling my mapper facade classes methods without doing anything further. So my question is:
Is this the right way to do it, as i know that DAL must never speak directly with PL and vise versa, or should I simply call the controllers something else more describing?
Furthermore I have made a controller class for each entity, but what if i have some methods that are in between two entities meaning that they access both entity classes.
Upvotes: 0
Views: 351
Reputation: 14064
Looks like you have an Anemic Domain Model.
In "real life", if your domain is that simple, you might want to skip the multilayered, tailor-made architecture and go for a simpler way such as Transaction Script or cookie-cutter RAD approaches where a lot of code can be automatically generated.
Upvotes: 1
Reputation: 9446
It is pretty rare in a real application that the database maps exactly 1-1 with the presentation layer. There is usually normalization for SQL databases, or denormalization for NoSQL dbs. Also, the business layer usually needs user identity for security and such that doesn't map directly to the database representation.
The last point you made about a single controller knowing about two entities is perfectly fine. That is why you are not directly using those entities in the presentation layer. You can mash up those entities into something the UI can more easily use, and keep them separated at the data access layer.
Upvotes: 1