Model Driven
Model Driven
EXTENDED-
REAL
ROOT-
INTERVAL CONVERGENCE- MACHINEEPS
TEST
BRACKETED-
INTERVAL
EQUALS-ZERO
CANDIDATE-
POINT-
GENERATION NARROW
OPEN BRACKETED
No
For example, the INTERVAL specification needs possible to
Yes
to import from the REAL specification because interpolate
and NARROW).
Finally, and most interestingly, are the two Figure 5. Abstract Flow Chart for ZBRENT
colimit morphisms denoted by dashed lines
Figure 5 contains a high-level flow chart computation of q. In Figure 6b, the (embold-
for ZBRENT. Although the box labels in the fig- ened) phrase div(fa1,pToNZReal(fc1)) describes
ure are expressed in terms of domain concepts, the earlier computation of q on line (1) of Fig-
no such labels occur in the source code. Con- ure 6a; the (emboldened) phrase r(fb1,fc1)
nections between source code constructs and describes the specification of (the program
domain concepts only emerge through signifi- variable) r on line (2) as an operation (also
cant iterative reverse engineering. The outer named) r applied to two parameters, fb1 and
loop of the source code wraps the shrinking fc1.
process and ensures termination by counting (1) q = fa / fc;
(2) r = fb / fc;
iterations. Within this loop, it is possible to ter-
(3) q = (q-1.0) * (r-1.0) * (s-1.0);
minate successfully if either the root has been
found (node labeled root found) or the inter-
val itself has grown too narrow (converged). Figure 6a. Source Code Fragment for Inverse
If termination is not warranted, a check is Quadratic Interpolation Computation
made to see whether interpolation is promising
(possible to interpolate). In this case, either
op q : Real, Real, Real, Real -> Real
secant or inverse quadratic interpolation is definition of q is
chosen. If neither of these methods produces a axiom q(s,fa1,fb1,fc1) =
bracketed value, then bisection is used. Finally, times(minus(div(fa1,
the interval is updated with the appropriately pToNZReal(fc1)),one),
chosen subinterval. times(minus(r(fb1,fc1),
one), minus(s,one)))
The SLANG specification of the ZBRENT
end-definition
algorithm consists of a rendering of the flow
chart boxes with axioms. In essence, this com-
prises the following activities:
Figure 6b. SLANG Specification for Inverse
• Define operations corresponding to the
Quadratic Interpolation
various computations performed, nesting
operation invocations where appropriate.
• Make use of a built-in SLANG construct for
rendering conditional statements. Interpretations. Once the program model is
• Use recursion to model iteration. constructed for the ZBRENT algorithm, inter-
• Render assignments by passing the result- pretations can be defined to indicate how
ing state to subsequent operations. domain concepts are mapped to program con-
During the course of performing these structs. For the fragment shown in Figure 6, an
steps, a software engineer is forced to pay interpretation must be defined that maps the
attention to each of the program constructs, domain specification of INVERSEQ to the set
thereby increasing thoroughness. Moreover, of operations that realize it in the program
the various operations and axioms produced model.
become the targets of the interpretations The SLANG model of the ZBRENT algorithm
devised during the third step of the reverse is thorough in the sense that a program equiva-
engineering process. lent to the original can be generated from it.
Figure 6a contains a segment of the origi- However, by itself, it sheds no light on how the
nal program text for the box labeled inverse algorithm accomplishes the goal of finding a
quadratic interpolation in Figure 5. Figure 6b root. The SLANG interpretations are used for
contains the corresponding SLANG operation this purpose. In particular, an interpretation
definition for line (3) of Figure 6a, the second indicates precisely how an abstract domain
concept is manifested in the program. For adequate testing to provide an objective and
example, an interpretation between the domain deterministic standard.
specification EQUALS-ZERO and the program Amortizing the cost of domain modeling.
model construct corresponding to the box The process of reverse engineering ZBRENT
labeled root found gives a precise indication included the construction of a domain model
of the purpose of the program construct (pro- for root finding, requiring significant back-
gram termination check). To the extent that ground research. Fortunately, this activity only
each aspect of the algorithm specification is has to be done once regardless of how long the
tied to an application-domain concept, the program is maintained. And if other root find-
combined domain and program models are ing programs are being maintained, it is likely
judged lucid. that they can share the domain model. In other
words, domain modeling has a value that goes
Applying model-driven reverse engi- beyond the reverse engineering of a single pro-
neering gram—its cost can be amortized across subse-
A fixed standard for thoroughness and quent maintenance activities for the same and
lucidity would enable the maintenance man- related programs.
ager to better control the reverse engineering
process. An analogy exists with tools like We have described a particular approach to
COCOMO [3] and SLIM [10] that are used to Model-Driven Reverse Engineering. The
estimate project schedules. These tools use a approach uses a formal specification model
database of past experiences as a standard and code generator to reverse the reverse engi-
against which current projects can be mea- neering process. Models are used to describe
sured. Similar projects predict similar sched- both the application domain and the program
ules. Likewise, if adequacy standards for being reverse engineered. Interpretations are
reverse engineering efforts existed, then expe- used to annotate the connections between the
rience data could be collected and used to pre- two. Being able to generate a similar version
dict reverse engineering effort. of a program allows managers to have a fixed
An additional benefit accrues to adequacy target for a reverse engineering effort. This, in
standards. Currently, a variety of reverse engi- turn, can enable better effort prediction and
neering tools exist in the commercial market- quality evaluation, thereby reducing develop-
place. But their benefits are hard to judge ment risk.
because there is no agreed-upon standard for
the quality of the representations they produce. Acknowledgement
An adequacy standard would allow direct Part of the work described here was sup-
comparisons to be made, indicating, for exam- ported by the National Science Foundation
ple, that one tool provides a more thorough under grants CCR-9708913, EIA-0000433 and
description than another. CCR-9984726. We also appreciate the contri-
Relative adequacy. The adequacy criteria pre- butions of Terry Shikano to the development
sented above were relative rather than absolute of the example presented in this paper.
standards. For example, lucidity is relative to
the level of abstraction required of the reverse References
engineering. Thoroughness is also relative to [1] Guillermo Arango and Rubén Prieto-Díaz.
the suite of tests used to determine equiva- Domain Analysis and Software Systems Model-
lence. Here, we leverage what is known about ing. IEEE Computer Society Press, 1991.
[2] Victor R. Basili and Harlan D. Mills. “Under- [8] Object Management Group. “Unified Modeling
standing and Documenting Programs.” IEEE Language, Version 1.4.” OMG Document Num-
Transactions on Software Engineering, SE- ber 01-09-67, http://www.omg.org/cgi-bin/apps/
8(3):270-283, May 1982. doc?formal/01-09-67.pdf.
[3] Barry W. Boehm, Bradford Clark, Ellis Horowitz, [9] W. H. Press, S. A. Teukolsky, W. T. Vetterling,
J. Christopher Westland, Raymond J. Madachy and B. P. Flannery. “Root Finding and Nonlinear
and Richard W. Selby. “Cost Models for Future Sets of Equations.” Numerical Recipes in C,
Software Life Cycle Processes: COCOMO 2.0." The Art of Scientific Computing, Second Edi-
Annals of Software Engineering, 1, pp. 57-94, tion, Chapter 9, Cambridge University Press,
1995. 1992.
[4] G. Dalhquist and Å. Björck. “Nonlinear Equa- [10] L. H. Putnam. “A General Empirical Solution to
tions.” Numerical Methods, Chapter 6, Prentice- the Macro Software Sizing and Estimation
Hall, 1974. Problem.” IEEE Transaction on Software Engi-
neering, Volume SE-4, Number 4, July 1978.
[5] G. E. Forsythe, M. A. Malcolm, and C. B. Moler.
“Solution of Nonlinear Equations.” Computer [11] Spencer Rugaber, Terry Shikano, and Kurt
Methods for Mathematical Computations. Stirewalt. “Adequate Reverse Engineering.”
Chapter 8, Prentice-Hall, 1977. Proceedings of the Conference on Automated
Software Engineering, San Diego California,
[6] Wai Ming Ho, J.-M. Jezequel, A. Le Guennec 2001.
and F. Pennaneac'h. “UMLAUT: An Extendible
UML Transformation Framework.” 14th IEEE [12] Douglas R. Smith and Subbarao Kambham-
International Conference on Automated Soft- pati. “Automated Synthesis of Planners and
ware Engineering, 1999, October 1999, pp. Schedulers.” http://www.kestrel.edu/HTML/
275-278. projects/arpa-plan2/index.html.
[7] Kestrel Institute. Specware User Guide, Version [13] Elaine J. Weyuker. “Axiomatizing Software
2.0.3. March 1998. Test Data Adequacy.” IEEE Transactions on
Software Engineering, SE-12(12): 1128-1138,
December 1986.