of 70

Thesis

Published on November 2016 | Categories: Documents | Downloads: 11 | Comments: 0
195 views

tttt

Comments

Content

Masaryk University Faculty of Informatics

MASTER’S THESIS Matej Jakab

The problem of model-code consistency and Model Driven Development

Supervisor: Ing. RNDr. Barbora B¨ uhnov´ a, Ph.D. Study program: Informatics Field of study: Information systems 2012

Acknowledgements: I would like to thank my supervisor Ing. RNDr. Barbora B¨ uhnov´ a, Ph.D., for intensive discussions and guidance for my thesis to the right direction. Special thanks go to my sister and girlfriend who supported me in various ways.

I declare that I have worked on this thesis independently using only the sources listed in the bibliography. All resources, sources, and literature, which I used in preparing or I drew on them, I quote in the thesis properly with stating the full reference to the source. In Brno, Matej Jakab

Abstrakt: Pr´ ace je zamˇ eˇ ren´ a na udrˇ zen´ ı konzistence medzi modelem a k´ odem pomoc´ ı MDD. Pr´ ace analyzuje existuj´ ıc´ ı n´ astroje, kter´ e tento probl´ em ˇ reˇ s´ ı. Na kombinaci n´ astroj˚ u demonstruje funkˇ cnost. Na z´ avˇ er zhrnuje nadobudnut´ e vˇ edomosti a porovn´ an´ ı zobrazuje v tabulk´ ach. Kl´ ıˇ cov´ a slova: Model driven development, code engineering, reverse engineering, transformace modelu, konzistence modelu a k´ odu, IDE

Abstract: The thesis is focused on maintaining the consistency between a source code and a model with the help of MDD. The thesis analyses existing tools that are capable of dealing with this issue. On the best combination of such a tools, demonstration is introduced. Finally the knowledge gained is listed and the evaluation of tools is displayed in tables. Keywords: Model driven development, code engineering, reverse engineering, model transformation, model code consistency, IDE

Contents
Introduction 6

1 Model Driven Development 9 1.1 Definition . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9 1.2 Model Transformation . . . . . . . . . . . . . . . . . . . . . . 11 2 Categorisation 13

3 Platform Specific Category 17 3.1 Eclipse . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 17 3.2 Visual Studio . . . . . . . . . . . . . . . . . . . . . . . . . . . 20 4 Platform Independent Category 4.1 NetBeans . . . . . . . . . . . . 4.2 Altova . . . . . . . . . . . . . . 4.3 StarUML . . . . . . . . . . . . 4.4 OpenAmeos . . . . . . . . . . . 4.5 VisualParadigm . . . . . . . . . 4.6 EnterpriseArchitect . . . . . . . 4.7 OtimalJ . . . . . . . . . . . . . 4.8 Rational Rose . . . . . . . . . . 5 Demonstration 24 24 28 31 34 37 41 45 46 48

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

. . . . . . . .

6 Discussion 55 6.1 Ideal Tool . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 6.2 Final comparison . . . . . . . . . . . . . . . . . . . . . . . . . 57 3

CONTENTS Conclusion Bibliography Appendix

5 61 61 64

Introduction
Motivation
The model consistency problem is caused by an absence of automated functions within modelling tools, that maintain consistency when changes to one model are made. Even if a system is in a consistent state, the risk that after many changes implemented during the project’s lifetime the consistency is violated, is real. In the case, when the source code is present at the beginning of the project, consistency may be an issue right from the start of the project. The source code may be looked at as a model on the lowest level with zero rate of abstraction. The consistency with a model constructed with one level higher abstraction rate needs to be maintained. This is the area that this thesis is focusing on. There is no need for a tool that helps representing source code. However, one for representation of the model with some rate of an abstraction is needed. The best instrument to do so is Unified Modelling Language (UML).

Aim
The aim of this thesis is to find methods and tools that are able to solve the problem of consistency between a source code and a model, represented as UML diagram. There are many tools available nowadays. However, their functionality, correctness and robustness needs to be analysed. A tool with full and robust functionality in this matter is not likely to be found. Nevertheless, satisfactory result can be achieved by applying combination of several tools.

6

CONTENTS

7

Model consistency
There are several approaches on how to solve the issue of model consistency. In the thesis of Kim Mens [11] the solution for the problem of maintaining the consistency between a software architecture and the corresponding source code using a logic programming language is introduced. Even though the algorithm is correct, it turned to be inefficient. Even more disturbing is the fact, that a full-fledged programming language is used. Therefore there is no guarantee concerning the decidability or completeness of the consistency algorithm. [18]. Another solution is offered by Tom Mens, Ragnhild Van Der Straeten, and Jocelyn Simmonds [18]. They split the consistency problem into two cases. The first one is caused by the fact, that the design may be internally inconsistent or incomplete. The other one, is caused by the source code being ”out of sync”. Their approach to the problem is based on the use of description logic (DL). DL is an appropriate formal tool for solving consistency issue, due to the fact that DL contains five reasoning tasks that achieve the consistency. There are subsumption, instance checking, relation checking, concept consistency and knowledge base consistency [18]. The question, whether it is necessary to look for another approach solving consistency issue, may be asked. However the study [18] is dated in 2003 and the main motivation is a poor UML tools support in the given matter. Work on defining model driven development (MDD) started in 2001 and was far from complete at that time. Many new tools focusing on the MDD’s approach to the project development have been launched and many new approaches have been defined. This is the main reason why we adopt this approach to achieve the goal of the thesis.

Structure of the thesis
In the first chapter we define MDD and all related terms. We need to identify all the connections between these definitions and code-model consistency aspects. Consistency problem is separated and tools capable of solving the problem are categorised and analysed. Demonstration of the best set of tools

CONTENTS

8

on an exemplary project is build. In the last chapter, the ideal tool described. Other tools analysed within this thesis are evaluated with respect to the ideal tool.

Chapter 1 Model Driven Development
In this chapter, definitions of notions necessary for understanding the thesis are defined. We need to fully understand the difference between model driven development and model driven architecture, terms like model, transformation and relations between them. The following knowledge is gained from [2] and [18].

1.1

Definition

During the study of the model development, one often meets with terms models, modelling and model transformation. Models serve us for the reasoning about the problem and the solution domain. Relationships between them provide us with the web of dependencies recording the process. These facts allow us to define the kind of models that must be modelled, and define precise semantics of these models. As follows, we can define rules for automating steps converting one model representation into another, tracing between model elements and analysing characteristics of the model that we desire. This methodology is called Model driven development (MDD) [2]. MDD is a paradigm for writing and implementing computer programs quickly, effectively and at minimum cost. Model driven architecture (MDA) [2] is a software design approach for development of software systems. It provides a set of guidelines for structuring specifications, which are expressed as models. MDA is a type of domain

9

CHAPTER 1. MODEL DRIVEN DEVELOPMENT

10

engineering, and supports model-driven engineering of software systems. It was launched by the Object Management Group (OMG) [12] in 2001. It is important to mention at the beginning, that model driven development and model driven architecture often refer to the same methodology. In the commercial sector, this methodology is more often named MDA, but MDA is only a style of MDD, that offers the possibility of defining rules for automating many of the steps needed to convert one model representation to another. MDA enhances the use of MDD by tracing throughout model elements and analysing important characteristics of the models. Since these automated steps of converting models are the main focus of this thesis, the term MDA is being used from now on, as its definition captures given theme the best. There are several terms, that need to be explained for better understanding of the following chapters. The central term of MDA is a model [2]. According to MDA’s definition, model is a set of statements about the system that is under study. The model is in a need of abstraction for the user to better understand it. Abstraction allows the user to focus on the system aspects one wishes to, and enables model’s complexity to be handled. The language is in the MDA’s definition termed as a formalism [2]. Its meaning is to precisely define the syntax and semantics for the given model. There are two types of the syntax of the formalism, concrete and abstract. Concrete syntax is used for a specification of the readable representation of the abstract notational elements. There are two types of semantics as well, static, also referred to as well-formed rules, and dynamic. Representation of restrictions for valid models is ensured by static semantics. The dynamic semantics is the behaviour of a sentence as its context potentially changes. It is expected, with the dynamic semantics description of a model, a foundation for understanding and evaluating the design issues, and a valuable reference for transformations that involve this model [3]. Figure 1.1 describes the relationship between given terms.

CHAPTER 1. MODEL DRIVEN DEVELOPMENT

11

Figure 1.1: Model Driven Architecture [2]

1.2

Model Transformation

The main focus of this thesis lies within model transformation. Before continuing any further, this term needs to be defined and explained. Lets assume that M is the model of a system S (or specification for a system set) and F is the formalism in which the model is described. Any transformation t can then be defined as t : M1 (S1 )|F1 → M2 (S1 )|F2 where M1 is the source model and M2 the target model of the current transformation. Neither the source model, nor the target model are modified. This means, that a new model is created and if the same transformation is applied again, no changes to this model are made. The source model remains unchanged as well. It is important to notice, that the term model may be imagined as a source code of a project. Thus, reverse-engineering and code generation can be considered transformations. There are several consequences derived from the transformation definition. Focusing on transformation categorization is very important and examples of these categories described on concrete functions help their understanding [2]. The transformation can be either atomic (monolithic) or can consists of separate steps and thus be called step-wise transformation. Separation of transformation into endogen (if F1 = F2 ) or exogen (otherwise) has to be

CHAPTER 1. MODEL DRIVEN DEVELOPMENT

12

mentioned as well. The other, more important separation of transformation, is into vertical and horizontal. Vertical transformations are those, which employ model for implementing, closer to run-time platform, while horizontal transformation evolve the model. As an horizontal transformation we can image target model with same meaning but different syntax. The important fact for vertical transformations is, that vertical transformations are exogen transformations, but not all of exogen transformations are vertical. In our case, best example of vertical transformation is code generation. Transformations can be classified by describing the technique and thus divided into 2 categories, with operational or declarative approach. Declarative approach forces us to describe the transformation through rules specified by pre- and post-conditions. On the other hand, declarative approach focuses on building specification (mapping). We will be not devote more space to this distribution as it is not included in focus of this thesis. There is one more distribution that needs to be mentioned at least. It is based on work of Czarnecki and Helsen, who presented approaches for classifying transformations on model-to-model and model-to-code translations and examined the differences based on the representation (syntax) and transformation rules [2]. Another requirement on model transformations needs to be ensured as well. Every model transformation represents a query and modification of models, thus these models have to be machine readable and modifiable for automating this activities. As only formal aspects fulfil this requirement, they are thus available for manipulation though software tools. If a model transformation is exercised by a software tool, it is always performed in the repeatable and deterministic way. In addition, if this software tool was properly tested, there is no space for errors for any of this iterated runs, that may occur in manual model transformation.

