ARTICLE

Importance of Data Access Layer

Posted by Krishnan LN Articles | ADO.NET in C# January 19, 2006
This article is written to see the importance of having a separate Data Access layer.
Reader Level:

This article is written to see the importance of having a separate Data Access layer.

A good data access layer is critical for most business applications, whether that layer resides on a middle tier application server, a web server or on the client. Data access layers tend to involve a lot of error-prone, repetitive coding if you try to do it by hand. You can alleviate some of that by designing a good set of base and helper classes to encapsulate the repeating patterns, or by using a code generation tool. However, you still usually have to write all the data access methods by hand for the ad-hoc queries that service large parts of your application.

Now let me talk about the 3 tier architecture

The GUI layer

The GUI is the "top layer". It contains all things that are visible to the user, the 'outside' of the system, such as screen layout and navigation.

The GUI layer has techniques like HTML, CSS, Applet, Servlet, JSP, JHTML.

The Business layer

This is the core of the system, the linking pin between the other layers. Business-objects and data storage should be brought as close together as possible, ideally they should be together physically on the same server. This way - especially with complex accesses - network load is eliminated. The client only receives the results of a calculation - through the business-layer ofcourse.

Database Layer

The database layer takes care of persistency. An object from the database layer can write itself to one or more tables. In the database layer you'll find things like database, connection, table, SQL and result set.

Advantages

  • With the right approach the 3-tier architecture saves development manpower. Code each bit only once, with powerful re-usage. 
  • Divide and conquer strategy. Every layer is rather easy to develop. Better have 3 simple parts that one complex whole. 
  • Quality. For each layer a specialist can contribute specific expertise, a GUI Designer for the user interface, a Java programmer for the object layer, and a Database Designer for the tables.

With this article,I have attached the project for Data layer implementation in c#.

Login to add your contents and source code to this article
post comment
     

Can you please let me know how do I deploy this 3 tier Architecture Web Applicaiton? What I mean is I can deploy this in below mentioned different ways: 1) GUI and Business layer in one server and Database on other server. 2) GUI on one server and Business Layer and Database on other server. 3) All 3 layers on 3 different servers 4) All the three on one server. When I need to think about scalability 1) Which would be the best option? 2) If I go with option 2 and have deployed GUI layer in multiple servers(for Load balancing) can you please tell me how will GUI layer access the Business layer? Hope to hear from you soon. Thanks and regards Shashi J K

Posted by Shashidhar K Feb 20, 2009

can u send me a complete small web application in which it has all the three layers,say UI , BL, DAL. for ex. like add,delete,update etc in any emp or cust table.

Posted by roushan kumar Feb 27, 2008

The article mentions a Database Layer when it should be talking about the importance of a data access layer. The DAL is made up of the c# classes that access the tables and views in the database through stored procedures, it doesn't contain the database, the connection, the SQL or the table, these are all false statements. The database connection is normally held in the web.config, the SQL in the stored procedures and the tables on the database, normally on a separate server from the 3 tier code for security.

Posted by Paul Scully Nov 30, 2006

where can i find the project attached?

thanks

Posted by Dong Yang May 09, 2006

where can I download the source?

thanks

Posted by Francesco Mar 21, 2006
COMMENT USING
PREMIUM SPONSORS
Over-C is a holistic consortium of communications and technology specialists. We build, deploy and market both business as well as consumer products and solutions.
Join a Chapter
SPONSORED BY
  • PDF reports have never been easier to create. With our included WYSIWYG Designer, you can layout your reports, set up your data source and let DynamicPDF ReportWriter do the rest.
Join a Chapter