Code Generation from the Statechart Based on XMI

XMI 기반 상태도의 소스코드 자동생성 엔진 구현

  • 임좌상 (상명대학교 디지털미디어학부) ;
  • 김진만 (상명대학교 일반대학원 컴퓨터과학과)
  • Received : 2011.05.09
  • Accepted : 2011.09.05
  • Published : 2011.12.31

Abstract

Despite some practical confusion over the variations in the diagram which may be drawn differently depending upon the CASE, the statechart of UML has been widely used to show the dynamic behaviour of the systems. Prior research has employed either simple switch-case statement or the state design pattern to generate source code from the statechart, which may result in varying source codes. This paper made an attempt to formally define the statechart and generate source codes from it. Firstly we cleaned up the XMI which was generated from different CASEs. This XMI has been translated to the EHA to identify automata contained in it. Then the elements of the statechart metamodel were mapped to the java programs. We also verified the quality of source codes by measuring functionality and maintainability. The case employed in this study was the air conditioner. The reason was that the case includes various states and transitions of interest. It was found that XMI was well extracted by removing some legacy codes in the CASE and the source codes were then successfully generated with the concurrency and hierarchy of the statechart. Further research is required to validate it practical significance with a larger case.

UML의 상태도는 CASE 도구마다 다르게 표현될 수 있어서 실제 적용에 어려움이 많지만, 시스템이 동작하는 측면을 효과적으로 나타낼 수 있다는 점에서 활용성이 높다. 상태도에서 소스를 생성하는 선행 연구를 보면, 단순한 분기문 또는 설계패턴 등을 적용하고 있지만 그 기술에 따라 생성된 소스코드에 차이가 있을 수 있다. 본 논문에서는 상태도를 문법형식에 맞게 엄격히 정의해서 소스코드를 생성하였다. 우선 서로 다른 CASE도구에서 작성된 상태도에서 추출된 XMI를 정제하였다. 여기서 EHA로 변환을 한 후 상태를 인식하였다. 그리고 상태도의 메타모델에 사용된 요소별로 자바 프로그래밍으로 전환하여 소스코드를 생성하고 기능성과 유지보수성을 측정하여 생성된 코드를 검증하였다. 본 논문에서 적용된 사례는 '에어컨'으로서, 다양한 상태와 전이가 포함되어 소스코드 생성에 적합하여 선정하였다. 그 결과 에어컨 사례의 상태도로부터 CASE 독립적인 XMI를 추출하여 정련한 후, 상태도에서의 동시성과 계층이 성공적으로 표현되었음을 확인했다. 향후 좀 더 큰 규모의 시스템에 적용하여 검증하는 연구가 필요하다.

Keywords

References

  1. Czarnecki, K. and U. Eisenecker, 'Generative Programming: Methods, Tools, and Applications', Addison-Wesley, 2000.
  2. Zhang, H., S. Jarzabek, and S. Soe Myat, 'XVCL approach to separating concerns in product family assets', Erfurt, Germany: Springer-Verlag, 2001.
  3. Cleaveland, J.C., 'Program Generators with XML and Java', Prentice Hall, 2001.
  4. Ray, W.J. and A. Farrar, 'Object Model Driven Code Generation for the Enterprise, in Rapid System Prototyping', IEEE International Workshop. 2001.
  5. Ali, J. and J. Tanaka, 'Implementing the dynamic behavior represented as multiple state diagrams and activity diagrams', ACIS Int. J Comp. Inf. Sci., VOL.2(1), pp.24-36, 2001.
  6. Niaz, I.A. and J. Tanaka, 'CODE GENERATION FROM UML STATECHARTS', The 7th IASTED International Conference on Intelligent Systems and Control (SEA2003), 2003.
  7. Pinter, G. and I. Majzik, 'AUTOMATIC CODE GENERATION BASED ON FORMALLY ANALYZED UML STATECHART MODELS', Formal Methods for Railway Operation and Control Systems, 2003.
  8. Pinter, G. and I. Majzik, 'PROGRAM CODE GENERATION BASED ON UML STATECHART MODELS', Periodica Polytechnica Electrical Engineering, VOL. 47, NO. 3-4, pp.187-204, 2003.
  9. Niaz, I.A. and J. Tanaka, 'MAPPING UML STATECHARTS TO JAVA CODE', IASTED International Conf. on Software Engineering (SE2004), 2004.
  10. Blech, J.O., S. Glesner, and J. Leitner, 'Formal Verification of Java Code Generation from UML Models', the 3rd International Fujaba Days 2005, 2005.
  11. Niaz, I.A. and J. Tanaka, 'An Object-Oriented Approach To Generate Java Code From UML Statecharts', Computer & Information Science, VOL. 6, NO. 2, 2005.
  12. Douglass, B.P. and D. Harel, 'Real-Time UML: Developing Efficient Objects for Embedded Systems', Addison Wesley Longman, 1998.
  13. Telelogic Inc., Rhapsody, http://modeling.telelogic.com/
  14. Sengupta, S., A. Kanjilal, and S. Bhattacharya, 'Automated Translation of behavioral models using OCL and XML', TENCON 2005 IEEE Region 10, pp.1-6, 2005.
  15. Sturm, T., J.v. Voss, and M. Boger, 'Generating Code from UML with Velocity Templates', the 5th International Conference on The Unified Modeling Language, Springer-Verlag, 2002.
  16. Mikk, E., Y. Lakhnechi, and M. Siegel. 'Hierarchical automata as model for statecharts', In R. Shyamasundar and K. Euda, editors, Third Asian Computing Science Conference. Advances in Computing Sience ASIAN' 97, volume 1345 of Lecture Notes in Computer Science, SpringerVerlag, pp.181-196, 1997.
  17. Bokhari, A. and S. Poehlman, 'Formalization of UML State-Charts: Approaches for Handling Composite States', Department of Computing & Software, McMaster University, Technical Report CAS, 2005
  18. Chow, T. S., 'Testing Software Design Modeled by Finite-State Machines', Software Engineering IEEE, pp.178-187, 1978
  19. Coleman, D., D. Ash, B. Lowther, and P. Oman, 'Using metrics to evaluate software system maintainability', IEEE COMPUTER, pp.44-49, 1994