开发者

Alternatives to NTier architecture for web apps

I was recently discussing with colleagues a push toward disciplined n-tier structure for our web application. It struck me that I couldn't think of any alternative.

Is it 开发者_开发知识库always the case that one should seperate out web applications into layers?


An alternative to the traditional N-tiered architecture is the Command-Query Responsibility Segregation (CQRS) architecture as discussed by Udi Dahan.

Like all architectural decisions you should really think about when to use it as discussed here

Personally, I tend to see a lot of "over architecture" in my software travels which can really over complicate matters and make things much more difficult to maintain and obviously cost a lot more too. You really need to think a lot about the business problem first rather than just picking an architecture.

Keep things as simple as possible for best results and easy refactoring.


Is it always the case that one should seperate out web applications into layers?

You should separate different logical parts of your system to avoid them being tightly coupled which turns makes them and more reusable. Into what you separate them is not really that important. You can call it layers or whatever.

Actually there could be 2 meanings of those layers:

  1. Physical boundaries: client browser, web server, web services server, backend database, ...
  2. Logical boundaries: GUI, service layer, DAL, ...

You might also take a look at the Onion Architecture. But onions still have layers :-)


It is highly recommended to read Microsoft Application Architecture Guide, 2nd Edition.

Then, you'll realize how important that separation is for every site which is anything more than 2 simple web pages or so.

It is a thorough guide that explains every layer's roles and responsibilities and how they all play together in a robust & scalable application.

You don't have to read it all, but for the beginning take a look at Chapter 5: Layered Application Guidelines.


There is an alternative "pattern" to Layered Architecture.

But it is the anti pattern that the Layered Architecture is trying to solve. Namely the "Big Ball Of Mud" :)

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