Chapter 2 Categorisation
There is a wide range of project modelling software on the market nowadays. The choice of modelling software can be based on several sites focusing on over-viewing the tools. Factors sorting these tools are different for different sites. Not all of these sites focus on approaches derived from MDA’s definition. However due to the rise of OMG’s model driven architecture’s importance orientation towards this architecture is required more than ever. For better understanding of this issue, several categories to which project modelling tools can be separated, are defined. In the previous chapter we introduced the definition of MDA. This is the point of view, that is usually adopted by system analysts. But there is also another point of view, and its one used by developers. They usually do not see further than one abstraction level above source code. Their interests lie within system platform, ways and tools that are used for project development. Such an approach does not cause any trouble for smaller systems, but if cooperation of developers and analysts is needed, question whether there is one tool, complex enough to satisfy both needs, rises. As Figure 2.1 displays, there are transformations from platform independent model to platform specific one. In this thesis we categorise tools, based on the fact whether they are capable of such transformations. It often happens that platform, on which project will be developed, is known even before analysis phase starts. In this case, any tool from platform specific group can be used. Software in this category are usually development

13

CHAPTER 2. CATEGORISATION

14

Figure 2.1: Model and MetaModel Transformation [14] environments themselves. IDE’s such as Eclipse or Visual Studio are the main representatives of this category. Tools from platform specific category usually don’t have a function for model creation implemented, but through miscellaneous plug-ins or add-ons this functionality can be ensured. The advantage lies within instant possibility of editing source code and seeing effect of these changes in model instantly. There is no need to install and run third party software and constantly import/export model or source code. Developing project in such environment might be very pleasant. On the other hand these software don’t support creation of any other model than class diagram. Its building from source code is mostly flawless as well as generation of source code from the diagram. Consistency between model and source code is held all the time. But in the case when developer is in need of managing other models as well, he has no other choice than to install another tool, that guarantees this possibility. Then, when trying to maintain consistency between developed models, it is much more appropriate to count on correct reverse engineering source code, rather then modelling another class diagram in this third tool. Some of these tools might be able to import/export models in XMI or XML format, but this is usually a feature of software focused on project development, not of IDE’s. Combination of platform specific tool (Eclipse) and platform independent one (Altova Umodel) was used for exemplary project development. The second category from this point of view mainly contains tools which

CHAPTER 2. CATEGORISATION

15

focus on project development. It is named platform independent category. From MDA’s definition, when analysing project from top to bottom, platform independent models should be created before the modelling phase of platform specific model starts. Thus, in this case, usage of these tools is more appropriate. Unlike tools in platform specific group, tools from platform independent group are characterized by ability of creating more types of diagrams. Usually functions for maintaining consistency between models are included in the tool as well as code generation. Expectations from platform independent tools as far as methods for reverse engineering goes, are lower than from the platform independent category. The reason is because these tool focus on ways that unburden the project implementation from the developer’s point of view. Even though these tools form the platform independent category, a situation, when the platform of the given source code must be selected, may occur. The fact, that it may not be possible for all these software to continue developing the project from platform specific code up to platform independent ones, does not meet the definition of the MDA’s approach. Nevertheless, their feature of being platform independent is not at stake, due to the availability of source code reversing for other languages as well. THe ideal tool should be able to do so, but it seems, that requirements for these software are not focused on this way of development. Its usage would be most likely purely educational and the price of licences for platform independent programs suggests that their development was very expensive and thus focusing on educational or research functionalities for authors was not essential. Nevertheless, there are some tools developed by university teams and their functionality is explored as well. There is one more disadvantage when using tools from platform independent category, that is quite annoying. When developing a project, there are usually no automated methods for holding the consistency between source code and models developed that are running real time. This feature is dependent on the tool used, but it is necessary to mention that large majority of software from platform independent category fails to meet this request. The requirement of the method maintaining consistency running real time is not derived from MDA’s definition, but when working on an exemplary

CHAPTER 2. CATEGORISATION

16

project, this feature appeared to be mostly valued. If not available, situation when newer version of the model is rewritten by older one by user’s fault, can happen. Presence of this feature accelerates and respites project development. Different categorisation of tools, which is not decisive for this thesis, can be done according to theirs licences. There are two groups, namely free licensed or open source tools, and ones with paid licence. This selection should not affect quality of the software, but implication that those with paid licence are more sophisticated and with wider functionality, is correct. Authors of free licensed or open source tools usually focus on building tools with basic capabilities enriched with one method, that is the main contribution of their product. On the other hand, software with paid licence comes in several editions, depending on its complexity. If using the most sophisticated edition, large scale of methods and functions is available. Authors generally try to offer complex solution for project development including MDA’s standards. Nevertheless there is no tool meeting all requirements stated by this thesis. Analysing and testing tools with open source or free licence is trouble-free. Difficulties may occur, when analysing software with paid licence. Generally there is free evaluation key with time limited validity, but there might be limited functionality for these keys as well. It is not frequent that free evaluation licence includes corporation or enterprise editions. There are some tools, that offer evaluation key only on request, and others that don’t offer trying their content at all. For these software analysis can be done only by studying documentation and guides. Nevertheless some of these tools are mentioned, because of their tribute to MDA’s project development.

Chapter 3 Platform Specific Category
Tools categorised within this group are specifically designed for developing project for the given platform. Two main representatives, one for Java, one for C (MS Windows platform) are analysed. These tools are mainly interactive development environment (IDE). The third IDE that is analysed within this thesis is placed in platform independent category, for the reason mentioned in the corresponding section.

3.1

Eclipse

Introduction Eclipse is an open source community, whose projects are focused on building an open development platform comprised of extensible frameworks, tools and runtime for building, deploying and managing software across the life cycle. The Eclipse is member supported corporation that hosts the Eclipse projects and helps cultivate both an open source community and an ecosystem of complementary products and services [8]. History The Eclipse Project was originally created by IBM in November 2001 and supported by a consortium of software vendors. The independent not-for-profit corporation was created to allow a vendor neutral and open, transparent community to be established around Eclipse. Today, the Eclipse community consists of individuals and organizations from a cross section of the software industry [8].

17

CHAPTER 3. PLATFORM SPECIFIC CATEGORY

18

Modelling Frameworks Eclipse IDE does not contain any modelling functions. The only way to secure this is to install additional frameworks. There are plenty possibilities, but some of them are done by amateur developers and their functionality is limited. There is a free plug-in included in Eclipse and accessible from it’s market. It is called Eclipse modelling frameworks (EMF). Another possibility is downloading BlueAge, framework that specializes in round-trip engineering for eclipse. BluAge is co-financed by the European Union. BluAge is a registered trademark of Netfective Technology. This tool is not free, but ten days evaluation key can be obtained on demand (mail with several information needs to be send) from Blue Age company. However, after two emails asking for evaluation key, no response was given. Frameworks Import As there was no way to analyse BlueAge, EMF framework is used. In order to do so, packages need to be installed. There is a huge amount of packages concerning EMF available on Eclipse market. The most important ones are EMF - Core Runtime, EMF- Runtime and Tools, EMF - Code Generation, EMF- Code Generation UI, EMF - Common, EMF - Common UI, EMF - Compare Source, EMF - Documentation and EMF Framework SDK. The finding and installing phase of import of EMF takes a lot of time and requires a knowledge, which packages are necessary. It is also a bit difficult to find some threads discussing this matter. In conclusion, the process of adding EMF to Eclipse it taking a lot of time and effort and can be done in the much more easier and more pleasant way. Graphic User Interface The interface of Eclipse is very lucid and simple. The top part of the screen is dedicated to the menu, left part to the navigation diagram. The bottom part contains system messages and the huge middle part is left for the implementation of the source code. The bottom tab can be switched into other messages or error lists, according to the imported modules. The same applies for the left tab. Import and Export Eclipse EMF is capable of importing and exporting XMI and XML files. There is no other possibility than usage of screenshot,

CHAPTER 3. PLATFORM SPECIFIC CATEGORY if JPG or PNG output is desired.

19

Reverse Engineering Support It is important to notice that Eclipse is not a tool, where the model development was intended right at the beginning of its creation. Therefore any attempts to create a model or reverse engineer already implemented source code are extremely difficult and it takes a huge amount of time to succeed in this matter. User has to spend hours reading EMF’s guides in order to find desired functionality or method. EMF does support reverse engineering, but it is highly laborious. This discovery is made after several hours studying this IDE. Model Creation There are several approaches one can choose if user desires modelling system with help of EMF. The easiest way to do so, is to import the model created in Rational Rose. Only few simple steps that are listed in EMF guide [7] are required. The second option, is to use definition of model using annotated Java. We can start with a set of Java interfaces and classes that correspond to the classes and enumerated types, respectively, in the library model. This code is the bare minimum required to illustrate the desired features. Based on it, an Ecore model and a generator model will be constructed, which will then drive the generation of the remaining code. The code is annotated with ”@model” tags in Javadoc comments, in order to specify any non-default values for the attributes and references of the Ecore objects. The guide listing all necessary steps is quite difficult and listing them would consume a lot space. The detailed procedure can be found in [7]. After creation of model is done, diagram can be generated. It is displayed in Figure 3.1. Code Generation EMF is capable of generating the EMF Model Code. It is not as difficult as creation of the model. However, if compared to other tools, especially IDEs, it is the most difficult one. Code generation consist of several complicated steps listed in EMF guide. The source code generated is correct, complete and contains information that it was created with help of EMF. Several notes present upon model creation may be created as well.

CHAPTER 3. PLATFORM SPECIFIC CATEGORY

20

Figure 3.1: EMF Model Conclusion It is very unfortunate that BlueAge evaluation keys are not obtained. The development of the project with the help of EMF is extremely laborious and difficult and takes a lot of time to study it. On the other hand, if done correctly, very nice functionality is achieved.

3.2

Visual Studio

Introduction Microsoft Visual Studio 2008 Professional (VS) is one of the possible essential tools for individuals performing basic development tasks. VS simplifies the creation, debugging, and deployment of applications on a variety of platforms including SharePoint and the Cloud. Visual Studio comes with integrated support for test-driven development, as well as debugging tools that help when trying to achieve high-quality solutions [4].

CHAPTER 3. PLATFORM SPECIFIC CATEGORY

21

There are several versions of Visual Studio available nowadays. MS Visual Studio is free for students of Masaryk’s University Faculty of informatics (FI MUNI). Version 2008 was chosen due to the fact that it is still used more frequently than newer 2010 version. There is also the latest 2011 beta version available for students of FI MUNI. Language Support VS is an IDE. Therefore it is categorized in the platform specific group. However, it supports more than one language. C++, C and Visual basic are the languages, for which VS works as an IDE. But the fact VS is running strictly on MS Windows platforms makes it platform specific. Modelling Framework VS itself is not capable of more complex solutions for project modelling. The best way to ensure this functionality is to install Microsoft Visual Studio Team System Architecture Edition Power Tools. The Team System Architecture Edition Power Tools are a collection of features that augment and enhance the possibilities of VS and simplify work of the distributed system designers. Microsoft Visual Web Developer and Microsoft Visual Studio Team System 2008 needs to be installed together with this collection as well. However MS Team Architect is not amongst versions accessible for students. Code Generation Code generation is done automatically when edits to the model are applied. This feature is making system development much more easier and faster. Reverse Engineering Support Reverse-engineering of the source code in VS can be done with tools already present after the installation of the IDE. Several steps need to be followed in order to achieve this. First, a new project must be created. For this project, a programming language has to be selected, and it is the point of no return in means of the platform independence. Even if VS is not categorized amongst platform independent tools, this means, that the language cannot be changed from C to C++. If one wants to reverse-engineer classes for project that is already in progress,

