[ 1 ] [ 2 ] [ 3 ] [ 4 ] [ 5 ] [ 6 ]
Now lets look at a more complex design, the three layered model.
In this three-layered design we have introduced a layer titled Business Logic. This layer is responsible for enforcing the business rules on the data. The raw data is stored in the data storage layer. The presentation layer is responsible for displaying the data to the user and for accepting input from the user. The new business logic layer is responsible for formatting the data into information based on the business rules and for enforcing constraints on the user’s input based on the same business rules
This layered design can be carried further into 4, 5, and 6 to n layers. Below is an example of a 4-layered design
It is this 4-layered design that we will be implementing later in this seminar.
The advantages of the multiple-layered design are found in the maintenance and evolution stage of the application’s lifetime. As technologies and functionality requirements change over time it is easier to adapt the multi-layered application than it is a single layered design.
The level of componentization achieved will directly influence the amount of effort needed to adapt the application the new re
quirements. Consider the figure below;
Since the design is more complex than the single or two layer design, the implementation will also be more complex. When compared to pure VFP single layered design data access performance may be affected. Because of the nature of the data access mechanisms the presentation layer’s user interface design may be affected.
Although these are listed as disadvantages, they can be more accurately described as effects of the multiple layered architecture. This is because they may or may not have a negative impact, in fact, their impact may be positive.
The following diagram shows the multi-layered design that we will build in this seminar. This design uses 4 layers divided into Presentation, Business Logic, Data Access, and Data Storage.
The concentric circles are used to demonstrate that the layers only communicate with the adjacent layer and never skip a layer. That is the presentation layer only communicates with the business logic layer and the business logic layer only ever communicates with the data access layer.
Our exercise in this seminar is to create an application architecture design that can be used to build applications that meet certain requirements. The requirements are as follows:
In reviewing these requirements we can see that our architecture must be very flexible indeed. While we can depend on the features of VFP for our current work, we cannot afford to force the architecture to require VFP for its implementation. In other words, whatever architecture we design must be capable of being written in many different development languages.
In addition to the above issue we have to deal with the special needs of a web based data application in our architecture. The web has some special issues related to it that simple LAN based applications don’t need to address. One of the most important issues has to do with the simple fact that in a web situation the client machine is not constantly in contact with the server machine. This means there is a “disconnected” environment in effect.
Also in the web situation our business rules code cannot hold any “state”. This means that from one call to another the business objects cannot assume anything about the context in which they operating, they cannot assume records pointer positions, data values, or anything else. Why, because they may be receiving calls from different clients sequentially. Study the following two diagrams for a moment.
In the LAN configuration the clients are always connected to the server, and there are known number of clients. In the Internet configuration the clients are not always connected, a client will connect, make a request, get a response and then disconnect from the server. The types of connections can vary widely on the Internet. Then number of clients is never really known by the server and can vary widely in a very short period of time.