Rendering UML Class Diagrams to Support Layout Design
Total Page:16
File Type:pdf, Size:1020Kb
Rendering UML Class Diagrams to Support Layout Design A thesis submitted to the Kent State University Honors College in partial fulfillment of the requirements for University Honors by Paul “P.J.” Leyden December, 2019 Thesis written by Paul “P.J.” Leyden Approved by _______________________________________________________________________, Advisor _____________________________________________, Chair, Department of Computer Science Accepted by ___________________________________________________________, Dean, Honors College ii TABLE OF CONTENTS LIST OF FIGURES ........................................................................................................... iv LIST OF TABLES .............................................................................................................. v Acknowledgements ............................................................................................................ vi CHAPTER 1 Introduction................................................................................................... 1 CHAPTER 2 Related Work ................................................................................................ 4 2.1 UML .......................................................................................................................... 4 2.2 Comprehension and Layout ...................................................................................... 5 2.3 Automatically Reverse Engineering UML Class Diagrams ..................................... 7 2.4 srcUML ..................................................................................................................... 8 CHAPTER 3 srcML Infrastructure ..................................................................................... 9 3.1 srcML ........................................................................................................................ 9 3.2 SAX and srcSAX .................................................................................................... 11 3.3 srcSAXEventDispatcher ......................................................................................... 12 CHAPTER 4 The Development of srcUML ..................................................................... 13 4.1 Previous srcUML .................................................................................................... 13 4.2 Generating Graphviz ............................................................................................... 15 iii CHAPTER 5 Automatic Rendering of UML Class Diagrams ......................................... 19 5.1 Architecture............................................................................................................. 19 5.2 Implemented Output Types ..................................................................................... 20 5.3 Extending srcUML to Support User Defined Layouts ........................................... 23 5.4 Implemented Layout Algorithms ............................................................................ 24 5.5 Explanation of a Layout Algorithm ........................................................................ 29 CHAPTER 6 Conclusions and Future Work .................................................................... 35 Appendix A ....................................................................................................................... 37 Appendix B ....................................................................................................................... 39 References ......................................................................................................................... 40 iv LIST OF FIGURES Figure 1 - Diagram showing the flow of execution in order to generate a UML class diagram. .............................................................................................................................. 3 Figure 2 - Example program for demonstrating srcUML functionality. .......................... 10 Figure 3 - yUML representation of Figure 1 Modified for spacing purposes. ................. 14 Figure 4 - UML diagram generated by yUML.me ........................................................... 15 Figure 5 - DOT representation of the car manufacturer program. Modified for space purposes. ........................................................................................................................... 17 Figure 6 - Diagram generated from the DOT output. ....................................................... 18 Figure 7 - Example of overridden constructor for example DGML outputter. ................ 21 Figure 8 - Example beginning of the output function for the DGML outputter example. 22 Figure 9 - Enumeration addition example. ....................................................................... 22 Figure 10 - if-else statement addition example. ................................................................ 22 Figure 11 - switch statement addition example. ............................................................... 23 Figure 12 - Example usage of a newly added format. ...................................................... 23 Figure 13 – Sugiyama layout produced by srcUML. ........................................................ 26 Figure 14 - Example of a new algorithm implementation in the standard style. .............. 26 Figure 15 - A three clustered layout generated by srcUML. ............................................ 28 Figure 16 - svg_three_outputter's cluster determination implementation. ....................... 31 Figure 17 - svg_three_outputter formal creation of OGDF clusters. ................................ 32 Figure 18 - svg_three_outputters OGDF layout and print call. ........................................ 33 Figure 19 - Full example of the svg_three_outputter resultant UML diagram. ................ 34 v LIST OF TABLES Table 1 - Show the objects that are created and populated by the initialization functions provided by srcUML. ........................................................................................................ 30 vi Acknowledgements First, I would like to thank my thesis advisor, Professor Jonathan Maletic. He has had to put up with my antics for three long years and, despite that, he has given me many opportunities to improve and grow as both a computer scientist and a person. I would also like to thank Professor Michael Decker of Bowling Green State University for guiding me along in my research, answering my onslaught of questions, encouraging me to keep going and being a friend. I would of course like to thank those on my defense committee, Professor Mikhail Nesterenko, Professor Alexander Seed and Professor Robin Selinger, for taking the time out of their busy schedules to hear out my defense. Also, I would like to thank Drew Guarnera for always being friendly and open to whatever random questions I could think up and throw at him. I would also like to thank the Honors Thesis Advisor from the Honors College, Lori Michael, for always having time to meet when I had questions or doubts. Lastly, I would like to thank my friends and especially my family for always having my back and being there for when insanity seemed like a definite option. vii 1 CHAPTER 1 Introduction The process of creating and maintaining software systems is a difficult task and only growing more so as new Application Program Interfaces (APIs), frameworks, and technologies are released. The total pool of all technologies is growing rapidly and developers are less likely to know every piece of tech. With companies wanting to stay on the leading edge of what is new in tech, developers are expected to be capable of learning these new systems quickly. Within this context, studies [1, 2] have shown that Unified Modeling Language (UML) diagrams can be extremely useful. The Unified Modeling Language (UML) aims to provide system architects, software engineers, and software developers with a way to analyze, visualize, design, and maintain software-based systems [1]. The language standard itself is a specification on how to draw different diagrams that lend themselves to software organization and flow. One diagram in particular, the UML class diagram, is used to illustrate classes, interfaces, and their associations in a static object model [2]. In other words, it presents a simplified, yet no less informative, visual graphic, mapping out a software system. In the software development process, specifically the Agile Process, there is a stage in which the development team is supposed to update and create new design documents and diagrams. This is good for the initial build, however, over time as developers leave and new ones come in, design documents can be easily forgotten, leaving them misleading and 2 obsolete. This is why UML diagrams are used less often in the maintenance and evolution [4] of software, as keeping UML diagrams current can be a tedious task. One can manually reverse engineer the UML diagram in order to help themselves understand the code, but this as well can be tedious. In order to solve this problem, Decker et al. [3] created srcUML to automatically reverse engineer accurate UML diagrams for just such situations. srcUML currently outputs a text-based diagram in the yUML [4] format. yUML.me is a web service that takes this yUML formatted diagram and produces a visual representation. This presents three issues. First is that the layout of the diagram is dependent on yUML.me. Second is that one must use this online service