CHAPTER 3. PLATFORM SPECIFIC CATEGORY

22

Figure 3.2: VS Combined class diagram one needs to import existing classes into the new project. Unfortunately this can be done only by importing classes one by one. For bigger projects this might be very laborious. Unless the project is already started in VS and is opened instantly. When classes are imported, adding a class diagram is the next step. It can be done by summoning the menu for the current project and using the function Add new item. The class diagram needs to be selected, and if done so, it is created. However, this diagram is empty. There are some advantages and disadvantages accompanying this feature. In order to fill the diagram, classes from the solution explorer need to be dragged on the screen of the class diagram. If a large amount of classes is imported, this will take some time. Right after a class is added, relations are displayed according to the source code. Advantage of this feature is that the user can only see the part of the class diagram, he wishes to. When the object is dragged on the screen, only its name and type (class, interface, etc.) is displayed. Methods and properties can be shown as well, if an Expand function is called. This allows user to combine features of design and analytic class diagram, making

CHAPTER 3. PLATFORM SPECIFIC CATEGORY

23

the diagram simpler in areas he needs them to be so and more informative elsewhere. This feature is demonstrated in Figure 3.2. Another feature of VS and its model management, is that changes done to the class diagram are instantly reflected into source code and vice versa. Unfortunately, there is no way that any other model is created. More adjustments to model customization are not available as well. Conclusion In conclusion, VS is a pleasant IDE with some features that are very helpful for developers. However, their requirements won’t be met in terms of MDA definitions.

Chapter 4 Platform Independent Category
This category contains tools, that allows user to be platform independent down to the lowest levels of analysis. One case necessary to mention is present. An IDE, called NetBeans, is categorised amongst these tools for reasons listed below.

4.1

NetBeans

Introduction The NetBeans IDE is an award-winning integrated development environment available for Windows, Mac, Linux, and Solaris. The NetBeans project consists of an open-source IDE and an application platform that enable developers to create web, enterprise, desktop, and mobile applications using the Java platform, as well as PHP, JavaScript and Ajax, Groovy and Grails, C/C++. The NetBeans project is supported by a developer community and offers extensive documentation and training resources as well as a diverse selection of third-party plugins [6]. Language Support Even though NetBeans is an IDE that was developed focusing on building Java applications, nowadays it supports up to seven different languages. This reflects in NetBeans being IDE, but placing itself in the platform independent category. But there is one warning to be mentioned, that concerns this categorization. All the other tools in this category are capable of creating models, that are, on given level, platform indepen-

24

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

25

dent. NetBeans does not support this feature the same way. When starting a new project with support of UML, there are only three possibilities. The first one is called Platform independent model and it allows user to create one, however there is an issue with it that is mention later. Second option, with a name Java-platform model, mediates user Java platform project creation. Last option is called Reverse engineered Java-platform model. Issue with first option is, that no transformation from source code can be done. Code generation is supported, but reverse functions are not. For the reverse engineered Java platform project, both functions are available and thus transformations might be applied. It was difficult to categorize NetBeans according to its project orientation, but the categorization of tools has been done according to the ability of tool developing projects for several platforms and this requirement is met. Modelling Framework The newest version of NetBeans, at the time this thesis is written, is NetBeans 7.1 IDE. Unfortunately, this version does not support the UML Modelling Module, that provides model transformation functions. It is quite a disappointment that developers are unable to enjoy using this tool within new versions of this software and if they want to use it within NetBeans IDE, they have to use version 6. Many notes concerning this issue can be found across different forums [5] dedicated to the NetBeans development. What is even more disturbing is the fact that NetBeans 6 cannot be installed on the latest version of Java. Therefore, Java 5 or 6 has to be installed, if usage of this plug-in is desired. It is a huge setback for project development, but functionality of round-trip methods may excel. Another issue concerning NetBeans is bound to the fact, that once Java 7 is installed, older versions can not be present. Therefore, Java 7 has to be removed. However, paths to Java virtual machine (JVM) will stay written in the regedit (collection of registers , this issue concerns Windows platforms only) and even reinstalling Java to its older version is not enough, as an installer of NetBeans will choose path to the newer version of Java and ignore the old one. Complete purge of regedit is needed in order to be able to run NetBeans 6 installation (in case of testing NetBeans for this thesis, even purging regedit was not sufficient, and thus testing on the different machine,

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

26

Figure 4.1: NetBeans that had not yet installed Java, had to be done). The question, whether this amount of trouble is worth it, is in place. But, it would not be satisfactory to ignore one of the best IDE’s available nowadays. Graphic User Interface As can be seen in Figure 4.1, the environment of NetBeans is very lucid and simple. All necessary functions and tools are displayed. If several diagrams on the same level ale created and object from one diagram to another is dragged, its source is shown under the name of the object. This provides better orientation throughout the system. Properties and methods of classes in the class diagram can not be hidden, the same applies for other diagrams. Reverse Engineering Support When reverse-engineering the project, that already has some classes implemented, empty diagram is generated. To create complete diagram for the given system, all objects, in this case classes, have to be dragged into the modelling screen. This action can be done for more objects at once and thus does not slow down model creation for bigger systems. When done so, relationships are displayed immediately with their cardinality. NetBeans does not support runtime generalization and if changes are made, it is necessary to reload the project. This fact is

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

27

very unpleasant and unexpected, as all the other IDEs support the feature. It concerns transformations from source code to model as well as the other way. Extended Reverse Engineering There is however a feature that makes NetBeans unique amongst IDEs. It is capable of reverse-engineering source code to more than just a class diagram. After a class diagram is created, more functions are accessible from a the menu invoked for displayed methods. One of them is called Reverse engineer operation. A window offering two diagrams pops out, namely the collaboration and the sequence diagram. This feature would be a huge breakthrough and would make NetBeans first tools with combination of an user friendly development with expanded modelling capabilities. But, diagram generated contains lifelines without any messages connecting them. The same applies for the collaboration diagram and even though lifelines generated are the correct ones, it is not enough to consider this feature contribution. Code Generation As mentioned earlier, support for the code generation is build within NetBeans, but with the disability to generate source code on the fly. As expected, this feature is accessible for all diagrams, that can be created in this IDE. There are no issues accompanying this feature. Conclusion Appraising all downsides and upsides of NetBeans, final position should be taken. From the developer’s point of view, advantages derived from the fact that it is an IDE are huge, however inability of running the project on newest platforms is too much to ignore. As UML modeling module is not build within the latest version of NetBeans, this tool is not suitable for project development. On the other hand, if such functionality was to be implemented, it would make NetBeans great tool. Several features concerning the reverse-engineering for sequence diagrams need some more work as well.

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

28

4.2

Altova

Introduction Founded in 1992, Altova is a commercial software development company with headquarters in Beverly, MA, USA and Vienna, Austria that produces integrated XML, database, UML, and data management software development tools. Altova company is manufacturing several tools covering all aspects of project development. There are several amongst them, that will be mentioned [1]. Altova SemanticWorks R 2012 is the visual editor from the Altova. SemanticWorks streamlines the job with tabs for classes, properties, instances, etc., context-sensitive entry helpers, and automatic format checking [1]. Altova MapForce 2012 Enterprise Edition is a graphical data mapping, conversion, and integration tool. It maps between any combination of XML, database, flat file, EDI, Excel 2007 (OOXML) and/or Web service then transforms data instantly or autogenerates royalty-free application code for use in the execution of recurrent conversions [1]. Altova UModel 2012 provides a starting point for software development, visually designing application models and generating Java or C code, or reversing engineer existing programs into UML 2 diagrams then amending and fine tuning designs and completing the round trip by regenerating code. UModel 2012 is making visual software design practical for programmers and project managers [1]. Graphic User Interface Altova UModeler is equipped with all necessary functions for creating any UML diagram. When creating the class diagram, a tool bar offers short cuts for a class, a package, a class template, an interface, an enumeration, a data type, a primitive type, a profile, a stereotype and all association links for connecting these objects. The main screen contains a tab with a model tree, which is to help the orientation in more complicated models. Nevertheless it is less lucid than the model itself. This tab can be switched to a diagram tree, that contains all diagrams of the given project, that were constructed. It is very helpful in finding desired diagrams. There is also a tab called Favourites, allowing user to place items, which are accessed more often. Several functions are implemented to help working within these

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

29

tabs. The most useful are sorting and grouping. There is an overview of the chosen model available, on the left menu. It shows miniatures of objects (classes, actions, lifelines, etc.) and their placement. It might help when orienting in larger diagrams. An overview can be switched into a documentation. The lower section of the main screen is dedicated to system messages such as parsing files, errors during reverse engineering or analysing modules. Code Generation Generation of the source code from the class diagram works fine. Altova UModel creates classes, methods and properties according to class diagrams. Bodies of methods only contain a comment, that given methods needs an implementation. When deleting parts of the code there is an option to do so leaving a comment, which contains an information about this method being deleted. There are more useful functions implemented within this tool. When modelling classes there is an option to create setters/getters for a property, but Altova itself is not capable of generating the body source code even for these simple methods. Developer might lack the possibility of real-time overwriting source code. This feature is not implemented when working on a class diagram. However a function doing so on command is present. Developer can either overwrite a source code with a model, or overwrite a model according to a source code. This absence is quite severe if the user is modeller and developer at the same time, working on a smaller project. It is very unfortunate when the modeller is building a project creating classes and wants to use another editor only for writing body of methods. When doing so, he needs to be continuously aware which version is newer, if the source code or the model. Generation of the source code and the model takes some time and if user is forced to repeat this action every time he decides to implement even small changes, it will result in the speed of the slower development. Unfortunately, there is no possibility of setting own syntax for representation of models. Reverse Engineering Support There is also a possibility of using the reverse engineering for an existing project. This function is called Import source directory. Altova UModel supports the reverse-engineering for several

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

30

languages, C 1 to C 4, Java1.4, Java 1.5 and Java1.6 and Visual Basic from the version 7.1 to the version 9.0. A language has to be selected as well as a path to the source code directory. Another options such as parsing all files within subdirectories, importing directories relative to Umodel, Javadoc documentation generation, and the synchronization (merging model to diagram or diagram to model) are present. After parameters in the first step of the diagram generation are set, another window pops out with more possibilities. These allow to configure settings such as generating a single diagram, generating a diagram per package, showing the nested classifiers separately, hyperlink diagrams to the package and another set of option concerning the style of the diagram. Another window offers the possibility of generating a package diagram as well. If chosen, settings linked to this option are necessary to be filled in. After that, chosen diagrams are created. Altova Umodel is a tool, that is capable of doing so without any mistakes. Along with the class diagram, a package dependencies diagram is created. All generated diagrams and their contents are listed in the diagram navigator. Extended Reverse Engineering Generation of the sequence diagram is required if an user wishes to continue with modelling. Table with options is offered right after executing the function. In the newest version of Altova Umodeler, there is one new feature accompanying creation of the sequence diagram. This allows Altova UModel to be able to automatically update the diagram if the source code is edited. It is a loss though, that it is not included in the class diagram as well. There are more settings available for the sequence diagram creation, ignoring selected names, splitting into several diagrams if necessary, adding notes on separate levels and several more related to the diagram styling. The diagram is generated afterwards, with list of errors and warnings. The diagram created is correct and the feature holding consistency between the model and the source code is flawless. If feature assuring the automatic consistency maintaining was not selected, the possibility of additional balancing the model and the source code is possible. In this case, user has to choose, whether he wishes to overwrite the code with the model, or vice versa. There is one more step, that can be done, in terms of automated model

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

