The purpose of this lab is to introduce the application that you will develop throughout the labs in this course. You will be presented with the customer requirements and are encouraged to think about the solution in terms of the MSF models.
Your customer, StockWatch Data Services, Inc. (SDS), is an information services company that specializes in providing stock market information to brokers and fund managers. SDS receives a large volume of data every week in the form of ASCII text files automatically downloaded from mainframe computers around the world. Their request is for an application, which will allow operators in the company data center to load the data contained in these text files, perform visual verification that the data is correct, and upload verified data to a central database server. The application must meet the following requirements:
Figure 1.9 The format of the ASCII download file
Consider how the concepts you learned in Lesson 1 might help you think about the design of your solution from both the logical and the physical design perspectives.
Think about who is going to use the application, and where. The client has initially specified that about 50 users, all in the same Windows NT domain, will be uploading data to a central server. This scenario suggests that you should be thinking in terms of a fairly small-scale client/server application. However, you might consider asking the client about their expansion plans. Is this application likely to grow so that it is distributed across more than one department, or across more than one site? Is the usage of the application likely to grow to the point where insufficient resources (such as concurrent database connections) start to affect the performance of the application?
You might also ask the client if they foresee a need to extend the application to include a Web-based interface. If the company is already running an intranet, you might ask whether it might not be better to host the application inside a browser to allow staff to access the application from any computer anywhere. This option could also simplify deployment and upgrade issues.
You should also consider the business rules that the application is to implement. Consider whether the business rules need to be implemented in their own middle-layer component tier, or whether they can be integrated into the presentation tier or the data tier. The business rules in our scenario are few. The business rule specifying that duplicate rows are not allowed on the database can be taken care of by a primary key constraint—a rule specified for a table that won't allow the addition of duplicate rows to the table. The requirements that relate to the "cleaning up" of garbage data and duplicate lines from the text files can easily be implemented in the client application.
SDS decides that, given their budget and their business projections, an application based on a client/server model will be most suitable for their present requirements. They agree that a two-tier architecture is an appropriate model. However, they reiterate their requirement that the database update modules should be designed for maximum reusability, with the possibility of future expansion in mind.
To meet this requirement, you design the database update module as a set of cooperating components with clearly defined interfaces describing services that can be used by other client applications. You do not need to implement these components as a separate tier—they can be installed as part of the desktop ap-plication and distributed as application DLLs. In the future, however, they can be reused as part of the middle tier of a distributed application.
The physical design of your solution is what comprises the labs in this book. Your client might be surprised that you are using Visual C++ to implement the solution. They might feel that you could develop a solution that is just as adequate, and that you could do so more quickly by using Visual Basic.
Visual C++ does have many features that, in the hands of an experienced C++ developer, allow rapid application development. For example, the MFC AppWizard will be used to generate the basic structure of the client-side application, onto which you will be able build your application-specific functionality. The visual design features of Visual C++ will enable you to quickly develop the UI and link user-interface elements to code. MFC provides efficient, easy-to-use data structures, such as variable-length strings and object collections. The ADO data control can be used to visually design a database query screen in minutes. ATL can be used to implement the reusable component-based database update module that the client requires.
The overall result is that Visual C++ enables you to rapidly develop applications and components that are smaller and faster than those built with any other Windows development tool. Components built using ATL are quite efficient—ATL was created to meet the need for extremely lightweight components in the Internet environment. This means that your clients can be sure that the database access components you will build for them using ATL will be suitable for deployment in future Web-based applications. Also, the use of COM means that the services that the components provide will be available to a wide range of clients on a variety of platforms.
In this first lab, you will simply get acquainted with the STUpload application. Each lab throughout the course will build upon the previous lab so that when you are finished with the course, you will have a complete working application that meets the specification of your imaginary customer, SDS. Your Chapter1\ Lab folder contains the finished version of the STUpload.exe file and the Chapter1\Data folder contains a sample data file Ch1Test.dat, which contains data for you to load into the application and to upload to the database server.
The recommended procedure is to build the STUpload application in the order presented by each lab. Follow the labs in numerical order. Save your work and use it in the next lab to continue developing the STUpload application. If you do not complete a lab, you can start the next lab with the project in the \Labs\Labn\Partial folder, which will allow you to proceed from the appropriate starting point.
You should check your work against the \Labs\Labn\Solution folder project after you complete each lab.
Figure 1.10 The STUpload application