Unifying Abstractions and Code with Concern Maps
Total Page:16
File Type:pdf, Size:1020Kb
Unifying Abstractions and Code with Concern Maps by Patrick Cooney Bachelor of Arts (Journalism) QUT 1998 Graduate Diploma in Information Technology QUT 2001 Submitted to the School of Software Engineering and Data Communications in partial fulfilment of the requirements for the degree of Master of Information Technology at the QUEENSLAND UNIVERSITY OF TECHNOLOGY July 2006 © Patrick Cooney 2006 The author hereby grants to QUT permission to reproduce and to distribute copies of this thesis document in whole or in part. i Keywords Separation of Concerns and Feature Interaction, Software Engineering Tools and Environments, Software Evolution and Change Management, Software Architectures and Design. Statement of Original Authorship The work contained in this thesis has not been previously submitted for a degree or diploma at any other higher education institution. To the best of my knowledge and belief, the thesis contains no material previously published or written by another person except where due reference is made. Signature: Date: 6/8/2006 ii Unifying Abstractions and Code with Concern Maps by Patrick Cooney Abstract People trying to understand, develop and maintain software have faced greater challenges as the complexity of software systems has increased. These challenges include the difficulty of cleanly separating different intertwined parts of a system, or relating parts of the system spread across many modules. This makes it difficult to neatly identify an area of interest, which in turn makes it difficult to understand or edit that area. The ability to separate these areas of interest, called concerns, into their own modules has been shown to improve the situation. Several approaches have been developed to enable this separation: aspect-oriented programming allows program code to be divided into smaller modules that better match areas of interest; reverse engineering tools help programmers extract information from an existing system; requirements traceability tools track individual requirements through the development process. This thesis describes a technique that works in a wide variety of circumstances. This technique allows users to create simple diagrams that describe the concern and then annotate this diagram with query expressions which link the diagram to related development artefacts like source code or documents. This research has used the tool in a set of common scenarios and compared the results to those achieved using other approaches. iii List of Figures Figure 1 Simple Concern Map........................................................................................ 31 Figure 2 MVC Concern Map .......................................................................................... 34 Figure 3 Customer Order Entity Concern Map............................................................... 38 Figure 4 Populated Concern Map ................................................................................... 38 Figure 5 Artefact listing for Customer............................................................................ 40 Figure 6 Open Concern Map file .................................................................................... 41 Figure 7 Concern Map toolbox....................................................................................... 42 Figure 8 Results window ................................................................................................ 43 Figure 9 Collapsed Concept Node .................................................................................. 43 Figure 10 Partial Health Watcher class diagram............................................................. 53 Figure 11 Persistence concerns....................................................................................... 55 Figure 12 Core persistence concern................................................................................ 56 Figure 13 Mechanism Control & Variation concern ...................................................... 57 Figure 14 Transaction concern........................................................................................ 58 Figure 15 Persisting data concern................................................................................... 60 Figure 16 Data Collection Variation Point concern........................................................ 61 Figure 17 Order, product and customer concerns........................................................... 65 Figure 18 Observer Concern Map................................................................................... 71 Figure 19 UML Package diagram................................................................................... 74 Figure 20 UML Deployment diagram ............................................................................ 75 Figure 21 Models and Implementation Concern Map .................................................... 76 Figure 22 Layers Concern Map ...................................................................................... 77 Figure 23 Hierarchy of artefacts ..................................................................................... 80 Figure 24 Core Cost Algorithm Concern........................................................................ 82 Figure 25 Discounts concern .......................................................................................... 84 Figure 26 Equality and Addition Concerns .................................................................... 87 iv List of Tables Table 1 Separation of concerns scenarios......................................................................... 5 Table 2 Examples scenarios.............................................................................................. 6 Table 3 Areas of crosscutting ......................................................................................... 11 Table 4 Shortcut Selector types ...................................................................................... 37 Table 5 Major components ............................................................................................. 45 Table 6 Summary of Concern Maps............................................................................... 54 Table 7 Selectors for persistence Concern Map ............................................................. 55 Table 8 Selectors for core persistence Concern Map ..................................................... 56 Table 9 Selectors for mechanism control & variation Concern Map ............................. 57 Table 10 Selectors for transaction Concern Map ........................................................... 59 Table 11 Selectors for persisting data Concern Map...................................................... 60 Table 12 Selectors for data collection variation Concern Map ...................................... 61 Table 13 Selectors for order, product and customer Concern Map................................ 67 Table 14 Selectors for observer Concern Map ............................................................... 72 Table 15 Selectors for models and implementation Concern Map................................. 76 Table 16 Selectors for layers Concern Map ................................................................... 77 Table 17 Selectors for cost algorithm Concern Map...................................................... 83 Table 18 Selectors for discounts Concern Map.............................................................. 84 Table 19 Selectors for equality and addition Concern Map ........................................... 88 v Contents Chapter 1. Overview of Thesis and Research................................................................... 1 1.1. Problem Definition............................................................................................1 1.2. Overview of the Project .................................................................................... 3 1.2.1. Aims of the Research................................................................................ 3 1.2.2. Methodology............................................................................................. 5 1.2.3. Summary of findings................................................................................. 7 1.3. Overview of Chapters ....................................................................................... 7 Chapter 2. Related Research............................................................................................. 9 2.1. Introduction to Related Research...................................................................... 9 2.2. Separation of Concerns................................................................................... 11 2.3. Crosscutting in Source Code........................................................................... 12 2.3.1. Code tangling and scattering................................................................... 12 2.3.2. Design Patterns ....................................................................................... 13 2.3.3. Code and Tests........................................................................................ 14 2.4. Crosscutting Concerns beyond Source Code.................................................. 14 2.4.1. A Broader Perspective ............................................................................ 14 2.4.2. Software Design...................................................................................... 15 2.4.3. System Requirements.............................................................................