31

generation. And that is the creation of an activity diagram from the sequence diagram. This function can be found after invoking the menu for the sequence diagram editing. Its creation is not accompanied by any options. The diagram is generated and can be adjusted further. If so, the sequence diagram is not updated automatically, the function that generates the sequence diagram must be called. This act replaces the old model. Also no function holding the consistency between the activity diagram and the source code is present. The advantage of the activity diagram lies within the simplicity of its reading. The sequence diagram created might be quite complicated, even for simpler methods. In case when sequence diagrams are too difficult, activity diagrams are much easier to understand. And by two simple steps, changes done, can be reversed into the source code. Conclusion Altova Umodel is a tool that has accomplished to meet majority of request, that define perfect modelling tool. However, there is much to be done. Automated consistency checking for more than sequence diagram and defining own syntax for models are the main functions, that need to be implemented. Nevertheless working with this tool is simple and pleasant. It is equipped with combination of functionality, that is unique and makes the project development faster.

4.3

StarUML

Introduction StarUML is an open source project to develop fast, flexible, extensible, featureful, and freely-available UML/MDA platform running on Win32 platform. The goal of the StarUML project is to build a software modelling tool and also platform that is a compelling replacement of commercial UML tools such as Rational Rose, Together and so on [16]. Graphic User Interface Right after launching StarUML, the screen offering start of the new project according to the approach, pops out. There are 5 possibilities left for an option: 4+1 View Model, Default approach (settings according to default setting of StarUML), Rational approach, UML Component approach (focusing on UML components) and empty project (without

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

32

any adjustments to GUI). The navigation diagram offers model explorer option only. Creation of diagrams can be managed from here. Other than that, the main screen is equipped with properties tab(of selected item), output system messages tab, sheet containing objects for the current diagram and a main control tab on the top of the screen. Import/Export StarUML is capable of exporting it’s diagrams. The flaw of it is, that this feature does not allow user to export the model in XML so only XMI format is available. StarUML is allowing user to export the diagram in a picture format as well and does so, from a different option in the main menu. The import method works for XMI only as well. However importing of the model fragment is available. This fragment, represents any object within the StarUML model. It can be exported from the menu that manages object’s properties. It is very interesting that this tool is capable of importing Rational Rose files. There are several options customizing this import offered (converting instance elements to role elements, generating the diagram and viewing it and adding an original file path to the project attachments). Roundtrip Engineering Support StarUML offers round-trip engineering methods for 3 languages. There are C++, Java and C . Before using a function securing the reverse engineering, a profile according to the source code language must be selected. However there is no limit to the number of profiles included for one project, so from this point of view, the model independence is secured. The process of parsing classes is done in few steps. First, classes need to be chosen, then a view is to be selected. The window doing so is offering use a case view, a logical view, a component view and a deployment view. However there is no difference when choosing different approaches. This step is done as well for the code generation and has the same no-effect as well. The feature might be not implemented and left for later patches to fix. The last step consist of selecting several options for reversing the source code. There is a possibility of generation Javadocs. The generation of public, package protected or private visibility only objects can be selected. For diagram options there is a chance to select the diagram

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

33

name and the possibility of creation an overview diagram. The reference field creation has two options. When selecting field to the attribute option, a diagram without complete set of associations is created. However if a field to the association option is chosen, a correct diagram is generated. Last 4 check-boxes allow suppressing attribute or operation compartment, the generation of generalization and realization views only and hiding the operation signature option. Parsing of the source code includes checking for syntax errors and the miss-assignment of values. After parsing the code, report of these incidents pops on the main screen and in addition is shown in the system message bar. The content(properties and methods) of classes is correctly extracted from the source code. This feature was tested on a small project as well as on one huge(more than 50 classes). The number of classes does not affect correctness of parser. However the interface is represented anomalously, it is shown as filled circle not listing methods and properties. The multiplicity of associations is only one-sided, but in the properties full multiplicity is defined. All objects (classes, properties, methods, diagrams) are listed in the model explorer. This solution is not the best one, as in larger projects, it is difficult to orient with only help of one common explorer. The fact that objects are hierarchically sorted helps, but the existence of several explorers would be much more appropriate. Extended Code Generation StarUML is one of few tools that allows users to custom some options when using the code generation feature. Windows with these options offers generating Java docs and generating an unnamed association end. There are two more options. One is inserting tab as space with the possibility of setting tab width. The other one allows the generator to place opening curly brace ( ) in the new line. The generated source code starts with comments containing several information about the project. Project name, file name, date, author name and information that this is the code generated by StarUML are included. This tools suffers from the same defect as majority of freewares. It is the fact, that its unable to change the reverse-engineered source code without rewriting it and thus loosing the data. This feature is often forgotten and hugely degrades usage of this tools.

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

34

Figure 4.2: StarUML Extended Functionality Unfortunately there is no way to hold continuous consistency between the model and the source code. As well there is no possibility to generate any other model from the source code. Creation of user defined syntax for representing objects in diagrams is missing too. Tool development On several sites, dedicated to project development, there are some links to StarUML. Nevertheless there are many threads discussing death of this project. StarUML being open source tool, leaves the possibility of being revived and its functionality improved. Conclusion This tools leaves user with feeling that its not completed and that some features are only half-done. Even though methods and functions implemented are working correctly, there are some software, that are more sophisticated and have better support throughout the developer community. There are few of those which are even being freeware.

4.4

OpenAmeos

Introduction OpenAmeos is the multi-platform/multi-user UML R Modelling Environment with unique support for UML 2.0 Profiles, MDA R based Model Transformation and support for color to visualize semantics [13].

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

35

OpenAmeos is another tool from free licensed and platform independent category. Right after launching OpenAmeos screen, that requires system(in this case it is synonym to project) selecting is shown. It is a bit unfortunate, cause it does not allow to create new project. Thus, when creating new, existing one has to be opened first. After starting new project, there is need to import profile. Several are left for option, such as CPPStandard, CsharpStandard, HIPConnectors, HIPRmi, RavenAssociation, RavenProtectedObjects, RavenTask and UMLStandard. Only one profile can be applied for one project. Graphic User Interface The bottom tab, listing system messages informs about the successful import of given profile. The main screen is split into 4 large areas. THe pop left part is dedicated for the model orientation explorer. It is strangely divided into several categories. The diagrams category is the first one followed by some views. Categorization into more that one tab in project explorer, would be much better solution, as it would not seem so chaotic. Only the quarter of the screen, top right one, is dedicated to the diagram modelling. This organization is only implicit and windows can be resized, but at least one will suffer from lack of space. The bottom part of screen is split into 2 main areas. The first one contains details of the object selected in the diagram. The other one is showing details of the parameter selected and is quite redundant. As mentioned earlier the lowest part of screen belongs to system messages. Reverse Engineering Support Reverse engineering functions are accessible from the import menu. Three languages are offered, C++, Java and Ada95 being amongst them. Reversing the code is done in several steps. Firstly a parent directory for files of classes is to be selected. The path explorer is not very pleasant to use, user can move only one step at the time, and can’t select different disk instantly. The button PopulateParseList needs to be used after, for parser to select all classes. This method should have need implemented more carefully as it can cause several troubles, especially when user wants to reverse only several classes that are in an large directory. Unwanted classes can be removed from populated class list, but it has

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

36

Figure 4.3: OpenAmeos to be done, one by one. When classes are successfully selected, the next tab offers several options. For the Java source code, there are three source types, Java source, Java source pre-compiled, or Java class/jar. The function called incremental mode can be selected as well. If all options are set, a parse function can be called. When reversing Java code, OpenAmeos has to find path to Java virtual machine(jvm). Amongst at least five attempts, all five failed. It was caused by the inability of this tool to find jvm. The functionality was tested on three different computers, with different operation systems(windows 7, windows XP, Linux). OpenAmeos uninstaling and installing again as well as Java did not seem to help. Extended Reverse Engineering Reversing the C++ code is similar to reversing Java. The difference comes with windows containing the reversing function. Instead of three tabs there are six as can be seen on Figure 4.3. The source files tab is the same, consisting of the path explorer and the class selector. However there is one more function. It’s capable of opening and reading DSW files and its aim is to read the MS Visual C++ Project file. Selecting these files comes with a much more intelligent file selector that one selecting classes. The second tab is named Makefile. The selector for finding make file is present. With it a lot of options. Make file type(Generic, Nmake, Gnu Make), overwriting current settings, depth bond, and several patterns amongst them. The third tab named preprocessor allows to use no

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

37

preprocession function or one that should undefined platform specific definitions. This feature is quite specific and was not detected in any other tool compared within this thesis. The parse code tab consist only of two options allowing to use Microsoft (MS) extensions and using the incremental mode. Another tab that is specific for C++ reverser is called comments. Settings for commenting classes, members, functions and parameters for these comments might be applied here. The use of delimiters is controlled from here as well. The last tab that is common for all three languages supported with reverse engineering function is called simply options. Annotation of classes as external, including operation bodies can be selected for the model generation. If classes already exists, the regeneration and the retaining user modification options can be set. These methods cause this tool to be able to iterate the round trip engineering without risking loss of the data. Finally after setting all the options parser method can be applied. If there are some warnings or errors, information about them is listed in system messages. The window with options for the parses function stays opened even after parsing files. This can be very useful, if any troubles occur, editing parameters can be done without repeatedly filling the same options. Conclusion OpenAmeos is tool that is not yet finished. It can be seen in some incomplete methods. It is however on the good way to become a free tool, that can be used by system modellers and developers. It contains some features that are not seen in any other software, proving, that there are still some improvements to be done.

4.5

VisualParadigm

Introduction Visual Paradigm for UML (VP-UML) is a UML design tool and UML CASE tool designed to aid software development. VP-UML supports key industry standards such as Unified Modelling Language (UML), SysML, BPMN, XMI, etc. It offers complete toolset software development teams need for requirements capturing, software planning, test planning, class modelling, data modelling, and more [10]. It is important to include this software in this thesis as VisualParadigm is

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

38

a tool used by students of FI MUNI during several subjects. VisualParadigm is equipped with large scale of functions necessary when modelling UML diagrams. Out of all tools compared within this thesis, VisualParadigm’s environment is the most transparent and friendly one. Graphic User Interface The class diagram modeller offers managing properties as well as operations and theirs privileges, inputs and return parameters. It is equipped with a function that is responsible for highlighting the property after an association, that is linking classes on its base, is selected. The navigation tab has several possibilities of categorising the project. There is a diagram navigator, grouping project models by diagrams, model explorer, which is presenting classes and theirs methods, class repository, listing implemented classes, logical view and ORM. All these function cause the modelling to be easy and helps orienting even within large projects. Import/Export VisualParadigm is a tool capable of exporting designed models into several output files. It is a standard that tools are able to create image outputs, however Visualparadigm can export models into XMI and XML. There is even possibility to export data into MS Excel or MS Word. There is also a function creating reports in MS Word, HTML or PDF available. This tool comes in several editions such as professional, standard, community, enterprise or modeller. The home website suggests that standard edition is sufficient for the round-trip engineering, however after using function for the reverse engineering, a window which requires switching into the enterprise edition pops out. Nevertheless VisualParadigm is having an effect of ideal tool for the project development, there are several downsides that need to be mentioned. Reverse Engineering Support The reverse engineering is accessible for several languages. This function can be found in a tools tab, offered in a Code Engineering subtab. It is necessary to divide these functions into several categories. Functions Java Round-trip and C++ Round-trip are two functions that

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

