PowerPoint Presentation - Computer Science and Engineering

Document Sample
PowerPoint Presentation - Computer Science and Engineering Powered By Docstoc
					                                                                          Formalization of UML with Traceability                                                                                                                                                                       Department of
                                                                                                                                                                                                                                                                      Computer Science & Engineering
                                                                                                                Min Deng                                                                                                                                                       College of Engineering
                                                                                          Advisors: Dr. Betty H.C. Cheng & Dr. R.E. Kurt Stirewalt
                                                                                                                                                                                                                                                                                              Monday, May 10, 2004
                                                                                        Software Engineering and Network Systems (SENS) Laboratory
                                                                                                                                                Code Distribution in a UML-to-Promela Formalization
                                                                                                                                                                                                                                                                                proctype comp3(mtype state)
•The Unified Modeling Language (UML) is the de facto object-oriented                                                                                                          active proctype ex()                        proctype comp2(mtype state)
modeling language widely used in industry and academia.                                     comp1
                                                                                                                                                                              {                                           {
                                                                                                                                                                                                                                                                                int comp2_pid;
                                                                                                                                                                              mtype m;                                    int comp2_pid;
                                                                                                                                                                                                                                                                                int comp3_pid;
                                                                                                 comp2                                                                        bit dummy;                                  int comp3_pid;
                                                                                                                                                                                                                                                                                mtype msg;
•However, UML notations are not defined formally.                                                                                                                             int comp1_pid;                              mtype msg;
                                                                                                                                                                                                                                                                                int dummy;
                                                                                                         comp3                                                                /* link to environment */                   int dummy;
                                                                                                                                                                                                                                                                                /* Init state */
                                                                                                                                                                                 run Environment();                       /* Init state */
•Formalization is a process of giving formal semantics to UML notations                                                                                                       /*Init state*/                              init:
                                                                                                                                                                                                                                                                                  goto two;
by translating them into a target formal specification language (for                                             two
                                                                                                                                               e               f              initS: goto to_comp1;                         goto to_comp3;
                                                                                                                                                                                                                                                                                /* State one */
example, Promela).                                                                                                   g                               four          five       /* Link to composite state comp1 */         /* State four */
                                                                                                                                                                              to_comp1: comp1_pid = run comp1(m);         four: skip;
                                                                                                                                                                                wait??eval(comp1_pid),m;                    if
                                                                                                                                                                                                                                                                                  :: ex_q?e -> t?free; wait!_pid,st_four; goto exit
•Tool support for automatic code generation from UML diagrams                                                             h                           g                       exit: skip                                    :: ex_q?f -> t?free; wait!_pid,st_five; goto exit
                                                                                                                                                                                                                                                                                  :: ex_q?f -> t?free; wait!_pid,st_five; goto exit
                                                                                                                three            one
   Code here refers to specifications                                                                                                                                        }                                             fi;
                                                                                                                                                                                                                                                                                  :: ex_q?g -> t?free; wait!_pid,st_five; goto exit
                                                                                                                                                                                                                          /* Link to composite state comp3 */
   Enables automatic analysis of the UML diagrams                                                                                                                                                                        to_comp3: comp3_pid = run comp3(msg);
                                                                                                                                                                              proctype comp1(mtype state)                                                                       /* State two */
                                                                                                                                                                              {                                                                                                 two:
The Code Distribution Problem                                                                                                                                                 int comp2_pid;
                                                                                                                                                                              mtype msg;
                                                                                                                                                                                                                            :: msg == st_five -> wait!_pid,st_five; goto exit
                                                                                                                                                                                                                                                                                  :: ex_q?e -> t?free; wait!_pid,st_four; goto exit
                                                                                                             An Example UML State Diagram                                     int dummy;
                                                                                                                                                                                                                            :: msg == st_four -> goto four
                                                                                                                                                                                                                                                                                  :: ex_q?f -> t?free; wait!_pid,st_five; goto exit
                                                                                                                                                                              /* Init state */                                                                                    :: ex_q?g -> t?free; goto three
•The formalization of some UML features produces code that crosscuts            •Ovals represent states; arrows represent transitions                                         init:
                                                                                                                                                                                                                          exit: skip
the modular structure of the target language.                                   •Transitions are labeled by events                                                              goto to_comp2;                                                                                  /* State three */
                                                                                                                                                                              /* Link to composite state comp2 */                                                               three:
   one UML feature is mapped to many non-contiguous lines of target-           •Sample distributions                                                                         to_comp2: comp2_pid = run comp2(msg);                                                               if
   language code                                                                                                                                                                wait??eval(comp2_pid),msg;                                                                        :: ex_q?h -> t?free; goto one
   one line of target-language code is mapped from many UML                        Transition on event f is translated into 6 different places in Promela (in red)            if                                                                                                :: ex_q?e -> t?free; wait!_pid,st_four; goto exit
                                                                                                                                                                                :: msg == st_five -> goto five                                                                    :: ex_q?f -> t?free; wait!_pid,st_five; goto exit
   features                                                                         Transition on event e is translated into 4 difference places in Promela (in
                                                                                    blue)                                                                                       fi;
                                                                                                                                                                              /* State five */                                                                                  exit: skip
•Thus, it is not obvious how the UML features and target-language code              Composite state comp3 is translated into two blocks of code (in black                    five: skip;                                                                                       }
are related. As a result, it is difficult to understand and thus validate the       boxes), first of which leads an if-fi statement and second of which is a                  exit: skip
                                                                                    process declaration, in Promela                                                           }
