3-Tier Web Architecture–Microsoft’s opinion
The past few weeks, Microsoft has been providing tutorials on creating multi-tiered development layers for web sites. Cool.
When working with data one option is to embed the data-specific logic directly into the presentation layer (in a web application, the ASP.NET pages make up the presentation layer). This may take the form of writing ADO.NET code in the ASP.NET page’s code portion or using the SqlDataSource control from the markup portion. In either case, this approach tightly couples the data access logic with the presentation layer. The recommended approach, however, is to separate the data access logic from the presentation layer. This separate layer is referred to as the Data Access Layer, DAL for short, and is typically implemented as a separate Class Library project. The benefits of this layered architecture are well documented (see the “Further Readings” section at the end of this tutorial for information on these advantages) and is the approach we will take in this series.
The issue? Microsoft stresses the somewhat downfall of loosely-typed datasets. Now, don’t get me wrong, strongly-typed objects are a definite pro for troubleshooting and such, but given the nature that these resultsets are strongly defined in your stored procedures, it just seems like more of a compile-time overhead than a performance benefit. But why?
To understand what it means to strongly type something, consider dating. If you are single, what type of person would you consider dating? You may have specific criteria (wealthy and attractive) or it might be short and vague (living and breathing). Whatever your qualifications are, you inevitably have a standard of some type that you use when you decide who to spend more time with. If you’re wise, a thoughtful list will save you from unnecessarily painful emotional trauma.
What’s wrong with living and breathing? Eesh! I guess I’m not picky with dating or my data. 😉 I’ll give it a shot on my next project, but… it still seems repetitive if you’ve already set this up in your stored procedures. 😉