39

Figure 4.4: VisualParadigm are capable of reverse engineering the code. Two languages are left for option as user is to decide to reverse C++ or Java classes. There is a possibility of reversing the code for other languages as well. It can be done within the second function called Instant Reverse. It supports up to 9 different languages including C , Python, PHP and 6 others. User is to choose the directory where project classes are located. This function is accessible even for the standard edition. Third category is state machine code engineer, that is working only with the given language. An example of the reversed diagram is displayed in Figure 4.4. After successfully parsing the code, project classes are displayed in a class repository. From here, two diagrams can be created. VisualParadigm supports creation of a class diagram or a package diagram from reversed classes if a round-trip function was used. Diagrams created using the reverse engineering are correct and complete. This is the feature that most of the tools share. However there is but one possibility to create any other diagram from the source code in VisualParadigm. If the round-trip function was used there is no way to create any other diagram.

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

40

Extended Reverse Engineering The only other possibility of creating other diagram (from code) than class or package, is to use the instant reverse. Last option in this menu is Java to the sequence diagram. However path to zip files, or directory containing them is required. There is no support from VisualParadigm for creating the sequence diagram for other language than Java. Even though Java to sequence diagram is part of the instant reverse menu, it is disabled for the standard edition. Code Generation In diagram navigator, there can be created any available model for objects given(for example in the class diagram). There are some function offering maintaining consistency between this new model and the object, model was created for. VisualParadigm lacks possibility of creating this diagram from the source code. The biggest flaw is fact, that after reverse engineering the project, editing it and generating source code, if original files are selected, they are overwritten and theirs content is deleted. The only upside of this function is, when reverse engineering, it keeps comments for implemented classes. Generalisation of methods includes throwing exceptions. These facts degrade use of VisualParadigm’s reverse function only for projects, for which already implemented content is not to be changed. Otherwise loosing parts of the source code is at risk. Conclusion In conclusion VisualParadigm is a tool, that is perfect for developing projects from theirs beginnings. Its environment helps to orient very easily and a variety of functions supporting MDD cause projects to be built effectively and fast. Its disadvantages lie in field of round-trip engineering. Even though it is supported and reverse functions are working correctly, due to the inability of iterated round-tripping without loosing data, this tools is unsuitable for this line of the project development. Among others VisualParadigm lacks the possibility of pre-scripting user defined syntax for models and thus its orientation towards MDD can be questioned.

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

41

4.6

EnterpriseArchitect

Introduction Enterprise Architect 9.3 is a high performance modelling, visualisation and design platform based on the UML 2.4.1 standard. With complete traceability from mind mapping, through requirements to business and software design and deployment , Enterprise Architect 9.3 provides the kind of robust and efficient visualisation and collaboration required in today’s large and demanding modelling environments. Being an agile modelling solution, Enterprise Architect 9.3 provides a low installation overhead, performance and an intuitive interface [17]. Another important part of functionalities of this tool is development support creation of software design, code generation, testing, deployment and many others. It is suitable for project development for huge teams, as it supports life cycle of software development, audit and version of models. Nowadays EA is used by more than 230 partners in 160 countries [15]. Language Support The code generation and reverse engineering are parts of Enterprise Architect, with the support of more than 10 languages. The source code editor is build in Enterprise Architect, which is making adjustments to the code much more effective. Integration with Eclipse and Visual Studio offers direct access to models, theirs editing, all within user’s favourite IDE. Enterprise Architect claims to be supporting the advanced MDA transformations using simple editable transformation templates. There are several included in Enterprise Architect such as: C , DDL, EJB, Java, JUnit, NUnit, WSDL, XSD. With theirs help user is capable of fast, detailed development on abstract models. Using one platform independent model, there is a possibility of creating many specific solutions. Unfortunately most of these features are included in the corporate edition, that is the most sophisticated and most expensive one and isn’t part of the free evaluation edition. Graphic User Interface Professional version of EnterpriseArchitect is tested. Right after launching it, the screen that allows customization of the menu visibility, pops out. It is offering several user interfaces, depending on which part of the model development project will focus. Eight approaches

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

42

are offered, Software engineering amongst them. It should be able to supply with all code generation and reverse engineering functions. The selection of workspace layout follows. It only affects user interface and twelve approaches are left for choosing. Following by the screen where selection of an active technology is to be chosen, user is offered plenty of possibilities. Starting with basic UML 2 technology and simple UML views ending with Win32 user Interface modelling. Implicitly all technologies are selected. When all options were chosen, a menu with possibilities of opening existing project or starting new one pops out. Model patterns, application patterns and EA examples are to be chosen before starting a new project. For each technology selected in the previous menu, there are models and sub-approaches offered for the selection of model patterns. The application pattern supports only three programming languages. There are Java, MS C++ and MS C . For each language there are several templates available for the project. For C languages there are possibilities of using MS VS(Microsoft Visual Studio) 2008 or MS VS 2010. The main screen of EnterpriseArchitect is divided into several sections. On the top right side is a project browser. It can be switched into model or element views, insuring that all desired objects of the model can be found in no time. Implicitly left top part of the screen is dedicated to the learning center, but can be closed as any other window and customized according to user’s will. On the left bottom side, the Pan&Zoom tool is present. Its sense is to give user an overview of diagram’s elements. The middle of the screen offers space for modelling itself. With one side tab, equipped with objects that can be inserted into the current diagram, it acts simply. One tab is missing, and its the one showing preferences of selected objects. The difference between EnterpriseArchitect and other tools is in a projection of diagrams. All diagrams are shown on the bottom of the modelling screen and can be accessed very fast. Together, the environment of this tool is simple, comfortable and easy to use. Import/Export This tools is capable of exporting the content of the project in several ways. Pictures of diagrams can be created as well as export into XML can be done. However exporting models into XMI is missing.

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY Importing function for XML is present and working correctly.

43

Reverse Engineering Support The reverse-engineering source code with EnterpriseArchitect is not as easy as with other tools. Watching guide videos present on the main page of Sparx Systems is recommended. Before reversing the source code of an existing project, there has to be one created. After it’s creation, a sub-model to the main model needs to be defined. Then, the function for reversing the source code can be accessed, right from the model navigator. After selecting the code engineering option, several others pop out. These options depend of the modelling approaches selected in the phase of the project creation, right after launching EnterpriseArchitect. There are two ways how to reverse the desired code. First one is, calling the function import from the source directory that opens a window, asking to find way to this directory. Several other options such as synchronizing existing classes, overwriting existing classes or creating a logical diagram for each package are present. The language must be selected as well. If other function, called import from source files is selected, an option listing ten languages is shown. There are action script, C, C , C++, Delphi, Java, PHP, Python, VisualBasic and VB.net. The large scale of options within this function shows, great support for platform independence of EnterpriseArchitect. For every menu within this tool, there is a help option redirecting immediately to the page dedicated to the given topic. This is quite nice feature specially if user finds himself lost and does not wish to spend time searching for an appropriate topic in help. After the function is called, new window showing the progress appears. It stays opened upon completion, for user to check for errors or warnings. Classes appear in the model explorer and a class diagram is generated. There are no mistakes in this diagram and it’s presentation is very clear. There are no further functions for additional code parsing and the creation of the activity or sequence diagrams from code, or already generated class diagram. Code Generation The source code can be generated from the diagram using function located right next to the reverse-engineering one. However, there is one more feature. The function called Live code generation is the

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

44

biggest highlight of EnterpriseArchitect. It is causing tool to generate source code as all the changes are being applied. It is a shame though, that reverse function is not implemented, and another iteration of reverse-engineering of the source code has to be done. With combination of an implemented IDE of Eclipse or NetBeans this functionality would made EnterpriseArchitect almost ideal software for MDA’s project development. Extended Code Generation In settings menu there is an option of customizing code generation templates. These templates are sets of rules how to generate the source code for the given language. From MDA’s definition, there should be a possibility of defining own syntax. EnterpriseArchitect allows user to define his own. In the template customization menu, first language is to be selected. Than, elements of this language can be chosen and using a simple scripting language, user can change the source code written upon its generation. This feature is unique amongst all other tools compared within thesis. However, the same function for reverse-engineering methods is missing. Representation of models is strictly given by EnterpriseArchitect. Horizontal Transformation Support At the begging of this chapter, a possibility of the model transformation is mentioned. This function can be called by invoking the menu for the existing model and is displayed on Figure Y. It is called transform, and concerns all objects selected in this model, for that menu is invoked. After doing so, a model transformation screen pops out, offering elements to transform to the target model. Languages already mentioned, may be chosen. The target model needs to be selected as well (component model, analysis model, deployment model, etc.) Possibility of generating the source code upon the transformation can be included. This feature is making EnterpriseArchitect a truly platform independent tool. Conclusion EnterpriseArchitect is one of the best tools available nowadays for the model development. Cooperation of OMG and Sparx Systems results in a tool that offers users most of desired functions needed when the system, according to MDA’s definition and requirements, is being created. There are only few small issues that EnterpriseArchitect can be accused of. Even

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

45

Figure 4.5: EnterpriseArchitect the combination of this tool with possibility of developing the source code in Visual Studio or Eclipse, makes the project development so much easier.

4.7

OtimalJ

There are several tools, their content was mentioned in previous chapters, but that were not yet analysed. The reason is these are tools, for which getting free evaluation license was not to be obtained. Usually these tools are the most professional once. OptimalJ is one of these tools, and it’s disability of being tested is caused by end of this project four years ago. The following report is done by a web research only, thus information obtained are not so trustworthy. However research is based on 3rd party sites information to ensure the best reliability [19]. Compuware OptimalJ is a model-driven development environment for Java. OptimalJ was first released in 2001 and was then based on Sun Microsystems’ open source NetBeans IDE. Since 2006 OptimalJ is based on the open source Eclipse IDE. OptimalJ was developed out of Compuware’s Amsterdam offices by many of the development team responsible for the Uniface

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

46

development suite [19]. OptimalJ is available in two editions: The Professional Edition is focused on simplifying Java EE development, by providing the capability to model a Java EE application, and then generate the application’s code from the model via implementation patterns. First, a platform-independent model is made, which is then transformed via technology patterns to a platformspecific model. The Architecture Edition provides capabilities for metamodelling and for writing implementation and technology patterns, which can be used to extend the Professional Edition. Metamodels and patterns are bundled into software factories. OptimalJ was generally regarded as a technically superior but relatively expensive development environment. Compuware found it difficult to gain market share amongst the Java development community with the Optimal suite of products. Due to internal restructuring, Compuware decided in 2008 to discontinue OptimalJ [19].

4.8

Rational Rose

