• Aucun résultat trouvé

The Analysis of UML State Machine Formal Checking Methods

N/A
N/A
Protected

Academic year: 2022

Partager "The Analysis of UML State Machine Formal Checking Methods"

Copied!
6
0
0

Texte intégral

(1)

The Analysis of UML Checkitrg

State Machine Formal Methods

Gundars Alksnis

Dcpartrnerrt of Applied Cornputer Science, Riga Techrrical University, Mcza icla 1/3, Riga, LV-1048, Latvia

g a l k s n i s @ c s . r t u . l - v

Abstract. Thc purposc of this paper is to discuss currcnt trends of such UML statc mactrine model chccking rnethods, where model check- irrg is perforrrred by translation into formal notations. Formal methods have shown their advantages for functional requircments' inconsistency checking and their climirration at early stages of development and for cnrichirrg graphical notations to reveal vaguerress and inaccuracics as discussed in this paper.

Keywords: UML state rnachines, rnodel checking, forrnal notations and methods.

Introduction

The design of system models and their modeling is widely used practice at the early stages of software devclopment life cycle. Models provide better under- standing of proposed system and allow making correct decisions concerning the implcmentation. For such purposes, thc diagrams, which are bascd on some graphical notations, are uscd most common. To enablc communication bctween developers, model diagrams have particular (standardizcd) underlying graphi- cai nol,al,ions. Among srtch graphical notalions is Unified Modeling Language (UML) [1]. Additionally, thc model driven dcvelopment approach has becn put forward to cnable crcation, validation and transfer of syntactically and semanti- cally completc models, such that the source code generation can be automated and hidden from devclopers, thus, promoting modcls as thc main artifact of software development.

Howcvcr, currently availablc tools arc mostly immature in a sense, that gener- ated code rnust be ma,nually refined to irnplernent algorithms and systenr behav- ior conccived by the devcloper. The most essential barrier to implement model driven devclopment vision is incomplete syntax and semantics of such graphical tcchnologies, which can yield to inconsistent interpretations evcn at thc initial stagcs of system dcsign.

Eveu crtrrent UML 2.0 specification allows semanticallv incompletc model specifications for use in scena,rio "UML-As-Sketch", and trends show that this situation will remain such also in the future. This means, that UML models can

I

(2)

132 G. Alksnis

and will be designed both formally and informally. The only requiremcnt is that formal UML semantics must bc a subset of thc full UML semantics.

On the other hand, therc are tools, which provide automated code generation (usually only framework) directly from UML models, and vice versa. However, code gencratcd in this nanner, either rnust be nranually rcfined with algorithms that UML modeling tools cannot express cxplicitly or the generated code is not sufficientlv effective fbr production.

Ncverthcless, to rlrakc confidence about correctuess of clcsignccl rnoclel and gencrated codc (even partial), thcre must be done additional checks, which arc in higher abstraction lcvels than codc in high level programming languages.

Namely, model checking must be carricd out, to check whether particular model is semantically completc and self-consistent. Such chccks, for example, can be done with the help of formal mcthods. Wherewith, therc is a need for translation of gra,phical notations into some forrnal specification notation, which after.walds is analyzcd and executcd in the appropriate tools.

This is evcn more important for system's dynamic or behaui,oral mod,elq when developer needs assurance, that the model exprcsses proposed system's bchavior appropriatcly. For such cases, therc arc devclopcd methods and their supporting tools, thc brief survey and analysis of which is discussed in this paper.

The paper discusses currcnt trcnds of such UML state machine model check- ing mcthods, whcre modcls arc translated into formal notations. The compara- tive analysis of four such formal model checking methods is given. Finally, thc paper concludcs with thc outline of current possibilities for formal model chcck- ing of UML state machine models with the help of formal methods.

Motivation

Formal model checking has proved to have a number of benefits, which gives de- tailcd vicw about the systcm bcing implcmented at thc stages of systcm analysis and design. For example, modcl checking allows to:

o validate behavior at the initial stages of system's design;

o Reveal and eliminate functional requrements errors before implementation;

