Umple As a Component-Based Language for the Development of Real-Time and Embedded Applications

Umple As a Component-Based Language for the Development of Real-Time and Embedded Applications

Umple as a Component-based Language for the Development of Real-time and Embedded Applications Mahmoud Husseini Orabi, Ahmed Husseini Orabi and Timothy Lethbridge University of Ottawa, 800 King Edward, Ottawa, Ontario, Canada Keywords: Umple, Component Modelling, UML, Ports, Connectors, Composite Structure. Abstract: Component-based development enforces separation of concern to improve reusability and maintainability. In this paper, we show how we extended Umple (http://try.umple.org) to support component-based development. The development of components, ports, and connectors is enabled using easy-to-comprehend keywords. Development is supported in both textual and visual representations. The design pattern followed in our implementation is the active object pattern. We show a comparison between Umple and other modelling tools. We show that Umple has a set of component features comparable to commercial modelling tools, but is the most complete, particularly with regard to code generation, among the open source tools. 1 INTRODUCTION and Ruby. Users can insert their code bodies in code-enabled elements such as methods, states, We describe in this paper how we have extended transitions, and operations. Inserted code can be Umple to support component-based development. language-specific, so users can add a code snippet The main motivation behind our research is to for each target language. simplify component-based development, specifically Major UML concepts are supported in Umple of real time systems. By component-based such as classes, associations, attributes, and state development, we mean the implementation of machines (Badreddin et al., 2014a; 2014b; 2014c). systems from concurrent components with well- An Umple developer does not need to be a UML defined interfaces, such that components can expert to write models. communicate together via ports and connectors. In this paper, we will highlight two of our key Among common programming languages, a few contributions. First, we will show how we extended allow real-time development such as C and C++. Umple to support component-based modelling with Languages such as Java require additional efforts to new keywords and corresponding semantics. The support real-time development. development of components will be available both Model-driven approaches have for a long time textually and visually similarly to other Umple been used to develop real-time applications. features. Second, we will show a comparison Compared with directly using a programming between Umple and other modelling tools. In this language, model-driven approaches give advantages comparison, we will pinpoint the features that are such as enabling multiple target generation, fewer crucial for the support of component modelling. We lines of code, and a high level of abstraction. will show how we managed in our implementation However, the existing open-source modelling to cover the pinpointed features. tools have limitations such has having limited We follow the active object pattern for the capabilities for real-time development. implementation of the component-based features Umple is an open source model-oriented (Lavender and Schmidt, 1996). An active object is programming language that allows developers to an object that runs concurrently in a separate thread. write their models either visually or textually The focus in our discussion is to show how we (Badreddin et al., 2014). can use Umple to develop component-based models. Code generation in Umple has options for Thus, we will not talk in detail about the content of different target languages such as Java, C++, PHP, the generated code. 282 Orabi, M., Orabi, A. and Lethbridge, T. Umple as a Component-based Language for the Development of Real-time and Embedded Applications. DOI: 10.5220/0005741502820291 In Proceedings of the 4th International Conference on Model-Driven Engineering and Software Development (MODELSWARD 2016), pages 282-291 ISBN: 978-989-758-168-7 Copyright c 2016 by SCITEPRESS – Science and Technology Publications, Lda. All rights reserved Umple as a Component-based Language for the Development of Real-time and Embedded Applications The Umple models that we will show in this 2.1.1 Parts (Subcomponents) paper assume that the selected target language is C++. These models can be generated and rendered A component can own multiple parts using UmpleOnline (http://try.umple.org). (subcomponents), which are instances of this The support of real-time code generation is also a component or other components. In such a case, a part of our research but we will not have it addressed component is referred to as a composite component. in this paper. Subcomponents can also be composite. In a similar manner to languages such as Java A subcomponent defines the hierarchical and C++, an Umple developer must define a main composition and internal structure of its owning function. The content of a main function must be components. For example, in Figure 2, part "a" written in the syntax of the selected target language. shows an instance of type "A", and part "b" shows We will not necessarily show the main functions for an instance of its type "B", while both instances exist all of the Umple models that we will show in this in the context of their owner instance "c" that is of paper. type "C". The Umple code of Figure 2 is in Figure 3. This paper is organized as follows. In Section 2, we will discuss how component modelling is supported in Umple. In Section 3, we will give an extended example written in Umple. In Section 4, we will show a comparison between Umple and other component-based modelling tools. Figure 2: Multiple instances of different components. 1 class A { // A component Umple 2 COMPONENT MODELING 2 active method1 {/* Empty */ } USING Umple 3 } 4 class B { 5 active method2 {/* Empty */ } In this section, we will discuss the newly introduced 6 } keywords to Umple used to support component 7 modelling. 8 class C { 9 A a; 10 B b; 2.1 Umple Components 11 } A component is a structured class that encapsulates a Figure 3: An example of subcomponents. set of active methods and ports. An active method executes within its thread of control, initiates an When a part is added to component, the class of activity concurrently, and ensures that data is sent this component will have a composition relationship and received between ports immediately while with the owning class of this part. following some restrictions such as time constraints. Composite relationships between a container and A class becomes a component if it has at least its parts can be defined by simply declaring an one active method, port, or connector. attribute of the part’s type within the composite. An active method is defined as a regular method More complex cases may require relationships to be but a developer will additionally need to use the specified explicitly using associations and keyword "active". In Figure 1, there are two active generalizations. methods defined in Lines 2 and 5. Concepts such as generalization and multiplicity SimpleComponent in Figure will be a component, appear in both composite structure models and class since it owns active methods diagrams. 1 class SimpleComponent { Umple 2.1.2 Method Invocation 2 active method1 { 3 cout << "Method1" << endl; The invocation of an active method is asynchronous 4 } by default. Let us consider the simple example 5 active methodWithParameters(int i){ 6 cout << "Method2" << i <<endl; shown in Figure 4, in which a component, 7 } SimpleComponent has two active methods, 8 } method1, and method2. In Line 3, there is invocation Figure 1: An example of component definition. 283 MODELSWARD 2016 - 4th International Conference on Model-Driven Engineering and Software Development to the active method method2. The content of A developer can still manually interrupt an active method2 will be executed asynchronously. method; this can be done at the level of the target Invoking method2 will cause the text in Line 8 to language. For that, we provide an API, be printed indefinitely, and the client will not be FutureObject. To limit the scope of this paper, we blocked. will only give a very brief example of the use of FutureObject in Figure 7. 1 class SimpleComponent { Umple In Figure 7 in Line 8, there is a main function. In 2 active method1 { 3 method2(); Line 9, an instance of a component named Test is 4 } declared; a call to a method of this instance is made 5 in Line 10. When making a call to an active method, 6 active method2 { we get a FutureObject variable, which gives us more 7 while(true){ 8 cout << "Keep outputting" << endl; options to manage the execution process. In Line 11, 9 } there is a call to an API named "stop"; this API is 10 } used to interrupt the execution of an active method. 11 } Figure 4: An example of asynchronous execution of active 1 class Test { Umple 2 active method2 { methods. 3 while(true){ 4 cout << "Keep outputting" << endl; The keyword "synchronous" is used to allow a 5 } developer to force synchronous behaviour on an 6 } 7 active method. The keyword "synchronous" 8 public int main(int argc, _TCHAR* argv[]) { precedes the "active" keyword as shown in Figure 5. 9 Test test1; 10 FutureObject<void> proxy1 = test1.method1(); 1 synchronous active method1 { Umple 11 proxy1.stop(); 2 //Some synchronous content 12 } 3 } 13 } Figure 5: An example of synchronous execution of active Figure 7: An example of interrupting active methods. methods. There are other API methods in FutureObject If we used the keyword synchronous with such as wait data, subscribe, and unsubscribe. method2 defined in Figure 4, this would have caused clients to be blocked indefinitely unless method2 is 2.2 Ports interrupted. The process of interrupting an active method will be discussed in the next section. A port is a special attribute owned by a component; it is used as an interface for communication among 2.1.3 Atomic versus Interruptible Active components.

View Full Text

Details

  • File Type
    pdf
  • Upload Time
    -
  • Content Languages
    English
  • Upload User
    Anonymous/Not logged-in
  • File Pages
    10 Page
  • File Size
    -

Download

Channel Download Status
Express Download Enable

Copyright

We respect the copyrights and intellectual property rights of all users. All uploaded documents are either original works of the uploader or authorized works of the rightful owners.

  • Not to be reproduced or distributed without explicit permission.
  • Not used for commercial purposes outside of approved use cases.
  • Not used to infringe on the rights of the original creators.
  • If you believe any content infringes your copyright, please contact us immediately.

Support

For help with questions, suggestions, or problems, please contact us