Abstract
One way to design complex systems is to use an event-driven architecture. Model Driven Engineering (MDE) promotes the use of different abstract concepts, among which are the UML state machine, composite structure elements and their associated visualizations, as a powerful means to design such an architecture. MDE seeks to increase software productivity by automatically generating executable code from state machines and composite structures. To this end, a code generation approach in MDE should support all model elements used at the design level. However, existing code generation approaches and tools are still limited, especially when considering concurrency, event types, and pseudo states such as history and junction. Furthermore, in the literature, the combination of component-based design and UML state machines is supported by only a few existing approaches. This paper explores this combination and provides code generation patterns and framework-based tooling support for the combination and complete and efficient code generation from UML state machines. We extend a well-known state machine code generation pattern with concurrency support. In order to verify the semantics of generated code, we execute code generated by the proposed framework with a set of state-machine examples that are part of a test-suite described in the recent OMG standard Precise Semantics Of State Machine. The traced execution results comply with the standard and are a good hint that the execution is semantically correct. Regarding code efficiency, the code generated by our approach supports multi-thread-based concurrency, and the size of the generated code is smaller compared to considered approaches. Moreover, we demonstrate the practicality, feasibility, and scalability of the proposed approach with two case studies.
Access this chapter
Tax calculation will be finalised at checkout
Purchases are for personal use only
Notes
- 1.
Some approaches call the method of this thread as a super loop reading events from the queue.
- 2.
To avoid runtime memory allocation, STATE_MAX is for each state machine, rather than for all state machines, which will waste resource small state machines.
- 3.
Component-based design can be used, but the purpose of this case study is to show the usability and practicality of UML state machines and events.
References
OMG Available Specification without Change Bars. OMG Unified Modeling Language (OMG UML), pp. 1–212 (2007)
Posse, E.: PapyrusRT: modelling and code generation (invited presentation). In: Proceedings of the International Workshop on Open Source Software for Model Driven Engineering Co-located with ACM/IEEE 18th International Conference on Model Driven Engineering Languages and Systems (MODELS 2015), Ottawa, Canada, 29 September 2015, pp. 54–63 (2015)
IBM: IBM Rhapsody (2016). Accessed 4 July 2016
Mussbacher, G., et al.: The relevance of model-driven engineering thirty years from now. In: Dingel, J., Schulte, W., Ramos, I., Abrahão, S., Insfran, E. (eds.) MODELS 2014. LNCS, vol. 8767, pp. 183–200. Springer, Cham (2014). https://doi.org/10.1007/978-3-319-11653-2_12
Whittle, J., Hutchinson, J., Rouncefield, M.: Model-driven engineering practices in industry: social, organizational and managerial factors that lead to success or failure. Sci. Comput. Program. 89, 144–161 (2014)
Forward, A., Lethbridge, T.C., Badreddin, O.: Perceptions of software modeling: a survey of software practitioners. In: 5th Workshop from Code Centric to Model Centric: Evaluating the Effectiveness of MDD (C2M: EEMDD). Citeseer (2010). http://www.esi.es/modelplex/c2m/papers.php
Badreddin, O., Lethbridge, T.C., Forward, A., Elaasar, M., Aljamaan, H., Garzon, M.A.: Enhanced code generation from UML composite state machines. In: 2014 2nd International Conference on Model-Driven Engineering and Software Development (MODELSWARD), pp. 235–245. IEEE (2014)
IBM: IBM Rhapshody and UML Differences (2016). http://www-01.ibm.com/support/docview.wss?uid=swg27040251. Accessed 4 July 2016
Pilitowski, R., Dereziñska, A.: Code Generation and Execution Framework for UML 2.0 Classes and State Machines. In: Sobh, T. (ed.) Innovations and Advanced Techniques in Computer and Information Sciences and Engineering, pp. 421–427. Springer, Dordrecht (2007). https://doi.org/10.1007/978-1-4020-6268-1_75
Charfi, A., Mraidha, C., Boulet, P.: An optimized compilation of UML state machines. In: 2012 IEEE 15th International Symposium on Object/Component/Service-Oriented Real-Time Distributed Computing, pp. 172–179 (2012)
OMG: Precise Semantics of UML State Machines (PSSM) Revised Submission (2016). Revised Submission, ad/16-11-01
Pham, V.C., Radermacher, A., Gérard, S., Li, S.: Complete code generation from UML state machine. In: Proceedings of the 5th International Conference on Model-Driven Engineering and Software Development, MODELSWARD 2017, Porto, Portugal, 19–21 February 2017, pp. 208–219 (2017)
OMG: A UML Profile for MARTE: Modeling and Analysis of Real- Time Embedded Systems, version 1.1 formal/2011-06-02 (2011)
Butenhof, D.R.: Programming with POSIX Threads. Addison-Wesley Professional, Boston (1997)
Niaz, I.A., Tanaka, J., et al.: Mapping UML statecharts to Java code. In: IASTED Conference on Software Engineering, pp. 111–116 (2004)
Shalyto, A., Shamgunov, N.: State machine design pattern. In: Proceedings of the 4th International Conference on .NET Technologies (2006)
Spinke, V.: An object-oriented implementation of concurrent and hierarchical state machines. Inf. Softw. Technol. 55, 1726–1740 (2013)
Booch, G., Rumbaugh, J., Jacobson, I.: The Unified Modeling Language User Guide, vol. 3 (1998)
Balser, M., Bäumler, S., Knapp, A., Reif, W., Thums, A.: Interactive verification of UML state machines. In: Davies, J., Schulte, W., Barnett, M. (eds.) ICFEM 2004. LNCS, vol. 3308, pp. 434–448. Springer, Heidelberg (2004). https://doi.org/10.1007/978-3-540-30482-1_36
Knapp, A.: Semantics of UML State Machines (2004)
LISE: Papyrus Software Designer. https://wiki.eclipse.org/Papyrus_Software_Designer
Gérard, S., Dumoulin, C., Tessier, P., Selic, B.: 19 papyrus: a UML2 tool for domain-specific language modeling. In: Giese, H., Karsai, G., Lee, E., Rumpe, B., Schätz, B. (eds.) MBEERTS 2007. LNCS, vol. 6100, pp. 361–368. Springer, Heidelberg (2010). https://doi.org/10.1007/978-3-642-16277-0_19
Papyrus: Moka Model Execution (2016). https://wiki.eclipse.org/Papyrus/UserGuide/ModelExecution. Accessed 1 Nov 2016
Blech, J.O., Glesner, S.: Formal verification of Java code generation from UML models. In: Proceedings of the 3rd International Fujaba Days, pp. 49–56 (2005)
Boost Library: Boost C++ (2016). http://www.boost.org/. Accessed 4 July 2016
Jusiak, K.: State Machine Benchmark (2016). https://github.com/boost-experimental. Accessed 20 Oct 2016
Magic, N.: Magic Draw (2016). https://www.nomagic.com/products/magicdraw.html. Accessed 14 Mar 2016
SparxSysems: Enterprise Architect (2016). http://www.sparxsystems.com/products/ea/. Accessed 14 Mar 2016
Quantum Leaps: Quantum Modeling (2016). http://www.state-machine.com/qm/. Accessed 14 May 2016
Lavender, R.G., Schmidt, D.C.: Active object. Context, pp. 1–12 (1996)
Boost Library: The Boost Statechart Library (2016). Accessed 4 July 2016
Boost Library: Meta State Machine (2016). http://www.boost.org/doc/libs/1_59_0_b1/libs/msm/doc/HTML/index.html. Accessed 4 July 2016
Boost Library: State Machine Benchmark (2016). http://www.boost.org/doc/libs/1_61_0/libs/msm/doc/HTML/ch03s04.html
Valgrind: Valgrind Massif (2016). http://valgrind.org/docs/manual/ms-manual.html. Accessed 20 Nov 2016
Nethercote, N., Seward, J.: Valgrind: a framework for heavyweight dynamic binary instrumentation. In: ACM SIGPLAN Notices, vol. 42, pp. 89–100. ACM (2007)
Katz, R.H., Borriello, G.: Contemporary Logic Design (2005)
Yasmine: The classic farmroad example (2016). http://yasmine.seadex.de/yasmine.html. Accessed 20 Nov 2016
LEGO Car Factory. http://robotics.benedettelli.com/lego-car-factory/. Accessed 22 Mar 2017
Domínguez, E., Pérez, B., Rubio, A.L., Zapata, M.A.: A systematic review of code generation proposals from state machine specifications. Inf. Softw. Technol. 54(10), 1045–1066 (2012)
Douglass, B.P.: Real-Time UML: Developing Efficient Objects for Embedded Systems (1999)
SparxSystems: Enterprise Architect (2016). http://www.sparxsystems.eu/start/home/. Accessed 20 Nov 2016
Harrand, N., Fleurey, F., Morin, B., Husa, K.E.: ThingML: a language and code generation framework for heterogeneous targets. In: Proceedings of the ACM/IEEE 19th International Conference on Model Driven Engineering Languages and Systems, pp. 125–135. ACM (2016)
Selic, B., Gullekson, G., Ward, P.T.: Real-Time Object-Oriented Modeling, vol. 2 (1994)
Cheng, S.W., Garlan, D.: Mapping Architectural Concepts to UML-RT (2001)
Author information
Authors and Affiliations
Corresponding author
Editor information
Editors and Affiliations
Rights and permissions
Copyright information
© 2018 Springer International Publishing AG, part of Springer Nature
About this paper
Cite this paper
Pham, V.C., Radermacher, A., Gérard, S., Li, S. (2018). A Framework for UML-Based Component-Based Design and Code Generation for Reactive Systems. In: Pires, L., Hammoudi, S., Selic, B. (eds) Model-Driven Engineering and Software Development. MODELSWARD 2017. Communications in Computer and Information Science, vol 880. Springer, Cham. https://doi.org/10.1007/978-3-319-94764-8_13
Download citation
DOI: https://doi.org/10.1007/978-3-319-94764-8_13
Published:
Publisher Name: Springer, Cham
Print ISBN: 978-3-319-94763-1
Online ISBN: 978-3-319-94764-8
eBook Packages: Computer ScienceComputer Science (R0)