Incorporating Legacy Code


In a perfect world, developers and managers alike would realize the benefits of model-driven development and make the switch away from code-driven processes in one graceful step. Magically, legacy code would be transformed into models, and systems' development would proceed apace. Back in the real world, developers no matter how well-intentioned and eager cannot immediately acquire model-driven development skills nor the tools to drive the process. And even if those acquisitions were to come to pass, there's still a large legacy of code that cannot be ignored.

Like the primarily graphical models that comprise the UML, code is also a model, in that it's an abstract representation of a subject under study. The issue at hand is to establish how to incorporate this form of model into the architecture of MDA.

There are two main approaches to this issue, though of course there are many approaches in between. One end of the spectrum is to generate code forward to a defined interface; the other is to "harvest" the legacy code and store it in a MOF repository.

When generating code from a model, the generated output is text that can have any desired structure. By marking an operation in a model, the text generated for that operation can conform to the API to some legacy or library code. Essentially, the marks act as a reference to the existing code.

Moreover, should the provided interface prove to be less than attractive, developers can construct wrapper code that presents a more desirable interface, and then generate code to that. This allows the legacy or library code to be manipulated "under the covers" without the need to rethink or repartition the marks on the models.

The other end of the spectrum is to harvest the existing code to create a model and store that as instances in a MOF repository. This brings the legacy code into the MDA fold, where all of the standard techniques can be applied.

Of course, there must still be a mechanism to indicate references to the legacy, and that mechanism, as we described above, is marks.



MDA Distilled. Principles of Model-Driven Architecture
MDA Distilled. Principles of Model-Driven Architecture
ISBN: B00866PUN2
EAN: N/A
Year: 2003
Pages: 134

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net