Migrate legacy process code for use in a BPOby Dan Walsh
For the DataFlex programmer contemplating the rewrite of legacy applications, it quickly becomes apparent that the new Object-Oriented user interfaces, both GUI and Character-Mode, represent only a portion of the full functionality of an existing application.
Processes that run with little or no input from, or output to, the user, such as some posting routines in an accounting application or a batch import of data transmitted from some outside source, would seem to not require being rewritten to accommodate the new user interface. The access methods for these processes, i.e., the mode of initiation, vary. A relatively short process could be a subroutine contained in the main program. Longer processes are more typically contained in separate program files that are initiated using the CHAIN command or initiated from a menu system with minimal or no user intervention. These traditional access methods are not always compatible with the object-oriented programming style. Migrating Legacy Process Code for Use in OOP Style Programsby Dan walsh Is the developer faced with the prospect of time-consuming rewrites of these processes in order to deliver an updated product to his customer? While some re-coding is necessary, the answer, as presented in this paper, is no.
The questions then, are what is the method for making this transition and how long a process will it be? The purpose of this paper is to describe a relatively quick method for moving legacy process code to the object-oriented paradigm using the Business Process Object (BPO). Presented in this paper are three coded examples of a business process that converts a quotation to an order. The first is the process in its original format. The second is a minimal rewrite in which the original code is encapsulated in an object structure, and the third, a fully converted object-oriented code segment complete with data dictionary support. This last example will also show the replacement of all obsolete coding as recently directed by DAC. The first example shows the original code in the form of a small, self-contained program accessed using CHAIN WAIT syntax. The program is passed one parameter on the command line, the quote number or ID. It finds the quote, creates an order header record and then, in a subroutine, creates the order detail records. Inventory is updated as order detail records are created, with the Customer record updated and the quote record stamped as an order at the end of the process.
The second example shows the minimal rewrite of the original code, the "Drop & Pray" approach. This description is born of the author's experience of having to move legacy code to a newly created Order Entry program for demonstration at a trade show. The code in question had been written by another programmer and involved a reasonably complex, industry-specific process. Facing a deadline, the following approach allowed the incorporation of the process with a minimal rewrite and without the programmer needing a full understanding of exactly what the code did! The lesson is, code that works, works. The premise is that, while there is a more accepted coding style for business processes, legacy code can, when necessary be made to work with a minimal amount programming time. The following details the steps used to move the original code to our second example. The steps can be followed in the second example code segment.
.
This completes our initial repackaging. With a minimum of re-coding we have moved our legacy code into an object package file that can be "used" in any main program and accessed by sending a message that the business process object understands. Our next challenge, when time allows, is to incorporate a data dictionary structure and make our BPO conform to the same business rules we have established for our data entry objects.
Our third example moves the process to a fully converted object-oriented code segment complete with data dictionary support. Compare examples 2 and 3 through the following steps.
These changes complete the migration process from legacy code to object-oriented code. In the process, we have demonstrated a method to effect a minimal, object-oriented coding style for those situations that require legacy code to become part of a new user interface but where time constraints prohibit a total rewrite. |
|||||||||||
Copyright © 1999 - 2024 VDF-GUIdance on all material published, for details see our Disclaimer. |