Microsoft Visual Basic Design Patterns (Microsoft Professional Series)

[Previous] [Next]

I have created a home security system, located on the companion CD, to illustrate the benefits of local/remote transparency coupled with optimal performance. The home security system allows the user to activate or deactivate particular features either from within the home through a direct link on a desktop computer or remotely with a laptop computer through a dial-up line. The remote access enables home owners to rest assured that their property is secure even when they are out of town. A great selling point of my system is that—unlike the competition—interfacing with the system through a dial-up line instead of the direct link has almost no noticeable performance difference. Hence, home owners have confidence in the system whether they are at home or away.

OK, my home security system doesn't really work, but it is a fully functioning simulation. Of course, the main focus here is how I used the Smart Proxy design pattern in my system architecture. Access to the system is transparent to the user whether or not she is at home, because the graphical user interface is the same, the process of connecting is the same, and the performance cost from dialing up is so small as to be unnoticeable. Implementing the Smart Proxy design pattern affords the same benefit from a software development standpoint, which is local/remote transparency without changing the interface to the real object or compromising performance. Table 7-1 lists the components that form the home security system.

Table 7-1. Components of the Home Security System

Components Contents
SecurityLib.tlb (Type Library) Interfaces SecurityGuard and DataStream are compiled here.
RealGuardLib.dll (ActiveX DLL) RealGuard class is defined here.
SecurityProducerLib.dll (ActiveX DLL) Classes SecurityGuardFactory and SmartGuard are defined here.
RemSecureAdvisor.exe (ActiveX EXE) Remote RealGuard instances reside here.
HomeSecure (Standard EXE) Client of an object that supports the SecurityGuard interface.

The home security system exhibits the applicability of the Smart Proxy design pattern; however, it might require the conglomeration of various design patterns to develop the architecture necessary for the system to function correctly. Figure 7-4 paints a clear picture of the home security system process using COM object notation. Following is a brief synopsis that emphasizes the use of the Smart Proxy design pattern, but that includes other dependent pieces that assist in defining the required behavior of the Smart Proxy design pattern. Refer to the sample code on the companion CD for the full disclosure.

Figure 7-4. Home Security system architecture diagram.

Категории