1.4.4 How Reusable Parts can Play a Role

As with all applications, internet-based or not, there may be functionality that needs to be used in more than one place. Again, a good example is the "log on" function (recording the user id, date and time of logon in a database, etc), which may be the same across different WAM applications.

LANSA's Reusable Parts can provide the necessary level of modularity. Simply use the Define_com command to declare the appropriate parts and use them for the Application Logic. Here's an example:

The Logon Webroutine accepts a user id and password from some other Webroutine that is displayed at the Presentation Layer. An instance of the Reusable Part ADHLOGON comes alive and its ValidateLogOnDetails method is used to validate the user id and password. If successful, the #LOGGEDON field (declared as persistent session data) is set to True and control is transferred to the LogOnSuccessful Webroutine. If logon is unsuccessful, control is transferred to the LogOnFailed Webroutine.

As you can see, this is a great technique to ensure your Application Logic is encapsulated in a single place so that it can be used over and over by other WAMs.