[ieee 2009 second international conference on computer and electrical engineering - dubai, uae...

3
A New Mathematical Approach for Synthsis of State Based Models from Scenario Based Models Yahya Ghanbarzadeh Bonab Department of Computer Engineering Islamic Azad University of Ajabshir Branch Ajabshir, Iran [email protected] Ayaz Isazadeh Department of Computer Science University of Tabriz Tabriz, Iran [email protected] Abstract — Model Driven Development and Use Case Driven Development methodologies have inspired the proposal of a variety of software engineering approaches that synthesize state based models from scenario-based models. Solving the problem of synthesis for open reactive systems is an inherently difficult problem. In various settings the problem is undecidable, and even in more restricted settings when it becomes decidable, the time and space requirements of the synthesis algorithm may be too large to be practical for large systems. This research presents a new approach to define algorithms of synthesis technique. This approach is based on an ordered sequence of stage for executing the scenarios. It is important to consider the executing stages of a scenario as a sequence. This gives a lot of information about execution of a scenario. Many synthesis approaches address the running stages of a scenario as a single stage. The mathematical foundation presented for this ordered sequence is based on RUN in Live Sequence Chart method presented by Harel. We believe that our mathematical foundation would significantly reduce the complexity of synthesis technique. We show that our approach have some advantages over those of others’; in particular, our mathematical basis to define algorithms for constructing synthesis technique is very efficient. Keywords – Scenario, State machines, Synthesis, MSC, UML I. INTRODUCTION Scenario-based and state-based modeling techniques provide two different views of reactive systems. Scenarios are well known to help requirements engineers elicit functional requirements, as well as comprehend and validate requirements. Therefore, requirements engineers may find that scenario-based models are more natural to use and easier to communicate to other stakeholders such as customers. On the other hand, code can be automatically generated from state-based models and, therefore, software designers may find state-based models closer to design and implementation. The two views are not independent but strongly connected. In fact, scenarios (or use cases) can be used to drive the whole life cycle of software development processes [1]. In other words, scenarios are not only for the requirement phase, but also for the design and implementation phases. The strong connection indicates that transformation bridging the gap between these two views should be possible. Such a transformation would significantly increase the effectiveness of the overall software development process. II. BACKGROUNG CONTEXT AND MOTIVATION Harel and others describe a powerful synthesis technique [2]. They present important theoretical discussions in software engineering field. But these discussions are often complicated. The paper presenting Harel’s synthesis technique, as pointed out by Plock [3], describes how the construction would be carried out theoretically, but does not provide full details. It is also in the same work that satisfiablity of LSC requirements is shown to be equivalent to consistency [3], [4]. Message sequence charts (MSCs) [5] are a popular means for specifying scenarios that capture the communication between processes or objects, they are particularly useful in the early stages of system development, MSCs have found their way into many methodologies, and are also a part of the UML [6] where they are called sequence diagrams. Damm and Harel [4] then go on to define live sequence charts (LSCs), as a rather rich extension of MSCs. Figure 1. Priority of executing scenario As described in [4], LSC model is the most suitable resource model in synthesis technique for the following reasons: LSC model describes various types of running priority such as universal existential, repeatable, forbidden, 2009 Second International Conference on Computer and Electrical Engineering 978-0-7695-3925-6/09 $26.00 © 2009 IEEE DOI 10.1109/ICCEE.2009.64 384 2009 Second International Conference on Computer and Electrical Engineering 978-0-7695-3925-6/09 $26.00 © 2009 IEEE DOI 10.1109/ICCEE.2009.64 382

Upload: ayaz

Post on 10-Mar-2017

213 views

Category:

Documents


1 download

TRANSCRIPT

Page 1: [IEEE 2009 Second International Conference on Computer and Electrical Engineering - Dubai, UAE (2009.12.28-2009.12.30)] 2009 Second International Conference on Computer and Electrical

A New Mathematical Approach for Synthsis of State Based Models from Scenario Based Models

Yahya Ghanbarzadeh Bonab Department of Computer Engineering

Islamic Azad University of Ajabshir Branch Ajabshir, Iran

[email protected]

Ayaz Isazadeh Department of Computer Science

University of Tabriz Tabriz, Iran

[email protected]

Abstract — Model Driven Development and Use Case Driven Development methodologies have inspired the proposal of a variety of software engineering approaches that synthesize state based models from scenario-based models. Solving the problem of synthesis for open reactive systems is an inherently difficult problem. In various settings the problem is undecidable, and even in more restricted settings when it becomes decidable, the time and space requirements of the synthesis algorithm may be too large to be practical for large systems. This research presents a new approach to define algorithms of synthesis technique. This approach is based on an ordered sequence of stage for executing the scenarios. It is important to consider the executing stages of a scenario as a sequence. This gives a lot of information about execution of a scenario. Many synthesis approaches address the running stages of a scenario as a single stage. The mathematical foundation presented for this ordered sequence is based on RUN in Live Sequence Chart method presented by Harel. We believe that our mathematical foundation would significantly reduce the complexity of synthesis technique. We show that our approach have some advantages over those of others’; in particular, our mathematical basis to define algorithms for constructing synthesis technique is very efficient.

Keywords – Scenario, State machines, Synthesis, MSC, UML

I. INTRODUCTION Scenario-based and state-based modeling techniques

provide two different views of reactive systems. Scenarios are well known to help requirements engineers elicit functional requirements, as well as comprehend and validate requirements. Therefore, requirements engineers may find that scenario-based models are more natural to use and easier to communicate to other stakeholders such as customers. On the other hand, code can be automatically generated from state-based models and, therefore, software designers may find state-based models closer to design and implementation. The two views are not independent but strongly connected. In fact, scenarios (or use cases) can be used to drive the whole life cycle of software development processes [1]. In other words, scenarios are not only for the requirement phase, but also for the design and implementation phases. The strong connection indicates that transformation bridging

the gap between these two views should be possible. Such a transformation would significantly increase the effectiveness of the overall software development process.

II. BACKGROUNG CONTEXT AND MOTIVATION Harel and others describe a powerful synthesis

technique [2]. They present important theoretical discussions in software engineering field. But these discussions are often complicated. The paper presenting Harel’s synthesis technique, as pointed out by Plock [3], describes how the construction would be carried out theoretically, but does not provide full details.

It is also in the same work that satisfiablity of LSC requirements is shown to be equivalent to consistency [3], [4].

Message sequence charts (MSCs) [5] are a popular means for specifying scenarios that capture the communication between processes or objects, they are particularly useful in the early stages of system development, MSCs have found their way into many methodologies, and are also a part of the UML [6] where they are called sequence diagrams.

Damm and Harel [4] then go on to define live sequence charts (LSCs), as a rather rich extension of MSCs.

Figure 1. Priority of executing scenario

As described in [4], LSC model is the most suitable resource model in synthesis technique for the following reasons: LSC model describes various types of running priority such as universal existential, repeatable, forbidden,

2009 Second International Conference on Computer and Electrical Engineering

978-0-7695-3925-6/09 $26.00 © 2009 IEEE

DOI 10.1109/ICCEE.2009.64

384

2009 Second International Conference on Computer and Electrical Engineering

978-0-7695-3925-6/09 $26.00 © 2009 IEEE

DOI 10.1109/ICCEE.2009.64

382

Page 2: [IEEE 2009 Second International Conference on Computer and Electrical Engineering - Dubai, UAE (2009.12.28-2009.12.30)] 2009 Second International Conference on Computer and Electrical

non-definite scenarios, operations running conditions, and operations timing.

Figure 1 illustrates various types of scenario running priorities. The LSC is a powerful language and retain the simplicity and intuitive feel. Non-technical stakeholders specify various scenarios by interacting with the GUI and demonstrating the required behavior in Play-Engine tool.

As described in [2], if LSC is a consistent specification, where the universal charts in M are charts {m1, m2 … mt}, let A be the satisfying GSA derived using the algorithm for deciding consistency (Algorithm 1). A was obtained by intersecting the automata A1, A2 … At that accept the RUNs of charts m1, m2 … mt, respectively, and then performing additional transformations that do not change the number of states in A. The states of automaton Ai correspond to the cuts through chart mi.

A. Problem and Solution Characteristics Solving the problem of synthesis for open reactive

systems is an inherently difficult problem. In various settings the problem is undecidable, and even in more restricted settings when it is becomes decidable, the time and space requirements of the synthesis algorithm may be too large to be practical for large systems.

In this paper the algorithms constituted a synthesis technique defined based on RUN definition in LSC model [4]. Run semantics is very flexible and analyzable, thus development of state based model based on run definition is easier, also by expansion of RUN semantics, advanced relations between various scenarios could be arrived in run definition, then an algorithm to synthesize scenarios in state based model proposed. In this paper we apply this solution on Harel approach.

B. Synthesizing Optimal Object State Model in Harel Approach A disadvantage of Harel’s approach is that the

synthesized state model is very large for two reasons: the first is that according to the set s in DFA definition [2], the set of scenario cuts is considered as a set of state scenarios. On the other hand, according to the definition, in a scenario each cut show the set of object states existed in the scenario at a specific time. Thus in Harel method state machine produced for each scenario includes the set of all objects existed in a scenario. Therefore this machine does not have possibility of optimization. The second is that according to set σ in DFA definition [2], the state machine produced for each scenario includes transitions that all actions separated from their event. In other words, in this machine any transition found as "action/event" and transitions decomposed in two separated transitions, "event/" and "/actions", hence number of message and following number of machine states increased. According to [2] executing time for a synthesis technique calculated based on resultant state space, therefore in Harel Method timing complexity is very high. Another disadvantage in Harel Method is that LSC model includes new constructions such as Hot/Cold

condition, Hot/Cold chart etc, that this method could not synthesize these constructions to state based models.

III. THE NEW APPROACH One of the best advantages of the method proposed in this paper is that the definition of synthesis technique algorithms is based on RUN definition in LSC model. Each RUN is an ordered sequence of CUTs in a scenario and showed the execution of the scenario. On the other hand, ordered sequence (l0, l1 … ln) is a RUN of Scenario, where li = <object, location>, succ (ci, li, ci+1) [2]. Since each RUN is an ordered sequence of cuts, it analyzed easily. With analyzing of sequential cuts, the event triggers some actions detected and it is possible to construct a complete transition (i.e. event/actions). Also as RUN is an executing of a scenario, it is possible to analyze with behavioral viewpoint. In this approach, first, the consistency of RUNs in LSC model is checked. Then, for each object used in the scenario an optimal state machine is generated. Finally this state machine composed together to reach an overall state machine for each object. Thus an OSM (object state machine) model is found for the system. A. Consistensy of LSC Model

The algorithm used for checking consistency illustrated in [2] as following:

Step1. Universal state machine production: This step carried out in LSC model after state machine production for each object.

Step2. Invalid states deletion: Invalid final states converted to valid final state via considering activation messages that had not sent from them. If R be a set of all runs in LSC model, then ∀ rx, ry ∈ R and ∀c2k∈ prechart (rx): R = R ∪ (c2k, Msg (ry) (l0), c2) ∋ c2∈ cuts (ry)

For example as shown in Figure 2, if the system be in run ry, c2 state and event σ1 triggered, then run rx via (c'2, σ1, c2) transition is executable.

Figure 2. Invalid states to valid state

Step 3. Invalid transitions deletion: Invalid transitions could be deletion via conversion of non-finite states to finite states. Thus Run = (c0, c1, c2 … cn) = (l0, l1, l2 … ln) ∋ li = < Ox, lx > if ∃ i ∈{0, 2 …n-1} ∋ Msg (m) (li) ∈ Ain

C0

C2

C4

L0L1

L2L3

C'0

C'2

L'0L'1

L'2L'3

C'4

σ1

σ2

σ'1

σ'2

σ1

σ1

… …

rx ry

385383

Page 3: [IEEE 2009 Second International Conference on Computer and Electrical Engineering - Dubai, UAE (2009.12.28-2009.12.30)] 2009 Second International Conference on Computer and Electrical

Therefor, run divided as follows: Run 1 = (c0, c1 … ci) = (l0, l1, l2 …li-1) Run 2 = (ci, ci+1 … cn) = (li, li+1 … ln)

Step4. Universal control in order to sure acceptance for existential charts: Assume set {m1, m2 … mt} be universal charts in LSC model:

If mod (m) = existential ⇒ ∀ run∈ Run (m): Msg (m) (l0) ∩ (∪message (mi))

B. Generating FSM for Existing Object in Scenario In our approach the message arrived to life line of object

considered as a event and message sent from life line as an action for state, then message sending for each object could be done in two type, after message receiving from an object or when the scenario reaches to idle state, thus we have four transition as following:

a) Transition in which message receiving and then sending carried out. b) Transition in which message receiving only carried out. c) Transition in which message sending carried out after idle state. d) Transition in which after idle state any message sending carried out. In forth transition any action carried out, thus in our method, we have transition types a, b, c described a bow.

