Having introduced the advantages and new features of .NET in Chapter 1 and successfully developed a prototype to evaluate this technology in Chapter 3, we now lay the groundwork for the implementation. To develop a good design, we must provide an important part that is still missing: the analysis of the requirements. This analysis describes "what" the system is supposed to do. When we have finished the initial analysis, we can derive the designthe "how" of implementing the systemfrom it. |
For Online Photo Shop, we conduct a high-level analysis to show the various modules and packages of the project, their grouping, and a sequence diagram. In the elaboration phase (Chapter 5), we will show how to do a more detailed analysis and how to derive the architecture from the analysis.
The first step in analyzing the requirements and developing the high-level, overall system design is to identify the underlying structure of the product. From the requirements, we identify three distinct parts: the Online Shop part, a photo-editing part, and an image-processing part. Each of the parts has its own focus on functionality.
Analyzing the requirements further shows that there are very limited dependencies between the three parts, and therefore the system is divided into the three packages. Figure 4.10 shows a UML package diagram, which is fairly simple for the Online Photo Shop project because there are limited dependencies between the packages. Furthermore, the analysis shows that there are no anticipated dependencies between the Online Photo Shop and the image-processing library.
Figure 4.10. Package Diagram for the Online Photo Shop
4.6.1 The Photo Editor
Preparing a digital photo for printing can involve many, sometimes computationally expensive steps. Furthermore, users seldom accomplish the desired result on the first try, and when that happens they start over with a new image from scratch. Driven by the fact that photo postprocessing is typically an offline task, we implement the photo editor as a smart client application that can be downloaded from the business's Web site. The photo editor will provide the customer with a graphical user interface (GUI) to prepare an image for printing. Figure 4.11 shows a UML sequence diagram that illustrates a typical workflow for the Online Photo Shop system.
Figure 4.11. Sequence Diagram for Online Photo Shop
Sequence diagrams are used to visualize interactions among systems or objects, in this case the customer, the photo editor, the image-processing library, the online shop, and the business. These are shown as boxes at the top of a sequence diagram. The vertical lines are called lifelines and represent the life of the object or system that they are connected to during an interaction. Arrows can be connected between lifelines, showing messages or actions. The sequence of occurrence is always top-down.
4.6.2 The Image-Processing Library
All image-processing algorithms are encapsulated in a library. This allows their use in new projects or, if necessary, in the online shop Web application.
4.6.3 The Online Shop
Web Forms
The online shop allows customers to select products on the business's Web site and place them into a shopping cart. At any time a customer can proceed to checkout and complete the order by providing the business with payment and shipping information. Therefore, the main online shop implementation will be implemented in those two Web forms:
Code Behind
The implementation of Online Photo Shop uses ASP.NET's code behind technology, which means that the logic is separated from the presentation. If you don't separate the logic (code) from the presentation (design), it is very difficult to maintain the software. Each change in the design of a Web page can potentially break the code that is embedded in it. Creating Web forms using the Microsoft Visual Studio template separates code from design using code behind.
State Management
HTTP is a connectionless protocol and therefore is stateless. This means that a request to a Web server cannot rely on any previously made requests and must carry all necessary information to generate a response. To overcome this problem, ASP.NET introduces three methods of state management, which allow the Web server to store information for each client in a session object.
Figure 4.12. System Diagram for Online Shop
4.6.4 Defining Architectural Requirements
During the process of defining the initial architecture of the product, it is a good practice to describe architectural constraints in the form of new requirements that must be fulfilled in the implementation. The advantage of doing so is that the requirement key tracing takes care of making sure that the implementation was done according to the initial architecture document and that no new measurements must be implemented for this verification. Table 4.6 shows a list of requirements that apply to the online shop.
Requirement |
Type |
Summary |
---|---|---|
online_shop_codebehind |
Constraint |
Web forms shall be created using the Visual Studio Web Form wizard and follow separation of code and design (code behind). |
online_shop_stateservice |
Constraint |
To allow for future scalability, the ASP State service shall be used to implement session management. "Scalability" refers to the ability of the Web service to handle parallel requests on multiple servers for load balancing and the possibility of adding more servers if necessary. |
imageprocessing_library |
Constraint |
All implementations of image-processing algorithms that go beyond the provided functionality of the .NET Framework Class Library shall be encapsulated in a separate library. |
Introducing .NET
Introducing Software Engineering
A .NET Prototype
Project Planning
The Photo Editor Application
GDI+ Graphics Extensions
Advanced GDI+ Operations
Dynamic Loading of Components
Accessing System Resources
Performance Optimization, Multithreading, and Profiling
Building the Web Application with ASP.NET
Security and Database Access
Product Release