Peter Lieber

Peter Lieber

I am an extrovert promoter and results-oriented controller and director. It like creating new partnerships and relations. I like people that are talking with me and it is important for me to help and motivate others. I'm very self-motivated and I prefer doing thinks I really like. I need a lot of creative and open space. But I also need people doing the administrative tasks and people realizing the ideas.

My highest motivation is doing creative work with and around Enterprise Architect. (www.sparxsystems.de)

Monday, 30 March 2015 09:10

Developing and debugging in UML models

Especially when concerning more deeply embedded systems with complex multicore SoCs, it is often not easy to prove functional safety. In this case, using a model-based development platform such as Enterprise Architect along with a code generator optimized for embedded applications and a model-based testing tool with hardware-level debugger, this problem is relatively easy to solve. This combination allows developers to design, test and debug their software on the same level of abstraction - also on the real target.

Model-based development is finding more and more followers, and the field of industrial and automotive embedded systems is no exception. This is hardly surprising, since especially in these challenging areas of technology it is in fact more important than ever to use mechanisms that help to ensure that the product complies with all requirements and safety criteria. A growing use of multicore architectures increases this pressure even further, since the complex interactions in the parallel execution of software also significantly complicate the detection of functional safety.

Basically, working with models to develop embedded applications has many advantages, such as:

 

  • continuity from requirements management to final C / C ++ - code

  • object- and component-oriented development without having to switch to C ++

  • less effort when switching to C ++ later on

 

In the case of already-running embedded projects, practical experience shows that the best course of action is to begin to develop parts of the functionality using the model-based approach. In this way, the fairly new model-based approach can be brought - step by step - into the company without having to discard existing code while overwhelming developers.

In general, it is important to always keep in mind the specific requirements of the embedded environment. These include, for example:

 

  • the limited performance of the hardware; the code must efficiently conserve resources

  • a software bug detected too late is an often costly affair (e.g. expensive auto recalls)

  • that the code must satisfy very specific standards (MISRA), and

  • it should integrate well with existing code.

 

Modeling with very specific requirements

 

The use of a model-based development platform such as Enterprise Architect from Sparx Systems demonstrably improves not only the development process of software and systems, but also communication between the people involved. The graphically-oriented representation in UML enables instant documentation of the software architecture and development process, and makes it easier for non-UML professionals to understand.

UML / SysML are very broadly-applicable languages, but were not specifically designed for creating embedded systems. In order to adapt the Enterprise Architect modeling platform (Figure 1) - now with over 350,000 licenses in operation worldwide - to the specific requirements of embedded engineering, LieberLieber software therefore combines two key functions in the "LieberLieber Embedded Engineer" product package: code generation (uml2code) and debugging UML (UML debugger). As part of the entire tool chain, this solution - aimed primarily at embedded software developers and software architects, but which can also be useful for testers and integration managers - enables code generation from UML structures, state machines and activity models and generates platform-independent C ++ - and MISRA-compliant C code from UML models.

 

Learning to use models

 

A characteristic valued by most customers is the potential coexistence of handwritten and generated code. However, it should be ensured that generated code is only altered by changes in the model or the generator. This ensures that model and code are identical at all times. Basically, the automatic code generation especially makes sense if the code generator is not a black box, but a living part of the project. The variety of template-based solutions for code generation can have a negative influence on acceptance by developers and thus also the will to adapt.

In practice, code generators are therefore much more successful when they themselves are programs and can thus adapt to the familiar tools. However, should the complexity of the templates become too great, maintainability and finding fault are far more difficult than, for example, in a code generator that was developed in C # and can debug normally with Visual Studio. A particularly great benefit from code generation can be achieved when parts of a project are generated from a model based on the state machines or activities as agreed upon among the respective departments.

 

Code generation produces high value

 

Thus, as has already been mentioned, model-based development has a particularly high value when implemented for automatic code generation and subsequent debugging. By eliminating complex configuration parameters and any frameworks, entry into model-based code generation is greatly facilitated by uml2code. Decisions at the model level can be transparently traced in the generated code – which is easy to read and well structured. Project-specific requirements for code generation are implemented directly in the supplied source code. As a result, the requirements are easy to understand. In addition, the generated code can be integrated without any problems into existing software projects, the advantages of the model-based and the traditional development can thus be combined virtually as desired. Moreover, since the code generator source code is included, there is no dependence on the solution suppliers.

