Вы находитесь на странице: 1из 6

ACCESS LAYER DESIGN

Introduction:

These classes also must be able to translate the data retrieved back into the appropriate business objects. The access layers main responsibility is to provide a link between business or view objects and data storage. Three-layer architecture is similar to 3-tier architecture. The view layer corresponds to the client tier, the business layer to the application server tier.

Access Layer Performs Two Major Tasks:


Translate the request: The access layer must be able to translate any data related requests from the business layer into the appropriate protocol for data access. Translate the results: The access layer also must be able to translate the data retrieved back into the appropriate business objects and pass those objects back into the business layer. The design is tied to any base engine or distributed object technology such as CORBA or DCOM. Here we can switch easily from one database to another with no major changes to the user interface or business layer objects. All we need to change are the access classes methods. A Date Base Management System (DBMS) is a set of programs that enables the creation and maintenance (access, manipulate, protect and manage) of a collection of related data. y The purpose of DBMS is to provide reliable, persistent data storage and mechanisms for efficient, convenient data access and retrieval. y Persistence refers to the ability of some objects to outlive the programs that created them. y Object lifetimes can be short for local objects (called transient objects) or long for objects stored indefinitely in a database (called persistent objects). y Most object-oriented languages do not support serialization or object persistence, which is the process of writing or reading an object to and from a persistence storage medium, such as disk file.

y Unlike object oriented DBMS systems, the persistent object stores do not support query or interactive user interface facilities. y Controlling concurrent access by users, providing ad-hoc query capability and allowing independent control over the physical location of data are not possible with persistent objects. y The access layer (AL), which is a key part of every n-tier system, is mainly consist of a simple set of code that does basic interactions with the database or any other storage device. These functionalities are often referred to as CRUD (Create, Retrieve, Update, and Delete). y The data access layer need to be generic, simple, quick and efficient as much as possible. It should not include complex application/ business logics. y I have seen systems with lengthy, complex store procedures (SP), which run through several cases before doing a simple retrieval. They contain not only most part of the business logic, but application logic and user interface logic as well. If SP is getting longer and complicated, then it is a good indication that we are burring were business logic inside the data access layer. Layered design and the data access layer: Layered application designs are extremely popular because they increase application performance, scalability, flexibility, code reuse, and have a myriad of other benefits that I could rattle off if I had all of the architectural buzzwords memorized. In the classic three tier design, applications break down into three major areas of functionality: y The data layer manages the physical storage and retrieval of data. y The business layer maintains business rules and logic. y The presentation layer houses the user interface and related presentation code. Inside each of these tiers there may also exist a series of sub-layers that provide an even more granular break up the functional areas of the application.

The Presentation Layer :

In the presentation layer, the code-behind mechanism for ASP.NET pages and user controls is a prominent example of a layered design. The markup file defines the look and lowest of the web form and the code behind file contains the presentation logic. It's a clean separation because both the markup and the codebehind layers house specific sets of functionality that benefit from being apart. Designers don't have to worry about messing up code to make user interface changes, and developers don't have to worry about sifting through the userinterface to update code.

The Data tier :


We also see sub-layers in the data tier with database systems. Tables define the physical storage of data in a database, but stored procedures and views allow we to manipulate data as it goes into and out of those tables. we need to denormalize a table and therefore have to change its physical storage structure. If we access tables directly in the business layer, then we are forced to update were business tier to account for the changes to the table. If we use a layer of stored procedures and views to access the data, then we can expose the same logical structure by updating a view or stored procedure to account for the physical change without having to touch any code in were business layer. When used appropriately, a layered design can lessen the overall impact of changes to the application.

The business tier:


Business Tier Business Tier is the layer responsible for accessing the data tier to retrieve, modify and delete data to and from the data tier and send the results to the presentation tier. This layer is also responsible for processing the data retrieved and sent to the presentation layer. BLL and DAL Often this layer is divided into two sub layers: the Business Logic Layer (BLL), and the Data Access Layers (DAL). Business Logic Layers are above Data Access Layers, meaning BLL uses DAL classes and objects. And of course, this brings us to the topic of business objects and the Data Access Layer (also known as the DAL), two sub-layers within the business tier. A business object is a component that encapsulates the data and business processing logic for a particular business entity. It is not, however, a persistent storage mechanism. Since business objects cannot store data indefinitely, the business tier relies on the data tier for long term data storage and retrieval. Thus, were business

tier contains logic for retrieving persistent data from the data-tier and placing it into business objects and, conversely, logic that persists data from business objects into the data tier. This is called data access logic.

Design principals in the data access layer:


The objective of the DAL is to provide data to were business objects without using database specific code. We accomplish this by exposing a series of data access methods from the DAL that operate on data in the data-tier using database specific code but do not expose any database specific method parameters or return types to the business tier. We use the method calls in the DAL instead of calling directly down to the data tier. This pushes database-specific code into the DAL and makes data in the data-tier using were business object database independent. The benefit is that the DAL resides in its own assembly and exposes database-independent method signatures. We can easily create another DAL with the same assembly name and an identical set of method signatures that supports a different database. Since the method signatures are the same, were code can interface with either one, giving we two interchangeable assemblies. And since the assembly is a physical file referenced by were application accomplish this by exposing a series of and the assembly names are the same, interchanging the two is simply a matter of placing one or the other into were application's bin folder.

2MARKS

1. What is the idea behind creating an access layer? The main idea behind creating an access layer is to create a set of classes that know how to communicate with the place(s) where the data actually reside. Regardless of where the data reside, whether it be a file, relational database, mainframe, Internet, DCOM or via ORB, the access classes must be able to translate any data-related requests from the business layer into the appropriate protocol for data access. 2. What are the two major tasks that access layer performs? Translate the request: The access layer must be able to translate any data related requests from the business layer into the appropriate protocol for data access. Translate the results: The access layer also must be able to translate the data retrieved back into the appropriate business objects and pass those objects back into the business layer. 3. What is DBMS? A Date Base Management System (DBMS) is a set of programs that enables the creation and maintenance (access, manipulate, protect and manage) of a collection of related data. 4. What is the purpose of DBMS? y The purpose of DBMS is to provide reliable, persistent data storage and mechanisms for efficient, convenient data access and retrieval. y Persistence refers to the ability of some objects to outlive the programs that created them. y Object lifetimes can be short for local objects (called transient objects) or long for objects stored indefinitely in a database (called persistent objects). y Most object-oriented languages do not support serialization or object persistence, which is the process of writing or reading an object to and from a persistence storage medium, such as disk file.

5. Layered application design are extremely popular why?

They increase y application performance y scalability y flexibility y code reuse 6. What are the functionalities of layered application design? y The data layer manages the physical storage and retrieval of data. y The business layer maintains business rules and logic. y The presentation layer houses the user interface and related presentation code. 7. Define data access logic? Business tier contains logic for retrieving persistent data from the datatier and placing it into business objects and, conversely, logic that persists data from business objects into the data tier. This is called data access logic. 8. Describe business tier? Business Tier is the layer responsible for accessing the data tier to retrieve, modify and delete data to and from the data tier and send the results to the presentation tier. This layer is also responsible for processing the data retrieved and sent to the presentation layer. 9. What are the two sub layers of business tier? y Business Logic Layer (BLL) y Data Access Layers (DAL) 10. What are the benefits of data access layer? y The DAL resides in its own assembly and exposes database-independent method signatures. y We can easily create another DAL with the same assembly name and an identical set of method signatures that supports a different database.

Вам также может понравиться