PProg
PProg

Reputation: 77

What extra layers can there in n-layer architecture for an application?

i studying on software architecture principles.
i understood that what is three layer architecture (contains Presentation-Business -Data Access).
but anybody has any idea or extra layers for doing it for example someone do it by extra layers such as 'Service' layer 'Infrastructure' layer or other layers etc.
are there any extra layers for doing it?
I'm confused about doing it.
please help me ...

Upvotes: 0

Views: 489

Answers (2)

PeterG
PeterG

Reputation: 13

A Common tiered architecture makeup:

  • Core Layer
  • Infrastructure
  • Presentation

Broken down even further, these 3 layers can have their own granular layers.

Core Layer

  • Domain Models
  • Enums

Infrastructure

  • Repositories
  • Data Transfer Object Models
  • Services
  • Unit of Work

Presentation

  • MVC Project
  • Web API

I guess to answer you question, I could throw a layer in between the infrastructure and presentation layer and have a Testing layer. Just keep in mind that by layering the application architecture like this by using the file structure is really only beneficial if you follow SOC and SOLID principles in your code.

Upvotes: 1

Rob Conklin
Rob Conklin

Reputation: 9446

C# is no different from other (imperative) programming languages. Your exact architecture is often dictated by the framework in use. If you are using C#, it's likely some flavor of ASP.NET MVC. This is a good overview.

Often, between the model and controller a service layer is introduced to encapsulate some business logic and transaction flows. Whether this layer is "correct" or not is a matter of quite a bit of debate, and generally depends on whether you subscribe to the DDD camp or not. Realistically, if you have lots of complex business logic, externalizing the logic into a service layer increases the testability, at the cost of decreasing the real-world modeling ability of your model layer. For pragmatic, testing purposes, the service layer often ends up being the source of most of your business logic.

Repository or Data-Access layers are separated from model layer, and are very useful if your domain persistence hits a certain level of complexity. I usually end up creating them by default as it also helps with testing to decouple the model from their persistence (and allows easy injection of mocks).

Upvotes: 1

Related Questions