Friday, November 23, 2007

Multi-Tiered/Layered Applications

Developing your applications so that they make use of multiple layers and tiers is a good thing. It allows you to separate and consolidate code so that your code is cleaner, easier to maintain, and scalable. Although it is a pain to get started with this, once a few basics are understood it makes development of applications that require logic considerably easier.

Layering your code separates functionality so that code that is not related stays separate, at least as separate as it can be. Having all of your data access code in one place makes maintenance far simpler. It also keeps your code insulated from those who would use it against you.

Most systems that are broken into layers will use a three layered system. Those layers include the Data Access Layer (DAL), the Business Logic Layer (BLL), and the Presentation Layer (PL)

On a single layer system everything is coded into the PL. So when you throw a FormView on a page and then set up a SQLDataSource you are combining the business logic and data access.

This is fine for prototyping as it is quick and easy to set up, but in many ways it is too limiting and often encourages bad coding practices. (For example, nesting data in master-detail becomes extremely difficult when you are attempting to nest datalists.)

In the coming posts I will attempt to outline code that works so as to provide a guide for myself and for others who are trying to accomplish more complicated web application design.

No comments: