BookSale (Booksale.vbg)

This project demonstrates the use of an Automation server to encapsulate the logic of business policies and rules and to provide black box services to an external User Interface component. The client project is dedicated to delivering a clear and intuitive user interface for the user to select control options and view processing results. The client project cares a lot about how the user works and how they use the applications results, but it knows nothing about the business or operational rules of the application. The server component is dedicated to encapsulating business and data access rules into "sanctioned" services that client components use to find the information they need. The server has no idea how the user options are selected or how the results are presented to the user. This lack of specific user knowledge helps keep the server's functionality general, and as a result should increase its reusability potential for other applications. The server also uses class modules to structure the logic of its business and data access rules in a manner that aids development, debugging, readability, maintainability, and source code reusability.

The component can be run on the same machine as the client component, (which can be a significant aid in the development and debugging phases of a project), or it can be run on a remote machine to benefit from the distributed processing power and multi-user access features of a shared network server. The component does not need to be recompiled or changed in any way to support this location independence.

The server in this project uses a visible form purely for demonstration purposes. There is no functional need for the server to have any UI, though state information presented through a UI can help with debugging or run-time monitoring needs. (State monitoring requirements can also be addressed by providing a status method on the server that can be queried by a monitor application.)

File Description
Book_cli.vbp Client component project file.
Book_cli.frm Client main form.
Book_cli.frx Client main dialog graphics file.
Frmchart.frm Client result chart form.
Frmcogs.frm Client cost of goods form.
Book_cli.bas Client main/global utility module.
Book_svr.vbp Server component project file.
Book_svr.frm Server status indicator form.
Book_svr.frx Server status indicator graphics file.
Book_svr.bas Server main/global utility module.
Sales.cls Server main/public class module.
Model.cls Server private business model rule class module.
Taxes.cls Server private tax rule class module.
Booksale.mdb Sample Jet database file.
Booksale.ldb Sample database file created at run time by Jet.
Booksale.txt Text file containing overview information on this sample application.

To Run

From the Visual Basic File menu, choose Open Project and select the Book_svr.vbp file, which is listed in the Samples directory. Press F5 or choose Start from the Run menu to run the server project.

Once running, this project temporarily registers its classes in the system registry. You can then start a second instance of Visual Basic to run Book_cli.vbp, the user interface component that uses the class modules defined in Book_svr.vbp.

Note   The component can be run on the same machine as the user interface component, or it can be run on a remote machine to benefit from distributed processing power and support multi-user access. The component server does not need to be recompiled or changed in any way to support this location independence.