Towards C# Application Development Using UML State Machines – a Case Study

Towards C# Application Development Using UML State Machines – a Case Study

Towards C# Application Development using UML State Machines – a Case Study Anna Derezi ńska, Marian Szczykulski Institute of Computer Science, Warsaw University of Technology [email protected] Abstract – Using a state machine for modeling a class behavior A social network deals with a set of mobile users with time can assist effective development of an application. We discuss and space dynamic relationships. Social networking services a model-driven approach to building a C# application based on support different context-aware features. Internet Protocol UML class models and behavioral state machines. A case study Multimedia Subsystem (IMS) is an environment that provides a addressed in the paper is devoted to a social network of mobile developer with multimedia services based on the Internet users. The core of the system is a presence server for the status services in the network. There are three main tasks performed by protocol. The environment was used for the implementation of the server: subscription of a status of another user, publication of presence services presented in [11]. The specification was a new status with given rules and notification another user about tested using an emulator of IMS. In this work, we propose a status. The system architecture and exemplary state machine another solution using UML class and state machine diagrams models are presented. Model to code transformation and [12]. Further they were transformed to a C# code and executed development of an executable application was realized by using a Framework for eXecutable UML (FXU) [6]. a Framework for eXecutable UML (FXU). Verification of the In the next section, we present the background of application was supported by tracing of program execution in transformation of UML state machines to a C# code. The terms of model elements using FXU Tracer. On the basis of the system considered in the case study and its modeling is gathered experience, we discuss design guidelines for carrying out the approach. introduced in Section III. Section IV discusses technology of application development and design guidelines. Finally, Keywords: MDA, UML, state machine, C#, model transformation, Section V concludes the paper. code generation II. STATE MACHINE TRANSFORMATION TO C# CODE I. INTRODUCTION Providing with modeling facilities, CASE tools also support Human comprehension of graphical models can be more a model to code transformation, which can assist building a effective and less error-prone than a direct code analysis. final application reflecting principles behind the model. Therefore Model Driven Engineering (MDE) technology However, as far as UML is concerned, a transformation is promotes application development based on a model to code mostly restricted to a structural model, namely a class diagram transformation [1]. A leading proposal for MDE is the initiative as, for example, in Rational Modeling Extension for .NET [7]. of Model Driven Architecture (MDA) [2,3] that encourages Some tools also support the code transformation from different ideas and tools around the UML notation. behavioral diagrams, especially state machines. They usually There are various strategies to cope with models and their consider only a subset of state machine elements, whereas such execution. A model can be directly executed according to its advanced concepts as orthogonal regions, deep and shallow virtual machine as, for example, one given in the Foundation history pseudostates, deferred events or internal transitions are Subset for Executable UML Models (FUML) [4]. Another omitted. strategy is transformation of a source model into a target code. An exception is the IBM Rational Rhapsody tool [8] It can be completed in several steps. In the first step, a target (previously Telelogic and I-Logic) that takes into account the level can be an intermediate model level. For instance, a level entire state machine during transformations aimed at different between UML models and a programming language is used in programming languages, although it does not support C#. order to simplify transformation to a desired programming The Framework for Executable UML (FXU), introduced in language [5]. Transformation can also be defined as a direct [6], performs transformation from UML class and state translation of a model to a code given in a general purpose machine models into a corresponding C# code. It supports programming language, e.g. Java. C++, C# [6-10]. This paper creation and execution of the resulting application that is addresses the later approach. intended to reflect the modeled behavior. Complex problems can be modeled with behavioral state The framework, in the opposite to the most of similar tools, machines. It is beneficial to support the development process implements a complete specification of state machines, with a tool capable to transform advance state machine features including all kinds of states, such as simple states, composite and to build a reliable application. We discuss this problem in a states, orthogonal states, entry-, do- and exit - activities, and case study. submachine states. It also takes into account all possible http://www.springerlink.com/content/r472xnl5317t10w1/ The original publication is available at www.springerlink.com pseudostates, i.e. initial psudostate, deep and shallow history, observer, can request a subscription of the status of user X. join, fork, junction, choice, entry and exit points, terminate, as Therefore the observer communicates with the Presence Server well as different kinds of events (also deferred events). sending an appropriate message. The presence server In FXU several variation points of the UML state machine communicates with the SIP server fetching a current status of specification [13] had to be resolved in order to obtain an user X. The presence server also connects to the XCAP server unambiguous interpretation of a model behavior [14]. (XML Configuration Access Protocol ) where rules defining In order to improve the usability of the framework a new a resulting status drawn on a current state and a relation FXU version was released. It was equipped with GUI, between a user and his/her observer are gathered. Therefore the Application Wizard and FXU Tracer assisting comprehension observer can be notified about the real status of user X. of an application behavior in terms of state machine In the case study, we focused on Presence Server that elements [15]. constitutes the main part of the system and is responsible for In some solutions, the code created as the target of a model completing of the business logic. A presence server should transformation includes a mapping of the state machine realize the following main tasks: structure as well as of the logic supporting a model execution - Status creation – creation of a predefined presence status [16]. Recently, Sparx Enterprise Architect [9] was extended that controls an access to presence information. with code generator from a state diagram to various - Status publication – making known selected information programming languages, including C#. Also in this case, a to users subscribed in a contact list, according to rules of subset of state machine concepts is transformed into predefined a formerly predefined status. code extracts that are placed directly into a considered class. In - Status subscription – requesting information about a case of many state machines the amount of generated code can presence state of an observed user. be significant, aggravating evolution and maintenance of - Delete subscription – deletion of a presence status. A a program. user is no more registered in the service because do not The approach implemented in FXU is different. The entire want to be informed about changes of statuses of other logic of state machines is hidden in the library code (runtime users from the contact list. environment) and for each class is only generated a simple B. System model code defining a structure of its state machine and its The system was divided into three main layers devoted to: initialization. - communication with a client, III. P RESENCE SERVER MODELLING - controlling of presence statuses, - communication with other systems. This section describes the basic idea of the system used in Each layer is modeled by a package comprising its classes the case study ( A) and its modeling with UML structural and and other subpackages, if necessary. A rough class diagram of behavioral diagrams (B). Presence Server is shown in Fig. 1. A. System overview Package clientConnector consists of four classes and is The system under consideration was devoted to a status responsible for receiving client requests. It performs service for a social network. A user status is understood as a preliminary preprocessing of requests and forwards them to information about a current user’s presence and its context. A further handling by package presenceAgentController . context is defined by a location, communication possibilities, This package is the core of the system. Its classes fulfill the occupation of a user, its activities, mood, etc. There are basic functional requirements of the presence server. The different relationships between users. The relations can be package uses adapters, stored in package systemAdapters , for divided into various categories, like family, friends, coworkers, communication with other systems. Each adapter is created in acquaintances of a common hobby. a separate subpackage. There are three following adapters: an A user description is specified according to a format FOAF adapter for the server SIP, the server XCAP and the server (Friend of a Friend ). This specification is based on the XML FOAF. Finally, package utils comprises auxiliary classes used syntax and the RDF structure ( Resource Description by the system. Framework ) – a standard used for defining data in the net. For each class of the model a state machine was created that A presence service, which is offered in a social network specifies a behavior of the class. A state machine complexity provides users with a required data about a status of a given, varies from a simple two-state model to a more complex state selected user.

View Full Text

Details

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

Download

Channel Download Status
Express Download Enable

Copyright

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

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

Support

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