ebook img

Andrew Forward's PhD Thesis on Attributes and Associations in PDF

224 Pages·2010·3.8 MB·English
Save to my drive
Quick download
Download
Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.

Preview Andrew Forward's PhD Thesis on Attributes and Associations in

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 3.7 Defining the Umple Language.............................................................................................50 3.7.1 Grammar Notation.........................................................................................................50 3.7.2 Umple Metamodel.........................................................................................................54 3.8 Alternative Approaches and Representations to Modeling..................................................58 3.8.1 Eclipse Modeling Framework.......................................................................................58 3.8.2 Executable UML (xUML or xtUML)............................................................................64 3.8.3 Specification Description Language (SDL)..................................................................66 3.8.4 Xtext..............................................................................................................................68 3.8.5 Microsoft’s SQL Server Modeling CTP (formely Oslo)...............................................69 3.8.6 USE - A UML-based Specification Environment.........................................................70 3.8.7 Slime UML....................................................................................................................71 3.8.8 PlantUML......................................................................................................................72 3.8.9 Embedding Models in Source Code..............................................................................72 3.8.10 Active Record..............................................................................................................73 3.8.11 Data Mapper Pattern....................................................................................................76 v 3.8.12 Aspect-Oriented Programming....................................................................................78 3.9 Summary...............................................................................................................................81 Chapter 4 Syntax and Semantics of Attributes..............................................................................82 4.1 UML Attributes....................................................................................................................82 4.2 Related Work........................................................................................................................83 4.3 Attributes In Practice............................................................................................................85 4.3.1 Method...........................................................................................................................86 4.3.2 Categorizing Variables (Attributes, Associations, Internals)........................................87 4.3.3 Results After Filtering Out Associations and Internals.................................................90 4.3.4 Analysis and Observations............................................................................................92 4.3.5 Umple Syntax for Attributes.........................................................................................93 4.3.6 Is the Attribute Specified in the Constructor (Q1)?.......................................................93 4.3.7 Can the Attribute Change After Construction (Q2)?.....................................................94 4.3.8 What Other Characteristics Does the Attribute Possess (Q3)?.....................................95 4.4 Existing Tools that Generate Code for Attributes................................................................98 4.4.1 ArgoUML......................................................................................................................99 4.4.2 StarUML........................................................................................................................99 4.4.3 Bouml............................................................................................................................99 4.4.4 Green Code Generator...................................................................................................99 4.4.5 Rational Software Architect (RSA) and RSA Real-Time...........................................100 4.4.6 Eclipse Modeling Framework (EMF).........................................................................100 4.5 Generating Code for Attributes using Umple.....................................................................104 4.5.1 Basic Attributes...........................................................................................................104 4.5.2 Immutable Attributes...................................................................................................105 4.5.3 Defaulted Attributes....................................................................................................106 4.5.4 Unique Attribute..........................................................................................................106 4.5.5 Autounique Attributes.................................................................................................109 4.5.6 Constant Class Attributes............................................................................................110 vi 4.6 Attributes with Multiplicity of Upper Bound Greater Than 1............................................110 4.7 Summary.............................................................................................................................111 Chapter 5 Syntax and Semantics of Textual Associations..........................................................112 5.1 Related Work......................................................................................................................113 5.2 Associations In Practice.....................................................................................................116 5.3 Associations in UML Diagrams.........................................................................................117 5.4 Analyzing All Possible Multiplicity Combinations...........................................................120 5.4.1 Bidirectional Associations Between Two Different Classes.......................................121 5.4.2 Unidirectional (Directed) Associations.......................................................................122 5.4.3 Reflexivity and Symmetry...........................................................................................123 5.5 Implications for Code Generation......................................................................................124 5.6 Existing Code Generators...................................................................................................125 5.6.1 Code Generation Patterns............................................................................................125 5.6.2 ArgoUML....................................................................................................................125 5.6.3 StarUML......................................................................................................................126 5.6.4 Bouml..........................................................................................................................126 5.6.5 Green Code Generator.................................................................................................127 5.6.6 Rational Software Architect (RSA) and RSA Real-Time...........................................128 5.6.7 Eclipse Modeling Framework (EMF).........................................................................129 5.7 Generating Association Code using Umple.......................................................................131 5.7.1 Defining Association Variables...................................................................................132 5.7.2 Association Ends as Constructor Parameters..............................................................132 5.7.3 Get Method Code Generation Patterns........................................................................135 5.7.4 Set Method Code Generation Patterns........................................................................136 5.7.5 Code Generation Patterns for Support Methods..........................................................138 5.8 Summary.............................................................................................................................138 Chapter 6 Modeling Software Patterns........................................................................................140 6.1 Singleton.............................................................................................................................140 vii 6.2 Equality, Immutability and Keys........................................................................................140 6.2.1 The Umple ‘key’ Keyword to Support Equals and Hashing.......................................143 6.2.2 Keys on Attributes and Associations...........................................................................145 6.3 Pre/Post Conditions and Operations...................................................................................145 6.3.1 Injecting Custom Behaviour using before and after Keywords..................................146 6.3.2 Injecting Custom Behaviour using Mix-ins................................................................149 6.4 Summary................................................................................................................................150 Chapter 7 Quality and Validity of the Research..........................................................................151 7.1 Building Umple using a Test Driven Design (TDD) Strategy...........................................152 7.1.1 Testing Infrastructure..................................................................................................153 7.1.2 Testing the Umple Parser............................................................................................154 7.1.3 Testing the Metamodel Classes...................................................................................155 7.1.4 Testing Code Generators.............................................................................................156 7.1.5 Testing Generated Systems.........................................................................................160 7.1.6 Managing Defects and Minimizing Regressions.........................................................161 7.1.7 Enhancing the Umple Language.................................................................................164 7.1.8 Validating Umple through Testing..............................................................................166 7.2 Improving Program Comprehension with Umple..............................................................167 7.2.1 Reducing Complexity and Improving Readability......................................................167 7.2.2 Analyzing Systems Written in Umple.........................................................................172 7.2.3 Analyzing LOC of Umple (Java Versus Generated Java)...........................................177 7.2.4 Comparing LOC of Systems Written in Umple..........................................................179 7.3 Industrial Examples of Umple............................................................................................182 7.3.1 Umple as a Modeling Language..................................................................................183 7.3.2 Private Lender Business Domain................................................................................183 7.3.3 Schedule Management Web Application....................................................................187 7.3.4 Distance Learning Progress Reporting Tool...............................................................188 7.3.5 Frequency of Multiplicity Usage in Commercial Umple Systems..............................192 viii Chapter 8 Conclusions.................................................................................................................194 Glossary.......................................................................................................................................199 ix List of Tables Table 1: Sub-Sample Sizes............................................................................................................15 Table 2: Responses for Question 12: How good are modeling tools at ...?...................................19 Table 3: Responses for Question 13: Important Attributes of a Modeling Tool?.........................20 Table 4: Responses for Question 14: Model versus Code-Centric Tasks.....................................21 Table 5: Responses for Question 15: Problems with a model-centric approach...........................23 Table 6: Responses for Question 16: Problems with a code-centric approach.............................24 Table 7. UML to SDL mapping rules [1]......................................................................................67 Table 8: Association Notation for Active Record Implementation in RoR..................................74 Table 9: Active Record API when dealing a multiplicity end of 1 (or 0..1).................................74 Table 10: Active Record API when dealing a multiplicity end > 1 (e.g. *)..................................75 Table 11. Categorizing member variables.....................................................................................86 Table 12. Distribution of static (class) variables...........................................................................87 Table 13. Analyzing variables for presence in the constructor and get/set methods....................88 Table 14. Distribution of instance variable types..........................................................................89 Table 15. Entity versus complex object type criteria hints...........................................................89 Table 16. Distribution of attribute types........................................................................................90 Table 17. Attribute Constructor and Access Method Patterns......................................................90 Table 18. Distribution of attribute properties based on type of setters and getters.......................91 Table 19. Distribution of attribute set and get method implementations......................................92 Table 20. UML code generation tools...........................................................................................98 Table 21. Additional UML tools not considered for our case study.............................................98 Table 22. Distribution of set/get methods and availability in constructor..................................117 Table 23: Usage of Association Multiplicities in UML..............................................................118 Table 24: Example Usage of Association Multiplicities in the Book by Lethbridge [2]............118 Table 25: Usage of Association Multiplicities from Model Repository [3]................................119 Table 26: Summary of Usage of Association Multiplicities.......................................................119 Table 27. Multiplicity Possibilities for Associations (Shorthand in Parentheses)......................121 x

Description:
Unified Modeling Language (UML), as well as concepts from software code, we developed a model-oriented programming language called Umple. enhancements to existing programming languages including Java, PHP and .. 4.4.4 Green Code Generator.. .99.
See more

The list of books you might like

Most books are stored in the elastic cloud where traffic is expensive. For this reason, we have a limit on daily download.