Definition 1: Assume set (l0, l1 … ln) is a RUN of a scenario,

Li = < Ox, lx >, O (Li) = Ox and Succ (ci, Li, ci+1). A finite state machine for object O, exist in m universal chart is an ordered multiple as:

FSM (m, O) = < Q (m, O), qidle, δ(m, o) > ∋

AND Q (m, O (ln)) = Q (m, O (ln)) ∪ {c0}

Set Q(m, O) involve all states, in which each object O sends message from, or transited to them after receiving an event. Also set δ(m, o) calculated as: A) ∀ k: O (l2k) = O (l2k+2) = … = O (l2k+2x) = o and

0 ≤ 2k+2x ≤ n

If O (l2k-1) = o then (C2k-2, l2k-2 / l2k … l2k+2x, C2k+2x+2) ∈δ (m, o)

Else (C2k, / l2k … l2k+2x, C2k+2x+2) ∈δ (m, o) C2k-2 ∉Q (m, o) → C2k-2 = idle C2k+2x+2 ∉Q (m, o) → C2k+2x+2 = idle

B) ∀ k: O (l2k+1) = O (l2k+3) = … = O (l2k+2x+1) = o and

0 ≤ 2k + 2x+1 ≤ n If O (l2y+2) ≠ o then

(qidle, l2y /, c2y+2) ∈ δ (m, o) ∋ y = k… (c2y, l2y /, c2y+2) ∈ δ (m, o) ∋ y = k + 1 … k + x

