N-Tier Architecture
Contents
Why an N-Layered Architecture?
Using an N-Layered architecture for your ASP.NET applications brings a number of benefits, such as:
Visual Studio Template
http://opengax.codeplex.com/releases
http://layerguidance.codeplex.com/
Separation of concerns -
by putting code in separate layers, you separate the various parts of your application, such as data access, business logic and the UI. This makes it easier to design and build the application and makes it possible for developers in multiple
disciplines
(database, server side programming, frontend development, design) to work on the application in parallel.
Abstraction
With a layered architecture it's easier to look at a complete application and understand the roles and responsibilities of individual layers and the relationship between them. Each layer has its own responsibilities which allows you to analyze them in isolation.
Testability
with a layered architecture, it's much easier to test each layer separately with unit tests as there are fewer dependencies between the various layers. This means, for example, that you can test your business logic or your UI without requiring a real database to test against.
Replaceability
It'll be easier to swap out layers. For example, you can replace your data access technology without affecting the other layers higher up in the stack.
Reuse
You can reuse one or more layers in different applications. You'll see the benefits of this in part 6 through 9 where the same data access and business layers are reused in four different frontend applications without requiring any changes to the lower layers.
Note that there is a big difference between N-Layers and N-Tiers. N-Layers deal with separate software layers and helps you group code logically within the application. N-Tiers on the other hand deals with the physical location of your software components: e.g. the machines where your code runs. This article series deals with N-Layer exclusively, although you could reuse much of it in an N-Tier application as well.
