Reputation: 102
I'm starting to learn about Software Architecture and I've seen some layered architecture implementations that got me confused.
In general terms, those solutions have the following layers:
I'm not certain about:
If someone could answer me those questions or recommend me some resources to learn more about it, I would appreciate.
Thanks and have a nice day! :)
Upvotes: 2
Views: 1525
Reputation: 808
Presentation Layer: As it's name suggests this layer's concern is whatever the user sees or interacts with. It contains UI logic, graphics, forms, images, ...
Domain Layer: This is where your business logic is handled. If you are writing a weblog this layer contains objects and entities like Posts, Users, Comments, etc. If you are writing a financial system they would be Ledger, Accounts, Money, etc. The most valuable codes of your system rely here, because they satisfy user concerns.
Infrastructure Layer: In the classic sense every layer only accesses the underlying layer, but sometimes this layer covers concerns of multiple layers. So I doubt if you can call this one a layer in the classic sense. It contains application wide abstractions and base classes, and sometimes cross cutting concerns, etc.
Service Layer: "A common approach in handling domain logic is to split the domain layer in two. A Service Layer is placed over an underlying Domain Model", Martin Fowler, PoEAA. As Martin Fowler says in his book (I recommend you to read the book) this is a layer on top of your domain to make the usage of your domain easier. So that it's clients don't have to know anything about domain complexities. It contains Facades. And also a good place for handling some concerns like security, transaction management, and etc.
Data Layer: This layer manages the storage logic. It could be a simple file or some big relational database. In simple projects where there is no or little business logic Data layer plays the "Domain Layer" role or vice versa. Actually it's not important. What is important is that there could be some impedance mismatch between the domain model and the data structure. The main concern of Data Layer is to handle this difficulty for other parts of the application (specially Domain Layer).
Which layer communicates with data? Most of all the Domain Layer. But it's not always true. Suppose you want to save some user preferences of UI in the database. So the Presentation layer can also communicate with the Data Layer. Actually any layer can communicate with the Data. What is important is that you should use patterns and best practices (like IOC) to make the best out of your project needs.
Good Luck!
Upvotes: 2