Best Approach to Designing Three-Tier Systems

Question:

I am aware of the recommended approach to developing three-tier systems?for example, presentation layer to business objects to data objects. Say I have a system that has a data object named ICustomer and a method called GetDetails(…) which returns customer details. I have an ASP page/Win32 app that wants to get the customer details for display. Should it go direct to the data object (this breaks the “rules” of exposing the data objects) or go through an intermediary business object (which is just a wrapper with no functionality and just delegates the call to the data object)? Obviously this call does nothing but add an extra layer and degrade performance due to having to create an intermediary object.

Answer:

This is really a great question! It is also one to which there may be no definitive answer. You may get a different answer from every person you ask, but here is my take on it. I have created a “pure” data access object. I reuse that object in many different projects. This data access object has functions such as OpenConnection() and GetRecordset(). Those functions contain code that accesses and uses ADO objects to do the nitty-gritty work of accessing data stores.

For individual projects, I create project-specific objects that reference and use the “pure” data access object. The project-specific object will call OpenConnection(), GetRecordset(), and others. Also, the project-specific object usually does not contain code that references ADO objects because the “pure” data access object does that work. In addition, the project-specific object can focus on processing the data that is returned in the recordsets and passing relevant information (not data) to the client.

From a performance standpoint, you are correct: there is an extra layer that consumes resources. However, from an application management perspective, and from a coding perspective I have found that the extra layer is justified.

Share the Post:
Share on facebook
Share on twitter
Share on linkedin

Overview

The Latest

microsoft careers

Top Careers at Microsoft

Microsoft has gained its position as one of the top companies in the world, and Microsoft careers are flourishing. This multinational company is efficiently developing popular software and computers with other consumer electronics. It is a dream come true for so many people to acquire a high paid, high-prestige job

your company's audio

4 Areas of Your Company Where Your Audio Really Matters

Your company probably relies on audio more than you realize. Whether you’re creating a spoken text message to a colleague or giving a speech, you want your audio to shine. Otherwise, you could cause avoidable friction points and potentially hurt your brand reputation. For example, let’s say you create a

chrome os developer mode

How to Turn on Chrome OS Developer Mode

Google’s Chrome OS is a popular operating system that is widely used on Chromebooks and other devices. While it is designed to be simple and user-friendly, there are times when users may want to access additional features and functionality. One way to do this is by turning on Chrome OS