First released in 1985, the Rational Environment was an integrated development environment for the Ada programming language, which provided good support for abstraction through strong typing. Its goal was to provide the productivity benefits associated with academic single-user programming environments to teams of developers developing mission-critical applications that could execute on a range of computing platforms [19]. When facing rising pressures to deliver solutions faster, with fewer skilled resource, in the face of continuously changing business goals, seeking to leverage new technologies such as Web 2.0, SOA, agile and lean processes yet their rapid adoption may lead to compromised architectural integrity and increased project and compliance risks, IBM Rational Software Architect is one of possibilities that solve the issue. The solution for taming complexity, managing risk, ensuring high quality software, and shortening the learning curve of new technologies to allow focus on creative solutions and get to market faster with architectures and applications that are built to last [9]. There is a possibility to obtain evaluation key, but this only concerns IBM

CHAPTER 4. PLATFORM INDEPENDENT CATEGORY

47

employees. Rational rose (RR) is analysed based on the information from various forums and guides [9]. RR allows user to develop the project with the help of an IDE. There are several IDEs available, Borland JBuilder, several versions of VS are amongst them. There is no other way to analyse GUI of RR. However, the support in MDD transformations can be checked. RR is a tool that claims to follow MDD’s definitions and supports this methodology. It is capable of transformations for harvesting service representations (e.g. To participate in model execution-based simulations) and for bottom-up discovery of candidate services: WSDL to UML, Plain-Old Java Object (POJO) to UML, EJB Session bean to UML. Tools for designing Java EE solutions: UML-to-EJB and EJB-to-UML transformations are also present within RR. There is a support for built-in transformations, such as UML to C++ and C++ to UML. Other functionalities can be achieved by usage of RR extensions such as Rational Software Architect, Software Architect Design Manager or Rational Rose Data Modeler. Last one mentioned supports the creation of class, component, deployment, sequence, statechart, use case diagrams. Data Modeling is implemented with the support of UML 1.x version.

Chapter 5 Demonstration
In this chapter we demonstrate the capabilities and usage of presented tools on a example study. We have chosen Altova UModel as the tool to perform the model transformations with, due to its extended functionality in the given matter. However, it was mentioned before that Altova UModel is not capable of transformation from the project, that is partially implemented in the programming language, to the project in the different platform. Therefore, we use Enterprise Architect to demonstrate this function. Altova does not offer us the possibility of the source code induction. In order to fully implement project, Eclipse is used. Project Description The project chosen for the example study is a simple Java project. It simulates a basic instant messenger. The project consists of 5 classes Person, Message, Board, MyBoard and Demo, all of them already implemented. The system is executable via main() method in Demo class. It displays messages together with their authors and recipients on an instance of MyBoard class which implements the interface Board. Every message have an attribute called expires that defines how long is the message kept on the board before deleting. The source code of the project can be found in Appendix and the reversed model in Figure 5.1 Reverse Engineering We start with reverse engineering the source code into a class diagram in Altova UModel. All attributes and methods of classes and dependencies between them are displayed correctly. However, comments 48

CHAPTER 5. DEMONSTRATION

49

Figure 5.1: Reversed class diagram are not shown in the diagram. Absence of information may cause difficulties when reading the diagram. Imports of JDK classes may be displayed as well. Overview of the project in the class diagram revealed us that there are 3 associations from the class Demo to the class Person. Instances of Person, do not need to be defined as properties. This can be done from the constructor of the Demo class. Expanding the Project Model Implementation of the class Event is required to expand the project and demonstrate possibilities of maintaining the consistency between the source code and the model. First, the class diagram is edited. After, methods are modelled in the sequence diagram. However not all of them. There are some methods, for which modelling in a sequence diagram needs more time than implementation itself. Even though diagrams of these methods are generated, so logic can be studied and mistakes can be found. Umodel offers several possibilities on how to help the project implementa-

CHAPTER 5. DEMONSTRATION

50

Figure 5.2: Final class diagram tion and in many cases not even the IDE needs to be run. However, in some cases that were mentioned earlier, modelling methods in a sequence diagram is more difficult that simply writing the source code directly. Demonstration of such a case is done on the implementation of the method addEvent() in the class EventManager. This method is very simple as can be seen in its body:
// Adds e v e n t public void addEvent ( Event e v e n t ) { t h i s . e v e n t s . add ( e v e n t ) ; event . s e n d I n v i t a t i o n s ( ) ; }

The corresponding sequence diagram is saved in Appendix because it doesn’t event fit the size of the page. However, the possibility of viewing this diagram is welcome, as errors may be detected. Implementation of Changes Class Event is created with properties and methods than can be seen in Figure 5.2. Three properties for Event class are present, name of the event and the date when it is happening. The last

CHAPTER 5. DEMONSTRATION

51

Figure 5.3: Method createEvent() - Sequence diagram property named attendants holds list of invited people. Methods for getting and setting values of properties are implemented as well. Umodel offers a feature that adds these methods, however body of methods has to be implemented manually. An association with the class Person is modelled, as we need to know person, who created the given event. There are several ways to accomplish it, unfortunately Umodel enables us only one. When an association with 1..* cardinality is implemented, the property with association’s name is created in the class that is the source of this relationship. However the type of this property is Person[]. In the case a collection is used, the information, contained within the association, is lost. Method createEvent() is implemented in the class Person and its body

CHAPTER 5. DEMONSTRATION

52

Figure 5.4: Method printMessagesForPersonName() - Communication diagram was designed in the sequence diagram displayed in Figure 5.3. No further edit is needed in the source code of createEvent, as Umodel is capable of correct generation of the source code from the sequence diagram. Further Analysis Upon further analysis, the need of a class EventManager has risen. This class was implemented with only one property called events. Its instance is created from the MyBoard class and its presence is mandatory, this fact is given by the MyBoard’s constructor. The method addEvent() is storing created events and automatically sending messages to invited people. Adjustments to the the method findPersonByName() are implemented. This method is responsible for finding persons according to their name. However if name, that is not listed amongst people in the class MyBoard, is selected, no message informing about this situation is send. By simply adding new note that prints this information to the console, mistake can be corrected. The note needs to have selected option: ”is code” in its preferences. Afterwards, the source code is generated. There is no need to access the source code from Eclipse, as this function is properly and correctly completed. Extended Reverse Engineering and it’s Sense Umodel is offering us one more version of the model transformation, it is the one from the sequence diagram to the communication diagram. However, as Figure 5.4 demonstrates, type and meaning of i is not seen. The only indicators are messages 4: i.hasNext() and 5: i.next(). Information about the method

CHAPTER 5. DEMONSTRATION

53

sending the system message that the user was not found or, if successful, sending list of messages is missing as well. This is caused by the fact that System.out.println() command is used. There is a need of user defined syntax for this model, if no information is to be lost. This feature is however not supported in Umodel. Horizontal Transformation EnterpriseArchitect (EA) is the perfect tool for the model transformations between projects implemented for the different platform. However, correctness of these methods needs to be checked. A new project is created in EA and with the help of the reverse engineering function, classes are imported and a component diagram is created. If MDA’s transformation to the different platform is desired, method doing so asks for the target language. An option named Generate Code on result, is selected. Complete and correct target model is created as demonstrated in Figure 5.5. Advantage of EA over Umodel is fact, that there is no need to use IDE as the source code can be accessed from EA directly. EA is capable of changing property types and method’s return types, however body of methods is empty and needs to be implemented.

CHAPTER 5. DEMONSTRATION

54

Figure 5.5: Project component model for C platform

Chapter 6 Discussion
6.1 Ideal Tool

From experience gained by the tool analysis, ideal tool can be imagined. Requirements resulting from MDA’s definitions should be included as well. However, they can be implemented in many ways, making the project development easier or harder. This knowledge can be gained only by the proper tool study. In the MDA’s point of view, a run-time platform for system is decided on the lowest level of the analysis. Therefore the platform independence should be mandatory for all models down to this level. Situation, when the system is equipped with the source code at the start, and its platform is to be changed and creation of platform independent models from the platform specific code is desired, may occur and should be considered possible. In the first chapter, transformations for models were placed into two huge groups. First one was the horizontal transformation group. For tool to be able to handle this, ability to define own syntax for the model representation is required. This concerns models at all levels of the analysis. It was the most forgettable feature amongst them all. The other group, was the vertical transformation group and two scenarios were mentioned. An exogen transformation that was not vertical was the one more specific. The reverse engineering, that is it’s main representative, should be implemented and assure an automatic diagram generation from the

55

CHAPTER 6. DISCUSSION

56

source code to platform independent models. The other one, was an exogen transformation that is vertical as well. Code generation is an example of this transformation and it is a feature that was available for the most of tools. However, as mentioned, several ways how to achieve this functionality might be considered. For ideal tool, this functions should be running in the background and changes in the source code should be displayed immediately in models and vice versa. It prevents the developer from loosing the focus on which version of the model is the one with the latest updates. There is one trouble resulting from this requirement and it is the fact, that the tool would have to replace all benefits of IDE. Doing so, it would increase complexity of developing such a tool. On the other hand the simplicity of use is amongst these requirements as well, as no developer or analytic enjoys spending time searching for desired functions. The balance between robustness and simplicity needs to be found and maintained. As did not happen to several tools analysed within this thesis, an ideal software should be active in terms of the development and as well should have huge support throughout community. This usually resolves in a number of guides and sites dedicated to teach us how to work with these tools. It should solve the issue of complexity of such a tool. Problems same as with NetBeans and its disability to support combination of latest version of Java and the framework containing project modelling functions cannot occur in the ideal tool. Even if we are owners of the ideal project developing tool, there is no certainty that other tools are not used. Therefore this tool has to be able to export project diagrams into several formats. For documentation JPG and PNG formats are required. For importing into other software, XMI and XML output files have to be created. Import of files with this format must be implemented as well. The generation of documentation for classes and theirs methods is a standard even for tools available nowadays. From experience gained, usually tools with the paid license are better ones, but for ideal tool the idea of user improving it’s content and working on miscellaneous frameworks, plug-ins and add-ons is too tempting not to mention.

CHAPTER 6. DISCUSSION

57

Requirements for tools, oriented in software development are complicated and there are many of them. We can only but believe, that teams working on their development, are aware of them and one day will present us with such a tool.

6.2

Final comparison

Neither tool compared within this thesis meets all requirements derived from MDA’s definitions. One that is not fulfilled for any tool, is capability of defining own syntax for models. This functionality cannot be assured even by a combination of two different pieces of software. However if this condition is forgiven, satisfactory project development environment might be achieved. There are several points of view, from which can be looked at this issue. Analytic view would be concerning the model transformation(the more automated the better, but not on cost of the precision) and the platform independence. However developer’s requirements involve pleasantness of the environment(including run-time compilation, syntax highlighting, automatic completion of sentences) and simplicity. He does not care about platform independence or round-trip engineering. There are several platform independent tools enabling the source code editing, however the simplicity and the pleasantness is not involved in neither of them. This sub-window is usually too small to make any changes to the code without loosing an overview of the project. On the other hand IDEs are capable, with help of some frameworks or plug-ins, to reverse the source code into class diagrams. But none of them can make platform independent model, not even mentioning possibility of creation a sequence or an activity diagrams. However when one is developing a new system, focus on various features is required and not all of them are mandatory for the given project. For the better display of tool’s capabilities, tables comparing them, are constructed. Factors that are measured are derived from the functionality that an ideal tool is equipped with. It is necessary to evaluate the given factor of software by several stages. An explanation of what is meant by each one of them needs to be done as well. Complete is marking the feature that is fully satisfying needs of the given requirement. By evaluating tool with satisfactory mark, a

