开发者

ASP.NET: I'm new to n-tier architecture. Can someone give me a high level overview?

can you please describe what an n-tier architecture is. what is a data access layer? what type of code would typically go into this data access layer class? i have basically the same question for the business access layer. what type of 开发者_如何学运维code typically goes there? finally, can you also explain, in high level, how these layers interact with each other? thanks.


http://en.wikipedia.org/wiki/N-tier

Microsoft Patterns & Practices site is a good resource for this type of stuff. They've published a book ($$$ for print, free-as-in-beer ebook), the Microsoft Application Architecture Guide v2, which has a solid overview and walkthrough of N-Tier: Application Architecture Guide: Design Fundamentals


Google is your friend, as is wikipedia as STW pointed out. You might wanna check out this though - http://weblogs.asp.net/scottgu/archive/2009/03/10/free-asp-net-mvc-ebook-tutorial.aspx as it gives a practical example.


I've been mulling this around in my head for a few years, so I'll just throw it out and see what happens:

N-tier is crap.

When developers first learn about it, they twist their code into all sorts of hideous contortions to make it fit "n-tier". Then (if they are not incompetent) they grow up and just sort of give up on that approach. Then (if they are reasonably competent) they realize that all the other real sorts of architecture, which you have to learn over time and which can't be distilled into this ridiculous one-size-fits-all 3-bucket magic, do frequently (sort of) map to the 3 tiers. But they aren't built on the 3 tiers - you don't start with 3 magic buckets and everything falls neatly into them. 3 tiers simply tend to emerge from a proper design. Starting with 3 tiers is backwards.

So my advice - which may be wrong, I'm just testing this idea out - is don't try to understand 3-tier until you understand all the other, more basic patterns and practices, and you've built some solid software using them. Feedback welcome.


If you're like me, you learn by playing with code rather than reading articles. Here's a little example tutorial.

Oh, and also read up on the difference between a Tier and a Layer. It's a pet hate for some StackOverflowers :)

0

上一篇:

下一篇:

精彩评论

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

最新问答

问答排行榜