correctness of the implementation of a formalization.
                                                                                                                                                                                                                        Produced Code in the Promela Language
•In addition, property specification and analysis of UML diagrams is
aggravated by this problem.

Providing Traceability for UML Formalizations
                                                                                       Data Flow Diagram of U-Banyan                                                                                                                      Future Directions
                                                                                       1. User draws a UML diagram so that the diagram objects are in memory                                 Graphical editors
•Enables understanding and validation of correctness of the                            2. User draws the same UML diagram in a given modeling and code                                       for UML diagrams                             •Automate property and instrumentation code generation for
                                                                                          generation framework to produce the target-language code                                                                                        analyzing UML diagrams
implementation of a formalization
                                                                                       3. The code is input to its parser so that the in-memory representation
   Visualize the code distribution problem                                                                                                                                            A given modeling and code
   Validate coarse-grained correctness such as employed                                  for the code is created                                                                         generation framework                            •Provide more advanced visualization capabilities
   communication protocols                                                             4. User inputs the UML diagram element to highlight, and a view object                                                                                Explore backward traceability
   Visualize fine-grained correctness such as semantics of individual                    is constructed, which connects the element with the target-language                                 Code generator
   UML features                                                                           objects implementing the element                                                                     for producing                              •Further explore the applicability of traceability in the analysis of
                                                                                       5. The code corresponding to target-language objects is highlighted in                                a formal language                            UML diagrams
•Aids in property specification, automatic property generation and                        the HTML representation
analysis of UML diagrams                                                                                                                                                                                                                  •Apply our framework to more UML formalizations

•Facilitates the impact analysis of different design decisions for a                                                                                                                                                                      References
formalization                                                                                                                                      Generator for          4                             Target-language
                                                                                                                                                   View objects
•Helps the interpretation of analysis results from supporting tools for
                                                                                                                                                                                                        code                              •William E. McUmber and Betty H.C. Cheng, “A general framework
target formal languages                                                                                         1                                                                                                                         for formalizing UML with formal languages”, Proceedings of 23rd
                                                                                                                                                Construction of                                                                           IEEE International Conference on Software Engineering, May 2001
                                                                                           Graphical editors                                   traceability links                               Parser for          3
Our Approach and Status                                                                    for UML diagrams                                   from view objects                              target-language                              •Betty H.C. Cheng, R.E.K. Stirewalt, Min Deng, and Laura Campbell,
                                                                                                                                             to target-language                                    code                                   "Enabling Validation of UML Formalizations", MSU-CSE-03-20, July,
                                                                                                                                                    objects                                                                               2003
   A framework to provide traceability between UML diagrams and
   target-language code using views                                                                                                                                                                                                       •The Unified Modeling Language Specification, http://www.uml.org
   A view is a relation between the elements in UML diagrams and
   elements in target-language code. Views keep references to                                                                                                                                                                             •Promela Language Reference,
   elements in UML diagrams and target-language code. Thus, we are                               UML diagram objects                               View objects                 Target-language objects                                   http://spinroot.com/spin/Man/promela.html
   able to trace forward and backward.
   Instantiated with forward traceability in our own UML-to-Promela
                                                                                                                                                                                                            5                             Acknowledgements
   formalization, and applied to validate the implementation of the
                                                                                                                                                                                     Generator for
   formalization and analyze UML state diagrams.
                                                                                                                                                                                  producing HTML file                                     This work has been funded in part by NSF grants EIA-0000433,
                                                                                                                                                                                                                                          CDA-9700732, and CCR-9901017, Department of the Navy, Office
                                                                                                                                          U-Banyan                                                                                        of Naval Research under Grant No. N00014-01-1-0744, and Eaton
                Why name our framework U-Banyan?                                                                                                                                                                                          Corporation, and in cooperation With Siemens Automotive and
                                                                                                                                                                                 HTML representation of                                   Detroit Diesel Corporation.
• U stands for UML
• Banyan is an East Indian fig tree. It can establish new roots from its                                                                                                         target-language code
branches, but you can always trace it back to the original tree. Sometimes
the branching can become quite complex, but there is always traceability

Shared By: