Skip to main content

Reengineering C/C++ Source Code by Transforming State Machines

  • Conference paper
  • First Online:

Part of the book series: Lecture Notes in Computer Science ((LNCS,volume 1429))

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

Chapter
USD   29.95
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
eBook
USD   39.99
Price excludes VAT (USA)
  • Available as PDF
  • Read on any device
  • Instant download
  • Own it forever
Softcover Book
USD   54.99
Price excludes VAT (USA)
  • Compact, lightweight edition
  • Dispatched in 3 to 5 business days
  • Free shipping worldwide - see info

Tax calculation will be finalised at checkout

Purchases are for personal use only

Learn about institutional subscriptions

Preview

Unable to display preview. Download preview PDF.

Unable to display preview. Download preview PDF.

References

  1. 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.

    Google Scholar 

  2. 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.

    Google Scholar 

  3. D. Harel. Statecharts: a visual formalism for complex systems. Science of Computer Programming, 8(3):231–74. North-Holland, Amsterdam, 1987.

    Google Scholar 

  4. 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.

    Google Scholar 

  5. 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.

    Google Scholar 

  6. 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.

    Google Scholar 

  7. B. Stroustrup. The C++ Programming Language, Third Edition. Addison-Wesley, Reading, Mass. and London, 1997.

    Google Scholar 

  8. 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.

    Google Scholar 

  9. L. Wall, R. L. Schwartz, and T. Christiansen. Programming Perl. O’Reilly & Association, Incorporated, 1996.

    MATH  Google Scholar 

  10. 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.

    Google Scholar 

  11. 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.

    Google Scholar 

  12. 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.

    Google Scholar 

Download references

Author information

Authors and Affiliations

Authors

Editor information

Editors and Affiliations

Rights and permissions

Reprints 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

Publish with us

Policies and ethics