Previous Topic: Specifying Parameters

Next Topic: Method Types


Uses of the Three-Level Structure

The three-level structure for parameters is useful for reducing the number of times you have to specify a parameter's value. For example, consider the NMPAGE program. You can define a method for each different pager service you use. Therefore, for each pager service, you only need to define parameters like the pager service phone number, baud rate, and modem initialization string once. Also, you only need to define the pager ID for each person once at the personal level, rather than in every time block that needs to page the person. On the other hand, if the person needs to be notified using a different paging service or pager ID during a particular time block, you can specify those parameters at the time block level and they will override the method and personal level values.

Combined with the method concept, parameters also allow you to minimize data entry by giving parameters a more specific meaning. For example, recall that the voice at work and voice at home methods both use the NMVOICE program. The NMVOICE program does not have a HomePhoneNumber and a WorkPhoneNumber parameter; it has a single Phone() parameter, which is the phone number to call. However, because you have defined two different methods that point to the NMVOICE program, you only need to specify your home and work phone numbers once at the personal level for the two methods.

As you can see, defining a single method to be used when invoking a particular program usually means that you have to specify many parameters at the personal or time block level. Giving a program multiple "personalities" by creating more than one method to be used when invoking it allows you to fix parameters at the method or personal level, thereby letting you specify far fewer parameters at the more specific levels. Consequently, your maintenance overhead is greatly reduced.

On a separate note, you should be aware that when you are creating a method to specify a parameter at the time block or personal level, you must specify it at the method level (even if you specify a null or dummy value at that level). An example of this rule is the PHONE parameter of the NMVOICE program. It is highly unlikely that you will create a unique method for each phone number you want to call. Nevertheless, you must specify the PHONE parameter whenever you create a method that uses the NMVOICE program; otherwise, you cannot specify the phone number to use for a particular time block or contact.