Abstract
State transition mechanisms are widely used in software engineering to implement state/event-dependent behavior. In C/C++, the implementation of state machines using ‘switch/case’ or ‘if’ statements causes problems in readability, understandability, maintainability, and modification. We have developed both a source code pattern searching tool capable of searching for state machine occurrences and a design pattern to replace state machines with C++ generic components. With ‘ESPaRT’ (Enhanced String Pattern Recognition Tool) we search for state machines in the source code. Examples of patterns for state machine detection are given in the paper. The state machine information is extracted and the state machine code is replaced by generic components following the “generic Harel State Machine Engine” (HSME) design pattern.
This work is funded by the European Commission under ESPRIT framework IV contract no. 20477 ‘Architectural Reasoning for Embedded Systems (ARES)’ and is pursued by Nokia RC Finland, ABB Norway, Philips RC Holland, Imperial College, Technical University Madrid, and Technical University of Vienna.
This is a preview of subscription content, log in via an institution.
Buying options
Tax calculation will be finalised at checkout
Purchases are for personal use only
Learn about institutional subscriptionsPreview
Unable to display preview. Download preview PDF.
References
B. Bellay and H. Gall. An Evaluation of Reverse Engineering Tools. Technical report TUV-1841-96-01. Distributed Systems Department, Technical University Vienna, December 1996.
E. Gamma, R. Helm, R. Johnson, and J. Vlissides. Design patterns: elements of reusable object-oriented software, Addison-Wesley professional computing series. Addison-Wesley, Reading, Mass. and London, 1995.
D. Harel. Statecharts: a visual formalism for complex systems. Science of Computer Programming, 8(3):231–74. North-Holland, Amsterdam, 1987.
M. Jazayeri. Component programming: a fresh look at software components. 5 th European Software Engineering Conference (ESEC’ 95) (Sitges-Barcelona, Spain), pages 457–78, September 1995.
R. Knor. Converting data structures and algorithms from C to C++ applying the Standard Template Library. Technical report TUV-1841-97-16. Distributed Systems Group, Technical University of Vienna, November 1997.
A. Ran. Models for object-oriented design of state. In J. M. Vlissides, J. O. Coplien, and N. L. Kerth, editors, Pattern Languages of Program Design 2. Addison-Wesley, Reading, Mass. and London, 1996.
B. Stroustrup. The C++ Programming Language, Third Edition. Addison-Wesley, Reading, Mass. and London, 1997.
G. Trausmuth and R. Knor. Reengineering of C/C++ programs using generic components. 6 th European Software Engineering Conference (ESEC’ 97)-Workshop on Object-Oriented Reengineering (Zurich, Switzerland). ACM SIGSOFT, August 1997.
L. Wall, R. L. Schwartz, and T. Christiansen. Programming Perl. O’Reilly & Association, Incorporated, 1996.
J. Weidl. Generic components for state machines. Technical report TUV-1841-96-04. Distributed Systems Group, Technical University of Vienna, December 1996. Master’s thesis.
J. Weidl. Raising the source code abstraction level by using generic components for state machines. International Workshop on Development and Evolution of Software Architectures for Product Families (Las Navas del Marques, Avila, Spain), November 1996.
J. Weidl, R. Klösch, G. Trausmuth, and H. Gall. Facilitating program comprehension via generic components for state machines. 5 th International Workshop on Program Comprehension (IWPC’ 97) (Dearborn, Michigan, USA), pages 118–27. IEEE Computer Society Press, May 1997.
Author information
Authors and Affiliations
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 1998 Springer-Verlag Heidelberg Berlin
About this paper
Cite this paper
Knor, R., Trausmuth, G., Weidl, J. (1998). Reengineering C/C++ Source Code by Transforming State Machines. In: van der Linden, F. (eds) Development and Evolution of Software Architectures for Product Families. ARES 1998. Lecture Notes in Computer Science, vol 1429. Springer, Berlin, Heidelberg. https://doi.org/10.1007/3-540-68383-6_15
Download citation
DOI: https://doi.org/10.1007/3-540-68383-6_15
Published:
Publisher Name: Springer, Berlin, Heidelberg
Print ISBN: 978-3-540-64916-8
Online ISBN: 978-3-540-68383-4
eBook Packages: Springer Book Archive