The Convergence of Modeling and Programming
Total Page:16
File Type:pdf, Size:1020Kb
The Convergence of Modeling and Programming: Facilitating the Representation of Attributes and Associations in the Umple Model-Oriented Programming Language by Andrew Forward PhD Thesis Presented to the Faculty of Graduate and Postdoctoral Studies in partial fulfillment of the requirements for the degree Doctor of Philosophy (Computer Science1) Ottawa-Carleton Institute for Computer Science School of Information Technology and Engineering University of Ottawa Ottawa, Ontario, K1N 6N5 Canada © Andrew Forward, 2010 1 The Ph.D. program in Computer Science is a joint program with Carleton University, administered by the Ottawa Carleton Institute for Computer Science Acknowledgements A very special, and well-deserved, thank you to the following: a) Dr. Timothy C. Lethbridge. Tim has been a mentor of mine for several years, first as one of my undergraduate professors, later as my Master’s supervisor. Tim has again helped to shape my approach to software engineering, research and academics during my journey as a PhD candidate. b) The Complexity Reduction in Software Engineering (CRUISE) group and in particular Omar Badreddin and Julie Filion. Our weekly meetings, work with IBM, and the collaboration with the development of Umple were of great help. c) My family and friends. Thank you and much love Ayana; your support during this endeavor was much appreciated despite the occasional teasing about me still being in school. To my mom (and editor) Jayne, my dad Bill, my sister Allison and her husband Dennis. And, to my friends Neil, Roy, Van, Rob, Pat, and Ernesto – your help will be forever recorded in my work. Finally a special note to Ryan Lowe, a fellow Software Engineer that helped to keep my work grounded during our lengthy discussion about software development – I will miss you greatly. d) Software professionals around the world. Sincere thanks to the individuals that participated in my research, published valuable references for my writing, as well as to those in the various news-groups about software engineering that I follow. Your knowledge and insight helped provide the necessary substance for my work. ii Abstract This thesis investigates approaches to model-driven development (MDD) in which developers can keep using their familiar textual programming languages, but with additional model- oriented concepts. The added concepts include associations and attributes as found in the Unified Modeling Language (UML), as well as concepts from software patterns and other common programming abstractions. By keeping text at the forefront of development, we maintain all of the advantages of text, without having to sacrifice the benefits of diagrams. By allowing a model to be equally expressed in either diagrammatic or textual form, we enable what we have termed text-diagram duality, a duality that benefits programmers and modelers alike. We explore why software developers in some situations prefer diagrams, but tend to revert to textual means to write and maintain software systems. To explore the capabilities of modeling in code, we developed a model-oriented programming language called Umple. At its core, Umple is a family of object-oriented languages enhanced with additional abstractions. Umple supports both platform-independent models (PIM), as well as platform specific models (PSM). Umple currently integrates with Java, PHP and Ruby; referred to as base languages throughout this thesis. Our research focuses on investigating the opportunities and obstacles we discovered in the course of implementing and using UML-like associations and attributes in Umple. It is our hypothesis that current features available in object-oriented languages can be enhanced with a more model-oriented approach, providing a textual form for modeling concepts that have been primarily available diagrammatically. By providing modeling abstractions in a programming language, the complexity and size of the resulting systems, we argue, is reduced and more developers, particularly those who are used to writing code, will be more eager to adopt modeling practices. At the same time, our approach maintains the benefits of diagrammatic approaches to software development, since Umple can be rendered and edited as a UML-like diagram. Our primary contributions to the field of computer science are as follows: First, we provide an empirical investigation on the nature of modeling practices. Second, we present the design, implementation and analysis of a model-oriented language, Umple. The language is presented as enhancements to existing programming languages including Java, PHP and Ruby. iii Table of Contents Chapter 1 Introduction.....................................................................................................................1 1.1 Research Questions ................................................................................................................2 1.2 Hypothesized Solutions ..........................................................................................................6 Chapter 2 Attitudes Towards Software Modeling – a Survey.........................................................8 2.1 Attitudes towards Modeling ...................................................................................................8 2.2 The Preliminary Study: Categorizing Software Applications ..............................................10 2.3 The Main Study: Modeling Survey ......................................................................................13 2.4 Demographics of the Modeling Survey................................................................................14 2.5 Modeling Survey Results .....................................................................................................15 2.5.1 What is a Software Model? ...........................................................................................16 2.5.2 Creating Versus Consuming Software Models .............................................................16 2.5.3 What Modeling Notations Do You Use?.......................................................................17 2.5.4 How Are You Using Your Modeling Tools? ................................................................18 2.5.5 How Good Are Your Modeling Tools?.........................................................................19 2.5.6 Important Attributes of a Software Model ....................................................................19 2.5.7 Which Approach, Code Versus Model Works Best? ....................................................21 2.5.8 Model-Centric Issues and Concerns..............................................................................22 2.5.9 Code-Centric Issues and Concerns................................................................................24 2.6 Threats to Validity................................................................................................................25 2.7 Contributions of the Modeling Survey .................................................................................26 Chapter 3 Umple: A Model Oriented Language ...........................................................................28 3.1 What Models and Modeling Languages Should Be .............................................................29 3.2 Motivations...........................................................................................................................34 3.2.1 Lack of Adoption of Modeling......................................................................................34 3.2.2 Reducing the Need to Program Boilerplate Code .........................................................35 3.3 Description of Umple ...........................................................................................................36 3.3.1 Simple............................................................................................................................36 iv 3.3.2 UML Programming Language ......................................................................................37 3.3.3 Ample ............................................................................................................................38 3.4 Motivating Examples............................................................................................................38 3.4.1 Course Registration .......................................................................................................38 3.4.2 Airline Reservation System...........................................................................................39 3.5 Overview of Umple Entities.................................................................................................41 3.5.1 Attributes .......................................................................................................................41 3.5.2 Associations...................................................................................................................42 3.5.3 Generalizations ..............................................................................................................43 3.5.4 Action Semantics Using Java-Like Methods ................................................................44 3.6 Umple Design and Tooling ..................................................................................................46 3.6.1 Umple’s IDE Tooling ....................................................................................................46 3.6.2 Modeling in the Browser ...............................................................................................47