CHAPTER 6. DISCUSSION

58

Correctness Eclipse Visual Studio NetBeans Altova Umodel StarUML OpenAmeos VisualParadigm Enterprise Architect OptimalJ RationalRose Satisfactory Complete Satisfactory Complete Satisfactory Insufficient Complete Complete Complete Complete

Import/Export Satisfactory Satisfactory Satisfactory Complete Complete Satisfactory Complete Complete Complete Complete

License Satisfactory Insufficient Complete Insufficient Complete Complete Insufficient Insufficient None None

Horizontal Transformation None None None Insufficient None None Insufficient Insufficient ? ?

Table 6.1: Comparison of tools part one
Reverse Engineering Insufficient Insufficient Satisfactory Satisfactory Insufficient Insufficient Insufficient Satisfactory Satisfactory Satisfactory Code Generation Satisfactory Satisfactory Satisfactory Complete Satisfactory Satisfactory Complete Complete Satisfactory Satisfactory Runtime Roundtrip Satisfactory Complete Insufficient Satisfactory None None Satisfactory Complete ? ? Community Support Satisfactory Complete Complete Insufficient Insufficient Insufficient Satisfactory Satisfactory None Insufficient

Eclipse Visual Studio NetBeans Altova Umodel StarUML OpenAmeos VisualParadigm Enterprise Architect OptimalJ RationalRose

Table 6.2: Comparison of tools part two

CHAPTER 6. DISCUSSION
Flaw Extremely complicated Platform dependence Inability to work with latest Java Almost no support within community Correctness Methods not implemented Reverse engineering for too few diagrams Reverse engineering for one diagram only Contribution IDE with combination of modelling tool Flawless live model editing IDE with expanded modelling methods Reverse engineering for sequence diagrams Open source project Open source project Lucid and simple for use Templates for code generation

59

Eclipse Visual Studio NetBeans Altova Umodel StarUML OpenAmeos VisualParadigm Enterprise Architect

Table 6.3: Flaws and Contributions necessary functionality is achieved. Insufficient mark is used, when the given requirement is not met in satisfactory way. None marks that software has no support for this feature. Symbol ”?” is used when information was unable to obtain from a trustworthy source. Tables 6.1 and 6.2 compare analysed tools. Factor correctness evaluates methods for round trip engineering, model creation etc. It is necessary to mention, that the tool may not be marked with the best result in this way, due to the number of methods, that are implemented. Tool with the worse evaluation may be better that one with the better mark, simply cause there are some features that are not working correctly. Import/Export factor is based on tool being able to work with XMI, XML, PNG and JPG files. If import and export of both XML and XMI is present with possibility of generation PNG or JPG file, a complete mark is assigned. The license factor is valued by a complete mark, only if an open source of freeware tool is present. If not even evaluation keys are accessible for user, a none mark is assigned. The horizontal transformation is valued only by two marks. If tool supports at least templates for the code generation, tool is valued by insufficient, else by none. Reverse engineer values tools ability to create diagrams from the source

CHAPTER 6. DISCUSSION

60

code. A satisfactory mark is assigned only in a case, more than a class diagram can be created this way. The code generation is assigning marks based on ability of software to do so. If templates or comments can be used when doing so, the highest mark is assigned. Round trip factor reflect the tool’s support for the automated live editing source code or model, when the other one is edited. The community support reflects feedback, guides and forums dedicated to the given software. One more comparison is done according to the tool’s biggest flaw and on the other hand, the biggest contribution. Flaws that are mentioned, are those, which presence seems to be the worst issue when developing project. When listing the best features those that are not present for any other tool, are given preference even though some better may be present. This is done, because it highlights the originality of the given tool and contributes to better understanding and imagining an ideal tool. OptimalJ and Rational Rose are not listed due to the fact, that their functionality could not be tested. The comparison of analysed tools is displayed in Table 6.3.

Conclusion
The main aim of the thesis is to explore methods for maintaining the consistency between a source code and a model. The methodology chosen for the thesis is MDD. The motivation for this thesis comes from the work of Tom Mens, Ragnhild Van Der Straeten, and Jocelyn Simmonds [18]. It is the fact that at the time the work was written, there was no support from software tools in this matter. However, as we explored, consistency between the model and the source code may be nicely maintained with the use of tools available nowadays. We have demonstrated this possibility. However, during the analyses of these tools many other factors accompanying project development were identified. These factors and requirements are listed in evaluation that is summarized in tables. The set of the most important factors were pinpointed and grouped into requirements for an ideal tool. If any future work is desired, it’s aim may be implementation of such a tool.

61

Bibliography
[1] Altova. Altova, 2005. http://www.altova.com, accessed May 2012. [2] Uwe Aßmann, Mehmet Aksit, and Arend Rensink, editors. Model Driven Architecture, European MDA Workshops: Foundations and Applications, MDAFA 2003 and MDAFA 2004, Twente, The Netherlands, June 26-27, 2003 and Link¨ oping, Sweden, June 10-11, 2004, Revised Selected Papers, volume 3599 of Lecture Notes in Computer Science. Springer, 2005. [3] Paulo Barbosa, Franklin Ramalho, Jorge Figueiredo, Antonio Jnior, Aniko Costa, and Luis Gomes. Checking semantics equivalence of mda transformations in concurrent systems. 15(11):2196–2224, jun 2009. http://www.jucs.org/jucs_15_11/checking_semantics_ equivalence_of. [4] Microsoft Corporation. Microsoft Corporation, http://www.microsoft.com, accessed May 2012. [5] Oracle Corporation. The NetBeans http://forums.netbeans.org/, accessed May 2012. Forum, 1998.

1996.

[6] Oracle Corporation. The NetBeans IDE, 2001. http://netbeans.org, accessed May 2012. [7] Eclipse. Eclipse EMF Guide, 2005. http://help.eclipse.org/indigo, accessed May 2012. [8] The Eclipse Foundation. Eclipse, 2000. http://www.eclipse.org/, accessed May 2012. 62

BIBLIOGRAPHY

63

[9] IBM. Rational Rose, 1995. http://www01.ibm.com/software/awdtools/developer/rose/, accessed May 2012. [10] Visual Paradigm International. Visual Paradigm International, 2005. http://www.visual-paradigm.com, accessed May 2012. [11] K. Mens, editor. Automating Architectural Conformance Checking by Means of Logic Meta Programming. PhD thesis, Department of Computer Science, Vrije Universiteit Brussel,. Vrije Universiteit Brussel, 2000. [12] Inc. Object Management Group. Object Management Group, November 1997. http://www.omg.org, accessed May 2012. [13] OpenAmeos. OpenAmeos, 2009. http://www.openameos.org, accessed May 2012. [14] Inc. Sparx System. Enterprise Architect MDA Model Transformations, November 1999. http://www.theenterprisearchitect.eu/archive/2008/02/18/mda-andmodel-transformation, accessed May 2012. [15] Dataprojekt s.r.o. Czech Enterprise Architect, http://www.enterprise-architect.cz, accessed May 2012. 2005.

[16] StarUML. StarUML, 2005. http://staruml.sourceforge.net, accessed May 2012. [17] Sparx Systems. Sparx Systems Enterprise Architect, http://www.visual-paradigm.com, accessed May 2012. 1996.

[18] Ragnhild Van Der Straeten, Tom Mens, Jocelyn Simmonds, and Viviane Jonckers. Using Description Logic to Maintain Consistency between UML Models, volume 2863, pages 326–340. Springer, 2003. [19] Wikipedia. Wikipedia, 2000. http://en.wikipedia.org, accessed May 2012.

Appendix
• section App.1. - Source code • section App.2. - In electronic appendix, models and full screenshots • section App.3. - In electronic appendix, sequence diagram for method getEvent()