o Obtain (automatically generate) formally "executable" model specification (i.e. systcm's prototypc);

o Validate consisl,encv and complel,eness of model specificat,ion, and more.

To make model checking effect,ive and automated, model formal synt,ax and serna'trtics must be defined. Otherwise, rnodel carr be viewed only as a, sketch, and inconsistencies and contradictions must bc validated manually by using de- vcloper's knowledge.

Thc most important thing in modcl checking is that models allow systcm analysis at high abstraction levcls, where nondeterministic and parallel actions may take placc. Thus, cxecutable codc generation from the model and checking of such code may not always give expected results. Developer must not only

analyze cach modcl's node interconnections with other nodes, but also. and more

(3)

a o

O a

The Analysis of UML State Machine Formal Checking Methods I 33 importantly, look at thc model as a whole and evcn in conncction with other models, where thc same artifact is viewed from differcnt aspects or viewpoints.

It is especially important in modeling system's behavior. Even if the model reflects system's bchavior in tirne, usually it is shown in the fbrrn of static dia- gram. If such models arc '(cxccuted" before they arc transformed into code, it is possible l,o reveal some deficiencies, which may show up only in t,he mn-time, but not in thc compile-time.

The ncxt scction discusses in dctail the possibilities of chccking system's be- havior from UML state machines [2], which are based on David Harcl statecharts [3] and cxtended with objcct oriented propcrtics.

3 Comparative Analysis of Formal Model Checking Methods

As the subjcct for comparison and analysis, we chose four formal model checking methods (approachcs), which providc mcans of translating statc machine models into formal notations for actual model checking. The mcthods are the following:

Fernd,ndez-Toval rewrite logic ; Zhao graph transformation ; Knapp-Merz Hugo / RT tool;

Sekerinski-Ztrob abstract machine notation and B;

This decision is based solely on a variety of implementation forms. The only common thing among chosen methods is that they formalize UML state machine notation by transfbrming models into fbrmal specifications with which fbrmal modcl chccking is performcd. From the implementation viewpoint, thcsc methods are complctely independcnt from each other. There are many othcr methods available, but thc sclection for this rcsearch was bascd on the degree of involvcd formal mcthods and notations.

Jos6 Luis Fern6ndez Alem6n and Ambrosio 'foval Alvarez propose UML metamodel based method, which formalizes UML state machine diagrams in rewrite logic [ ]. To accomplis]r t]ris, they apply rewrite logic and the specifica- tion language Maudc.

Yu Zhao with colleagues [5] suggcst to perform transformation and chccking of models in Pctri nets. The motivation for selecting Petri nets formalism is that it allows comprchensive and automated modcl checking.

Alcxander Knapp and Stephan Merz propose model chccking approach bascd on rclations between different UML diagram types [6]. Namely, they take into account connections bctween UML state machine diagrams and UML intcraction (i.e., collaboration and scquence) diagrams. They have dcveloped lool Hugo/RT, which allows verifying if two models are consistent.

The la-st of the reviewed methods is proposed bv Emil Sekerinski and Rafik Zurob.In it, thc statechart diagrams are translated into Abstract Machine No- tation (AMN) of B method [7]. Although they are speaking about statecharts

(4)

134 G. Alksnis

Table 1. Summary of reviewcd UML state rnachine formal model checking methods

Method Fernandez-Toval Zhao Knapp-Merz Sekerinski-

Zurob Underlying

theory / tool

Rewrite logic / Maude

Graph transformations and

Petri nets

Hugo/RT AMN and B method /iState Has support

for static semantic

Yes Yes Yes Yes

Has support for dynamic semantic

N o Yes

Partly (by translating into

Java code)

Partly (by translating

into code) Model can

be executed

Only for checking of static semantics

In any tool which supports execution of Petri net models

Yes (for demonstration

ourooses onlv)

Yes (as final product

code) Uses UML

metamodel Yes Yes Yes Yes

Automatic output of

model errors

Panly (only for static

semantics)

Partly (must use Petri net

debugging)

Partly (only for static

semantic)

Partly (only for static

semantic) C a n

generate source code

N o N o

Yes (for demonstration

pumoses only)

Yes

in Harel's notation, but taking into account the origins of UML statc machine diagrarrts, ttreir method can be modified for application to UML state rnachines.

Summary of reviewed methods is givcn in Table 1. First column lists com- parative propcrties and thc rest of columns contain property values for each method. Chosen comparison characteristics are based on scmantics (both, static and dynamic) handling and analysis of model checking results.

Revicw of the mcthods revealcd, that thc main problem to handle, is the formalization level of UML state machine operational semantics (mathematical foundat,ion for inl,erpretation and execution sequence), which is not fully defined by UML designers. This mcans, that fbnnalization may be different f?orn one method to another and thus made incompatible, and lead to different interpre- tations, espccially in thc aspect of cxccution.

Possiblc solution to this problem could be thc translation of UML state ma- chines irrto hiera,rchical finite state autorna,ta,. However, it does not provide mea,ns for description of some esscntial UML state machine properties, for cxample, ac- tivitics, input and otttpttt actions, finishing evenl,s and transit,ions, historical and branching pseudostates, and adaptation of them arc not trivial.

All reviewed mcthods supports checking of static semantics-thcy can give answer to whcther modcl is complcte-with cntry, initial state, intermcdiate states and final state and exit, but cannot give answer whether it is logical.

Checking of dynamic semantics is allowcd in methods with executable formal specifications.

(5)

The Analysis of UML State Machine Formal Checking Methods

r35

The purpose of checking of dynamic semantics is to clarify, whether model clcments are well connected. This is accomplished by selection of appropriate formal notation,, as in Zhao's method, where formalization in Pctri nets and tool availability enables morc throughout model checking. Model exccution is cxplo- ratiort of rnodel state space. Becausc statc space can be infinite, rnodel execu- tion strategies (espccially for nondeterministic and concurrent states) dctermine whcther results will bc adcquatc.

However, all reviewed mcthods havc common characteristic. Namely, they all are bascd orr UML rnetarnodel, which cnables easer refineurents of the method, when UML state machine metamodel definition change. Additionally, metamodel inconsistencies and missing definitions must be corrected.

Howcver formal or automatcd model checking may be, inevitably, thcrc arc situations in which decisions must bc made by the model developer. Neverthe- less, his or hcr dccision may largely depend on information about current model and lurther refinement. Fbr such cases, the tool must output appropriate model checking results. All reviewed methods output inconsistencies of model static se- mantics, nonethclcss, model behavior correctncss and inconsistency elimination is solely on developers' compctcnce and intuition.

Finally, in the context of model driven development, comprehensivc codc gcneration from the modcl is essential step, which gives confidcncc that trans- fbrmation is perfbrrned wittr strict rules and that code indeed reflects developed modcl. Unfortunately, in revicwcd methods this step is still immaturc, if sup- portcd at all. The result is whether inefficient from run-time vicwpoint (Knapp- Merz's method) or define restrictions against model properties and programming languagcs (Sekerinski-Zurob's mcthod).

4 Conclusions

In this paper wc outlined selection of formal model checking methods, the main distinction of which is their usc of model translations into formal notations and fbrmal specification languages particularly, with the aim to utilize advantages of formal specifications in rccovery of inconsistencies and their eliminations.

The paper outlined main problcms developer must deal with when UML state machinc diagram model checking is performed.

The common conclusion is that there are many different methods available, but none of them covers all aspects of bchavioral model checking-cach has its own advantages and disadvantages. Howcvcr, the most notable shortcoming is that current UML specification is not fully formalized, which, in turn, makes method creators do their own formalization, which may differ from othcr for- malization approaches, though slightly.

This topic is also important in the context of model driven development, whcre models are supposed to be the main artifact of system's dcsign. In fact, the more elaborated tools developers will havc the more high-level abstraction chccks they will be able to perform, thc more precise models will be developed and generated code will be more effective.

(6)

136 G. Alksnis

This research was conducted as part of ongoing research for implementation of framework for Modcl Driven Architecture extension with formal methods [8].

In this UML metamodel based fiamework the fbrmal specification languages are used lbr Platlbrm Independent IVIodel transfbrmations and refinements into Piatforrn Specific Models.

The common conclusion is that the modcl checking still is mainly guided by thc developer, and for automatically generated code to be fully optimized for particular modcl, therc is the nccd for further rescarch. In addition, formal methods are subject to critique for their large learning curve and missing effective tool support; howevcr, formal methods applications has proved as advantageous in functional requirement inconsistency checking and their elimination at early stages of system's devclopment, and for cnriching graphical notations to revcal vagucness and inaccuracies, as was discussed in this paper.

Thi,s work has been partlg supported by the European Soci,al Fund w,ithi,n the Nati,onal Programme "Support for the carry'ing out doctoral studg program's and post-doctoral researches" project "Support for the deuelopment of doctoral studi,es at Ri,ga Techni,cal Un'iuers,itg".

References

1. OMG: Unified Modeli,ng Language. //Internet: http: I lwww.urnl.org/

2. Darr Pilone, Neil Pitman: UML 2.0 i,n u, Nutshell. A Desktop Quick Refere,nce.

O'Reilly Mcdia, Inc., USA, California, 2005.

3. David Harel: on visual Formal'isms. Communicatiorrs of thc ACM, volume 31, number 5, May 1988, pp. 514-b30. f flnternet:

http: / /doi.acm.org/ 10 .1145 I 4241I.42414

4. Jos6 Luis Fern6ndez, Ambrosio Toval: Can Intuition Become Rigorous? Founda- tions for UML Model Verification Tools. Proceedings of thc l1th International Symposium on Software Rcliability Enginccring (ISSRE 2000), IEEE Press, 2000, p p . 3 4 4 3 5 5 .

5. Yu Zhao et al.: Towards Formal Verification of UML D'iagrams Based on Graph Transfortnati,on. Proceedings of thc E-Commerce Technology For Dynamic E- Business Intcrnational Confcrence, Volurnc 00, IEEE Computer Socicty, Wash- i r r g t o n , D C , u s A , 2 0 0 4 , p p . 1 8 0 1 8 7 . f frnternct: http://dx.doi.org/10.1109/cEC- E A S T . 2 0 0 4 . 7 0

6. Alcxandcr Knapp, Stephan Merz: Model checki.ng and code generati,ort for \JML state rnachi'nes and collaborations. D. Hancberg, G. Schellhorn, and W. Reif, edi- tclrs, 5th Worl<shop on Tools for Systern Desigrr and Verification, Technical Report 2002-17,Institut fur Informatik, Universitat Augsburg, 2002, pp. bg- 64.

7. Errtil Sekerirrski, Rafik Zurob: Tfanslati,ng statecharts to B.M. J. Butler, L. Petrc, and K. Sere, editors, 3rd International Confercnce on Integrated Formal Methods (IFM), Lecturc Notes in cornputer science, springer-verlag, May 2002, pp. r28- 144.

8. Gurrdars Alksnis: Forrnal Methods and Model Transfo,rrrtation Framework for MDA. Proceedings of the 1st Intcrnational Workshop on Formal Models (WFM'06), Dusan Kolar arrd Alcxandcr Meduna (Eds.), Ostrava: MARQ, 2006, p p . 8 7 9 7 .

Références

Documents relatifs

The topics covered in this special issue are the following: Domain Specific Languages, Component-based Systems and Architectures, Learning Finite State Machines, Construction

In this work we present preliminary results of application of formal analysis, based on the so-called Hybrid Automata Stochastic Logic (HASL) statistical model checking, to a model

In this line, we have defined a structure-based heuristic function operating on processes described in the Calculus of Communicating Systems (CCS), which accounts for the structure

19th Annual Symposium on Theoretical Aspects of Computer Science Antibes - Juan les Pins, Helmut Alt; Afonso Ferreira, Mar 2002, Antibes - Juan les Pins,

Remark: The numbers in the states are the number of correct keys that have already been pressed... Automata

As soon as the idea to generate a Top500 like dynamical performance rank- ings regarding any available object model slice (problem, method or a group of methods, algorithm or a set

Section 2 introduces the simulation tools on which the approach is founded; Section 3 introduces the temporal logic language used for describing control rules; and Section

Various approaches have been proposed in supervised classification of data, among them approaches based on Formal Concept Analysis.. In this paper we present a new taxonomy