In order to shift software development completely to Enterprise Architect, the following rules – necessary for embedded engineering – are also included in “LieberLieber Embedded Engineer for Enterprise Architect”:

 

  • Instead of dynamic memory management, which is a violation against the MISRA C rules, objects are created statically.

  • State Machines are instead implemented by a whole set of functions via short and effective case distinctions.

 

Debugging functionality includes the development cycle

 

The LieberLieber UML Debugger also offers users a graphical UML debugger, integrated into Enterprise Architect, that allows the testing and debugging of the software, modelled in UML or SysML, directly on the model level. The debugging of the model can be started directly with the code generated from the model and compiled with any compiler. The code generator and the debugger form a closed circuit and allow debugging at the implementation level - namely the UML model. Thus, a possible error even right at the source - the model - can be located and corrected.

 

Testing on the real target

 

Coupling with the Universal Debugging Engine (UDE) by PLS, a tool specialized in optimized target access and detailed architecture support, allows the execution and debugging of the models directly on the actual target hardware. This is possible thanks to the UDE object model, which is based on COM technology from Microsoft. COM allows programmatic use by a variety of programming languages, including the world of .NET such as C#. COM refers to the totality of all documented objects, methods, properties, and data types as an object model. This means that almost all functional aspects of the Universal Debug Engine are covered. The LieberLieber UML debugger uses the object model of the UDE for, among other things, a connection to the microcontroller and the programming of the application into the FLASH memory of the target. It is also able to set breakpoints. This is done directly in the model, for example, on a particular state of a state machine. Due to the integrated code generation, it is known what line in the generated C / C ++ code this corresponds to. This can be handed over to the debugger for the setting of breakpoints. Furthermore, the program execution can be started and stopped via the object model. It is even possible to read out the variable values and display them in the UML debugger (Figure 2).

 

Conclusion

 

The coupling of a modeling tool with a code generator optimized for embedded systems and a model-based testing tool with hardware-level debugger gives the designer the advantage to not only design software at the model level, but also test and debug it on the real target. This seamless integration between tools increases the acceptance of such development methods, reduces the occurrence of errors and represents a large gain in efficiency. This innovative approach is suitable for new as well as existing projects.

 

Captions

 

Figure 1: Enterprise Architect with the LieberLieber Embedded Engineer extension

 

Figure 2: UML Debugger uses services of the Universal Debug Engine for target control

 

Model-based development has established itself in more and more economic sectors, and is now also used in various scenarios for SAP projects. This means that both development as well as maintenance costs can be significantly reduced.

Over its entire lifetime, software costs money; in addition to pure development costs, significant maintenance costs arise during the utilization phase. As soon as the software is in live operation, associated costs are entered under “Software Maintenance” – costs which can reach up to 80 percent of overall lifecycle effort (see B. Hohler, Skript WRT Hannover 2008/09). According to an analysis by the software company Cast Research, maintenance costs alone amount to USD3.61 per individual line of code. It is also interesting to note that 47 percent of overall maintenance costs must be spent on dealing with problems, whereas 28 percent apply to verification and only 25 percent to implementing actual changes (see B. Hohler, ibid., p. 3).

In addition to good software design, the quality of the source code and, naturally, fulfillment of the software’s functionality are decisive for a lean maintenance cost structure. As a rule: The higher the quality of the software development, the lower the expenditures for operating the software. To avoid spiraling costs due to inadequate software design and low-quality source code, the link to model-based development is a promising approach – already underpinned by numerous studies and successes. The clear documentation and visualization provided by the models translate into time savings when becoming familiar with and developing the software, which in turn lowers maintenance costs. In this way, refactoring can be carried out from the start with well-structured software architecture, and continuously monitored...significantly extending software and system lifetime.

New tool connects model-based development and SAP

Gobas GmbH is a union of IT companies from the Braunschweig and Hannover metropolitan area which are focused on SAP and mobile development. Until only a short time ago, the model-based development of software in an SAP environment was not an issue for this company. Now, the strong growth in interest has led Gobas to develop its new tool - q.trans - for model-driven software development in SAP. “Many of our customers are running SAP, yet at the same time they are moving toward model-based development. In order to connect these two worlds in the best way, we have linked q.trans with Enterprise Architect,” says Markus Abel, CEO at Gobas.