App.1
Board.java
package p r o j e c t ; import j a v a . u t i l . ∗ ; public i n t e r f a c e Board { // p o s t s m e s s a g e m public void p o s t ( Message m) ; // c a n c e l s t h e m e s s a g e m f r o m b o a r d public Message remove ( Message m) ; // c a n c e l s m e s s a g e s o l d e r public void removeOld ( ) ; than ttl

// r e t u r n s l i s t o f m e s s a g e s f o r p e r s o n p public L i s t g e t M e s s a g e s F o r ( P e r s o n p ) ; // a d d s p e r s o n p t o t h e l i s t public void a d d P e r s o n ( P e r s o n p ) ; // f i n d s p e r s o n w i t h name n , i f t h e r e i s no s u c h a p e r s o n , public P e r s o n findPersonByName ( S t r i n g n ) ; // d e l e t e s p e r s o n w i t h name n f r o m t h e l i s t public boolean removePersonByName ( S t r i n g n ) ; } message is send

Demo.java

64

BIBLIOGRAPHY

65

package p r o j e c t ; import import import import import import import import public java . java . java . java . java . java . java . java . class io . BufferedReader ; i o . IOException ; i o . InputStreamReader ; u t i l . ArrayList ; util . Collections ; u t i l . Date ; util . Iterator ; util . List ; Demo {

EventManager eventManager = new EventManager ( ) ; protected Board b o a r d = new MyBoard ( eventManager ) ;

public Demo ( ) { P e r s o n a l e s = new P e r s o n ( ” A l e s ” ) ; P e r s o n p a v e l = new P e r s o n ( ” P a v o l ” ) ; P e r s o n l i b o r = new P e r s o n ( ” L i b o r ” ) ; Event e v e n t = new Event ( ) ; board . addPerson ( a l e s ) ; board . addPerson ( p a v e l ) ; board . addPerson ( l i b o r ) ; Message m1 = new Message ( 2 0 0 0 ) ; m1 . setFrom ( a l e s ) ; m1 . s e t T o ( new P e r s o n [ ] { l i b o r , p a v o l } ) ; m1 . s e t T e x t ( ” Ahoj L i b o r o v i a P a v l o v i p o s i e l a b o a r d . p o s t (m1 ) ; Message m2 = new Message ( 3 0 0 0 ) ; m2 . setFrom ( p a v o l ) ; m2 . s e t T o ( new P e r s o n [ ] { a l e s } ) ; m2 . s e t T e x t ( ” Ahoj A l e s o v i p o s i e l a b o a r d . p o s t (m2 ) ;

Ales . ” ) ;

Pavol . ” ) ;

Message m3 = new Message ( 1 0 0 0 0 ) ; m3 . setFrom ( p a v o l ) ; m3 . s e t T o ( new P e r s o n [ ] { a l e s } ) ; m3 . s e t T e x t ( ” Ahoj A l e s o v i p o s i e l a znova P a v o l . ” ) ; b o a r d . p o s t (m3 ) ; Message m4 = new Message ( 1 0 0 0 0 ) ; m4 . setFrom ( p a v o l ) ; m4 . s e t T o ( new P e r s o n [ ] { a l e s } ) ; m4 . s e t T e x t ( ” Ahoj A l e s o v i znova p o s i e l a b o a r d . p o s t (m4 ) ; P e r s o n [ ] g u e s t s = new P e r s o n [ 1 0 ] ; guests [ 0 ] = pavol ; guests [ 1 ] = libor ; Date d a t e = new Date ( ) ; d a t e .UTC( 2 0 1 2 , 3 , 2 1 , 1 2 , 3 0 , 0 ) ; eventManager . addEvent ( a l e s . c r e a t e E v e n t ( ” G r i l o v a c k a ” , d a t e , b o a r d . remove (m3 ) ; } public void p r i n t M e s s a g e s F o r P e r s o n N a m e ( S t r i n g n ) { // G e n e r a t e d b y UModel . T h i s c o d e w i l l b e o v e r w r i t t e n when r e −r u n c o d e System . o u t . p r i n t l n ( ” M e s s a g e s f o r ”+n+” : ” ) ; P e r s o n p = b o a r d . findPersonByName ( n ) ; if ( p == n u l l ) { System . o u t . p r i n t l n ( ” U s e r : ”+n+” c o u l d n o t be f o u n d ! ” ) ; return ; guests ) ) ;

Pavol . ” ) ;

generation .

}

BIBLIOGRAPHY

66

for ( I t e r a t o r i = board . getMessagesFor ( p ) . i t e r a t o r ( ) ; Message m = ( Message ) i . n e x t ( ) ; System . o u t . p r i n t l n (m) ; }

i . hasNext ( ) ;

) {

} public void w a i t F o r E n t e r ( ) throws I O E x c e p t i o n { // G e n e r a t e d b y UModel . T h i s c o d e w i l l b e o v e r w r i t t e n when r e −r u n c o d e g e n e r a t i o n . B u f f e r e d R e a d e r b r = new B u f f e r e d R e a d e r ( new I n p u t S t r e a m R e a d e r ( System . i n ) ) ; br . r e a d L i n e ( ) ; br . r e a d L i n e ( ) ; } }

Event.java
package p r o j e c t ; import j a v a . u t i l . A r r a y L i s t ; import j a v a . u t i l . Date ; import j a v a . u t i l . L i s t ; public c l a s s Event { // e v e n t name protected S t r i n g name ; // d a t e when e v e n t i s h a p p e n i n g protected Date d a t e ; // i n v i t e d p p l protected P e r s o n [ ] a t t e n d a n t s ; // protected L i s t / ∗ g u e s t s = new A r r a y L i s t ( ) ∗/;

// s e t e v e n t name public void setName ( S t r i n g name ) { // TODO add i m p l e m e n t a t i o n } // r e t u r n e v e n t name public S t r i n g getName ( ) { return t h i s . name ; // TODO add i m p l e m e n t a t i o n and r e t u r n } // s e t d a t e o f t h e e v e n t public void s e t D a t e ( Date d a t e ) { // TODO add i m p l e m e n t a t i o n } // r e t u r n d a t e o f t h e e v e n t public Date g e t D a t e ( ) { return t h i s . d a t e ; // TODO add i m p l e m e n t a t i o n and r e t u r n } // C O n s t r u c t o r public Event ( S t r i n g name , Date d a t e , t h i s . name = name ; this . date = date ; this . attendants = attends ; // TODO add i m p l e m e n t a t i o n } // I n e e d one empty public Event ( ) { } constructor

statement

statement

Person [ ]

attends ){

// Method t h a t i s r e s p o n s i b l e f o r msg s e n d i n g . public void s e n d I n v i t a t i o n s ( ) { // TTL s e t t i n g s d o e s n o t m a t t e r a s e x p i r a t i o n Message msg = new Message ( 5 0 ) ;

date

is

set

later .

BIBLIOGRAPHY

67

msg . setFrom ( t h i s . a t t e n d a n t s [ a t t e n d a n t s . l e n g t h ] ) ; msg . s e t T o ( a t t e n d a n t s ) ; msg . s e t T e x t ( ” Toto j e pozvanka na e v e n t : ” + t h i s . getName ( ) ) ; msg . s e t E x p i r e s ( t h i s . d a t e ) ; } // s e t i n v i t e d p p l public void s e t A t t e n d a n t s ( P e r s o n a t t e n d a n t s ) { // TODO add i m p l e m e n t a t i o n } // r e t u r n i n v i t e d p p l public P e r s o n [ ] g e t A t t e n d a n t s ( ) { return t h i s . a t t e n d a n t s ; // TODO add i m p l e m e n t a t i o n and r e t u r n } }

statement

EventManager.java
package p r o j e c t ; import import import import java java java java . . . . util util util util . ArrayList ; . Date ; . Iterator ; .∗;

public c l a s s EventManager { protected L i s t e v e n t s = new A r r a y L i s t ( ) ; // R e t u r n e v e n t a c c o r d i n g t o i t s name public Event g e t E v e n t ( S t r i n g name ) { f o r ( I t e r a t o r i = t h i s . e v e n t s . i t e r a t o r ( ) ; i . hasNext ( ) ; ) { Event e v e n t = ( Event ) i . n e x t ( ) ; i f ( e v e n t . getName ( ) == name ) return e v e n t ; } return n u l l ; } // Adds e v e n t public void addEvent ( Event e v e n t ) { t h i s . e v e n t s . add ( e v e n t ) ; event . s e n d I n v i t a t i o n s ( ) ; } public EventManager ( ) { } }

Message.java
package p r o j e c t ; import j a v a . t e x t . DateFormat ; import j a v a . u t i l . Date ; import j a v a . u t i l . L o c a l e ; public c l a s s Message { // c r e a t e s msg w i t h t t l public Message ( long t t l ) { when = new Date ( ) ; e x p i r e s = new Date ( when . getTime ()+ t t l ) ; } public P e r s o n getFrom ( ) { return from ; }

BIBLIOGRAPHY

68

public void setFrom ( P e r s o n from ) { t h i s . from = from ; } public P e r s o n getTo ( i n t i n d e x ) { return t o [ i n d e x ] ; public void s e t T o ( i n t i n d e x , public P e r s o n [ ] }

Person to ){ this . to [ index ] = to ; }

getTo ( ) { return t o ; } to ){ this . to = to ; }

public void s e t T o ( P e r s o n [ ] public S t r i n g

g e t T e x t ( ) { return t e x t ; } t e x t ){ this . t e x t = t e x t ; }

public void s e t T e x t ( S t r i n g

public Date g e t E x p i r e s ( ) { return e x p i r e s ; } public void s e t E x p i r e s ( Date e x p i r e s ) { t h i s . e x p i r e s = e x p i r e s ; } public Date getWhen ( ) { return when ; } public void setWhen ( Date when ) { t h i s . when = when ; } public S t r i n g t o S t r i n g ( ) { return ” ’ ”+t e x t+” ’ from=”+from . getName ( ) +” c r e a t e d=”+g e t C z e c h S h o r t D a t e ( when)+” e x p i r e s=”+g e t C z e c h S h o r t D a t e ( e x p i r e s ) ; } protected s t a t i c S t r i n g g e t C z e c h S h o r t D a t e ( Date d ) { DateFormat d f = DateFormat . g e t T i m e I n s t a n c e ( DateFormat .MEDIUM, return d f . f o r m a t ( d ) ; } private private private private private } P e r s o n from ; Person [ ] to ; String text ; Date e x p i r e s ; Date when ;

L o c a l e .GERMAN) ;

MyBoard.java
package p r o j e c t ; /∗ G e n e r a t e d b y T o g e t h e r ∗/ import j a v a . u t i l . ∗ ; public c l a s s MyBoard implements Board { p r i v a t e L i s t m e s s a g e s = new A r r a y L i s t ( ) ; p r i v a t e Map p e o p l e = new HashMap ( ) ; protected L i s t e v e n t s = new A r r a y L i s t ( ) ; protected EventManager eventManager = new EventManager ( ) ; public Message remove ( Message m) { return m e s s a g e s . remove (m) ? m : n u l l ; } public MyBoard ( EventManager eventManager ) { t h i s . eventManager = eventManager ; } public List g e t M e s s a g e s ( ) { return m e s s a g e s ; } messages ){ this . messages = messages ; }

public void s e t M e s s a g e s ( L i s t public void p o s t ( Message m) { m e s s a g e s . add (m) ; }

BIBLIOGRAPHY

69

public void removeOld ( ) { Date now = new Date ( ) ; L i s t pom = new A r r a y L i s t ( ) ; f o r ( I t e r a t o r i = m e s s a g e s . i t e r a t o r ( ) ; i . hasNext ( ) ; Message m = ( Message ) i . n e x t ( ) ; i f ( now . compareTo (m. g e t E x p i r e s ( ) ) < 0 ) { pom . add (m) ; } } m e s s a g e s = pom ; } public L i s t g e t M e s s a g e s F o r ( P e r s o n p ) { L i s t pom = new A r r a y L i s t ( ) ; f o r ( I t e r a t o r i = m e s s a g e s . i t e r a t o r ( ) ; i . hasNext ( ) ; Message m = ( Message ) i . n e x t ( ) ; P e r s o n [ ] t o s = m. getTo ( ) ; int j = 0 ; while ( j < t o s . l e n g t h && t o s [ j ] != p ) j ++; i f ( j < t o s . l e n g t h && t o s [ j ] == p ) { pom . add (m) ; } } return pom ; } public P e r s o n findPersonByName ( S t r i n g n ) { return ( P e r s o n ) ( p e o p l e . g e t ( n ) ) ; } public Map g e t P e o p l e ( ) { return p e o p l e ; }

) {

) {

public void s e t P e o p l e (Map p e o p l e ) { t h i s . p e o p l e = p e o p l e ; } public void a d d P e r s o n ( P e r s o n p ) { p e o p l e . put ( p . getName ( ) , p ) ; } public boolean removePersonByName ( S t r i n g n ) { return p e o p l e . remove ( n ) != n u l l ; } public S e t g e t A l l P e o p l e N a m e s ( ) { return p e o p l e . k e y S e t ( ) ; } public void c r a e t e E v e n t ( Event e v e n t ) { // TODO add i m p l e m e n t a t i o n } public L i s t getEvents (){ // TODO add i m p l e m e n t a t i o n and r e t u r n return t h i s . e v e n t s ;

statement

} }

Person.java
package p r o j e c t ; import j a v a . u t i l . Date ; import j a v a . u t i l . L i s t ; public c l a s s P e r s o n { public P e r s o n ( S t r i n g name ) { t h i s . name = name ;

BIBLIOGRAPHY

70

} public P e r s o n ( ) { } public S t r i n g getName ( ) { return name ; } public void setName ( S t r i n g name ) { t h i s . name = name ; } p r i v a t e S t r i n g name ; public Event c r e a t e E v e n t ( S t r i n g eventName , Date d a t e , guests [ guests . length ] = this ; Event e v e n t = new Event ( eventName , d a t e , g u e s t s ) ; return e v e n t ; } } Person [ ] g u e s t s ){

Sponsor Documents


Recommended

No recommend documents

Or use your account on DocShare.tips

Hide

Forgot your password?

Or register your new account on DocShare.tips

Hide

Lost your password? Please enter your email address. You will receive a link to create a new password.

Back to log-in

Close