C) (s0, f (AMsg (m)) /, c0) ∈ δ (m, o)

If an active message arrived in a scenario from

environment, this message assignment s0 state, State s0 doesn't belong to cuts of LSC model and doesn't show state of an object. Thus (s0, f (Amsg (m)) /, c0) ∈ δ(m, o)

Theory: for every object o in universal chart m of LSC model, FSM (m, o) is equal to given RUN according to definition 1.

Demonstration: first the machines FSM (m, Oi) composed together, forming a global state machines FSM (m) = < Q (m), qidle, δ(m)> generated for chart m, where Q (m) = ∪ Q (m, Oi) and δ (m) = ∩ δ(m, Oi). Then illustrated FSM (m) is equal to RUN. This demonstration illustrate in [2].

C. Generating Global Object State Machine forExisting Object in LSC Model After a state machine produced for each objects in

scenario, this state machine composed separately to reach a global state machine for each object. This composition carried out easily by adapting idle, final and starts state.

IV. CONCLUSION In Harel method the state machine produced for each

scenario includes the set of all objects in the scenario. Therefore this machine doesn't have the possibility of optimization. But in our approach, for each object in a scenario, a separate state machine is generated.

In Harel method the state machine produced for each scenario includes transitions that all actions separated from their event. But in our work all transitions include event and their actions.

In Harel method, first GSA model generated in order to check consistency of LSC, but in our approach, consistency control is carried out on RUNs of LSC. Thus GSA model is not necessary to produce. Therefore synthesis stages in our method are less than Harel Method.

REFERENCES [1] I. Jacobson and P. Ng. Aspect-Oriented Software Development with

Use Cases. Addison Wesley Professional, 1st edition, Dec 2004. [2] D. Harel and H. Kugler, “Synthesizing state-based object systems

from LSC specifications,” In Proceedings of 5th International Conference on Implementation and Application of Automata (CIAA '00), pp. 1-33, London, UK, Springer-Verlag, , 2001.

[3] C. Plock. Synthesizing Executable Program Requirements. Department of Computer Science, New York University, May 2008.

[4] W. Damm and D. Harel, “LSCs: Breathing life into message sequence charts,” Formal Methods in System Design, vol. 19, no. 1, pp. 45–80, 2001.

[5] ITU-TS. Recommendation Z.120: Message Sequence Chart (MSC), 2000.

[6] Documentation of the Unified Modeling Language (UML), available from the Object Management Group (OMG), http: //www.omg.org.

386384