With over 380,000 users worldwide, and of these around 60,000 in the German-speaking world, Enterprise Architect by Sparx Systems is a widely-used UML modeling platform. Its implementation in an SAP environment, facilitated by Gobas q.trans, unlocks an entirely new circle of users: “We are pleased that q.trans was developed with the help of Enterprise Architect. This has created a bridge of sorts between Enterprise Architect and ABAP OO development in SAP, opening up a very interesting new market. Once again, the benefits brought by Enterprise Architect to optimization and better understanding of complex software projects is made clear,” emphasizes Hans Bartmann, CEO of SparxSystems Central Europe.

Model-based development with UML growing in popularity

Model-based development based on the graphical language UML/SysML (Unified Modeling Language/System Engineering Modeling Language) continues to find its way into more industrial sectors. The Industry 4.0 initiative also places model-based development squarely in the center. The growth in model-driven development is intensifying, not least due to the continual improvements in the UML/SysML modeling language.

Seventeen years ago, the industrial standards body OMG (Object Management Group) published its first UML specification. Meanwhile, work is being carried out on Version 2.5, which will provide developers with even more detailed description options for their models. With the introduction of SysML several years ago, the application options of model-based development have been expanded to include entire systems. More and more academics and users see the future of software and systems engineering clearly in model-based development, from which code can be automatically generated.

The core idea of model-based engineering is to create a functional model for the product to be developed. This functional model can be taken as a basis for simulation even during development, and once it is completed it serves as the foundation for the generation of code. It is estimated that consistent development and verification on the model level can translate into savings of somewhere between 30 to 50 percent.

In the scope of SAP development, the model-based method can be implemented for forward as well as reverse engineering. Specifically the area of reverse engineering has found rather strong resonance with customers who wish to further develop their SAP solutions. With this goal in mind, various model-based development tools available on the market were tested. The results show quite clearly that Enterprise Architect was able to extract the most data from SAP solutions via the XMI interface.

UML models can also be easily imported into an SAP system with Gobas q.trans to create the development-relevant objects there, or to change existing objects according to the model specifications (”Forward Engineering“). In addition to the source code, however, reliable documentation is an important part of any piece of software. The solution therefore enables the current state of software development to be exported into a model and in this way directly embedded into the audit-proof documentation of the project source code (”Reverse Engineering“). Furthermore, the tool allows the comparison between a model and existing ABAP OO code, while offering sophisticated metrics for quality assessment of models and ABAP OO code.

Integration of metrics for quality assessment

Reliable data and figures enable the application of the scientific method when it comes to measurability of quality and costs - a quantitative assessment of the characteristics of software products, processes and projects. “It has to do with the use of software measurement…achieving specific goals, such as project controlling, error reduction or efficiency improvement” (from: Informatik-Spektrum, vol. 36, book 6, December 2013). The application of this theory in practice, however, is still in its infancy. Many companies are facing the challenge of selecting the right software metrics for measurement, and of extracting relevant conclusions from the identified indicators in order to minimize risk in their software projects.

Therefore, based on the current state of scientific knowledge, various software metrics have been integrated into the new Gobas q.trans development tool. This enables ABAP OO developers to come to the right conclusions based on predetermined measured values. At the same time, modern software development methods such as agile and incremental approach methods are supported. With the help of the implemented software metrics, the software’s development status can be continuously analyzed and documented. The progress becomes visible, project targets can be reviewed, and development errors detected early on.

Overview of Gobas q.trans functionality and scope

- Forward Engineering (generation of ABAP source code from UML models; operates across packages; generation of getter and setter methods; generation of comments; automatic syntax check; consistency check for DDIC objects; versioning; setting of an import history)

- Reverse Engineering (generation of a UML model from ABAP source code; selection criteria for objects; customizing for object names; operates across packages)

- Quality Management (comparison of objects and packages between UML and SAP; detailed listing of attributes, methods and interfaces; operates across packages; code assessment using object-oriented software metrics; depth of inheritance (DIT), Law of Demeter (LoD), cohesion LCOM, instability and various others, such as McCabe and Halstead metric

- Supported object types: domains, data element, structure, table type, database table, class, interface, function groups and packages

DO-178B is the current standard in aviation industry for safety critical systems - also known as: "Software Considerations in Airborne Systems and Equipment Certification".

Find attached the White Paper including links to the UML Profile and a DO-178B glossary.

Page 3 of 3