Each design pattern is designed to facilitate one kind of change, i.e. changes in one dimension. However, software evolution can happen in multiple dimensions.

Slides:



Advertisements
Similar presentations
Ch:8 Design Concepts S.W Design should have following quality attribute: Functionality Usability Reliability Performance Supportability (extensibility,
Advertisements

Object-oriented Software Change Dynamic Impact Analysis Lulu Huang and Yeong-Tae Song Dept. of Computer and Information Sciences Towson University Towson,
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
ASTA Aspect Software Testing Assistant Juha Gustafsson, Juha Taina, Jukka Viljamaa University of Helsinki.
Observer Method 1. References Gamma Erich, Helm Richard, “Design Patterns: Elements of Reusable Object- Oriented Software” 2.
Chapter 10 THINKING IN OBJECTS 1 Object Oriented programming Instructor: Dr. Essam H. Houssein.
Intro to OOP with Java, C. Thomas Wu Inheritance and Polymorphism
Classes and Object- Oriented... tMyn1 Classes and Object-Oriented Programming The essence of object-oriented programming is that you write programs in.
Object-Oriented Analysis and Design
INTERPRETER Main Topics What is an Interpreter. Why should we learn about them.
Road Map Introduction to object oriented programming. Classes
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
University of British Columbia Software Practices Lab CAS Seminar 06 Fluid AJ - A Simple Fluid AOP Tool Terry Hon Gregor Kiczales.
1 Introduction to CS Agenda Syllabus Schedule Lecture: the management of complexity.
Unit 031 Interfaces What is an Interface? Interface Declaration Syntax Implementing Interfaces Using Interfaces as Types Interfaces and Inheritance Interfaces.
Abstract Classes and Interfaces
Generative Programming. Generic vs Generative Generic Programming focuses on representing families of domain concepts Generic Programming focuses on representing.
C++ Functions. 2 Agenda What is a function? What is a function? Types of C++ functions: Types of C++ functions: Standard functions Standard functions.
Object Oriented Software Development
Practical Object-Oriented Design with UML 2e Slide 1/1 ©The McGraw-Hill Companies, 2004 PRACTICAL OBJECT-ORIENTED DESIGN WITH UML 2e Chapter 2: Modelling.
C++ Object Oriented 1. Class and Object The main purpose of C++ programming is to add object orientation to the C programming language and classes are.
REFACTORING Lecture 4. Definition Refactoring is a process of changing the internal structure of the program, not affecting its external behavior and.
Design Patterns OOD. Course topics Design Principles UML –Class Diagrams –Sequence Diagrams Design Patterns C#,.NET (all the course examples) Design Principles.
1 N Degrees of Separation: Multi-Dimensional Separation of Concern (MDSOC) HyperJ: language and concepts of general concern combination.
Introduction to Aspect Oriented Programming Presented By: Kotaiah Choudary. Ravipati M.Tech IInd Year. School of Info. Tech.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Grammar Variation in Compiler Design Carl Wu. Three topics Syntax Grammar vs. AST Component(?)-based grammar Aspect-oriented grammar.
Composing Adaptive Software Authors Philip K. McKinley, Seyed Masoud Sadjadi, Eric P. Kasten, Betty H.C. Cheng Presented by Ana Rodriguez June 21, 2006.
CSCI-383 Object-Oriented Programming & Design Lecture 13.
CS200 Algorithms and Data StructuresColorado State University Part 4. Advanced Java Topics Instructor: Sangmi Pallickara
Hello.java Program Output 1 public class Hello { 2 public static void main( String [] args ) 3 { 4 System.out.println( “Hello!" ); 5 } // end method main.
ARRAYS Computer Engineering Department Java Course Asst. Prof. Dr. Ahmet Sayar Kocaeli University - Fall
Generative Programming. Automated Assembly Lines.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns IX Interpreter, Mediator, Template Method recap.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
1 Xiaoqing Wu, Barrett R. Bryant, Jeff Gray and Suman Roychoudhury University of Alabama at Birmingham Separation of Concerns in Compiler Development Using.
CCC: An Aspect-Oriented Intermediate Language on.Net Platform Yingfei Xiong and Feng Wan University of Electronic Science and Technology of China, China.
Object-Oriented Design CSC 212. Announcements This course is speeding up and we are starting new material. Please see me if you feel this is going too.
Towards Multi-Paradigm Software Development Valentino Vranić Department of Computer Science and Engineering Faculty of Electrical Engineering.
A Two-Dimensional Separation of Concerns for Compiler Construction Carl (Xiaoqing) Wu, Suman Roychoudhury, Barrett R. Bryant and Jeffrey G. Gray The University.
Software Systems Design – 4 Class Diagrams (dynamic)
Demeter Aspects We study techniques for the emerging area of Aspect-Oriented Software Development and focus on the following areas:  Aspectual Collaborations.
Inheritance. Inheritance - Introduction Idea behind is to create new classes that are built on existing classes – you reuse the methods and fields and.
1 Languages and Compilers (SProg og Oversættere) Bent Thomsen Department of Computer Science Aalborg University With acknowledgement to Wei-Tek Tsai who’s.
Basic Scheme February 8, 2007 Compound expressions Rules of evaluation Creating procedures by capturing common patterns.
C++ Inheritance Data Structures & OO Development I 1 Computer Science Dept Va Tech June 2007 © McQuain Generalization versus Abstraction Abstraction:simplify.
The Visitor Pattern (Behavioral) ©SoftMoore ConsultingSlide 1.
Lecture 2: Review of Object Orientation. © Lethbridge/La ganière 2005 Chapter 2: Review of Object Orientation What is Object Orientation? Procedural.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
Session 7 Introduction to Inheritance. Accumulator Example a simple calculator app classes needed: –AdderApp - contains main –AddingFrame - GUI –CloseableFrame.
Basic Concepts of OOP.  Object-Oriented Programming (OOP) is a type of programming added to php5 that makes building complex, modular and reusable web.
Java & C++ Comparisons How important are classes and objects?? What mechanisms exist for input and output?? Are references and pointers the same thing??
Object orientation and Packaging in Java Object Orientation and Packaging Introduction: After completing this chapter, you will be able to identify.
Author: DoanNX Time: 45’.  OOP concepts  OOP in Java.
CS 350 – Software Design The Decorator Pattern – Chapter 17 In this chapter we expand our e-commerce case study and learn how to use the Decorator Pattern.
COMPUTER SCIENCE & TECHNOLOGY DEGREE PROGRAMME FACULTY OF SCIENCE & TECHNOLOGY UNIVERSITY OF UVA WELLASSA ‏ Properties of Object Oriented Programming.
Classes (Part 1) Lecture 3
Basic Scheme February 8, 2007 Compound expressions Rules of evaluation
Concepts of Object Oriented Programming
University of Central Florida COP 3330 Object Oriented Programming
Chapter 5:Design Patterns
Introduction to Design Patterns
Inheritance and Polymorphism
Behavioral Design Patterns
Discussion with Gregor Kiczales at UBC
University of Central Florida COP 3330 Object Oriented Programming
Road Map Inheritance Class hierarchy Overriding methods Constructors
Object Oriented Analysis and Design
Design Pattern: Visitor
Presentation transcript:

Each design pattern is designed to facilitate one kind of change, i.e. changes in one dimension. However, software evolution can happen in multiple dimensions and each dimension has its own best-fit modularization requirements.. Therefore, none of the design patterns is a panacea to fulfill the multi-dimensional evolution needed during software development.. Pattern Transformation for Two-Dimensional Separation of Concerns Xiaoqing Wu (Advisor: Barrett R. Bryant) Department of Computer and Information Sciences – The University of Alabama at Birmingham class Executive extends Employee{ public Regular(String name, String ssn, double wage){ super(name, ssn); this.wage = wage; } public double wage(){ return wage; } public void print(){ System.out.print ("Regular: "); super.print(); } class Contractor extends Employee{ public Regular(String name, String ssn, double wage){ super(name, ssn); this.wage = wage; } public double wage(){ return wage; } public void print(){ System.out.print ("Regular: "); super.print(); } class Regular extends Employee{ public Regular(String name, String ssn, double wage){ super(name, ssn); this.wage = wage; } public double wage(){ return wage; } public void print(){ System.out.print ("Regular: "); super.print(); } aspect Name { public abstract void Employee.tax(); public double Executive.tax(){ return wage() * 30%; } public double Regular.tax(){ return wage() * 25%; } public double Contractor.tax(){ return wage() * 20%; } aspect Wage { public abstract void Employee.tax(); public double Executive.tax(){ return wage() * 30%; } public double Regular.tax(){ return wage() * 25%; } public double Contractor.tax(){ return wage() * 20%; } aspect Print { public abstract void Employee.tax(); public double Executive.tax(){ return wage() * 30%; } public double Regular.tax(){ return wage() * 25%; } public double Contractor.tax(){ return wage() * 20%; } aspect Tax { public abstract void Employee.tax(); public double Executive.tax(){ return wage() * 30%; } public double Contractor.tax(){ return wage() * 20%; } public double Regular.tax(){ return wage() * 25%; } class Sales extends Employee{ public Regular(String name, String ssn, double wage){ super(name, ssn); this.wage = wage; } public double wage(){ return wage; } public void print(){ System.out.print ("Regular: "); super.print(); } public double tax(){ return wage() * 25%; } class Executive extends Employee{ public Regular(String name, String ssn, double wage){ super(name, ssn); this.wage = wage; } public double wage(){ return wage; } public void print(){ System.out.print ("Regular: "); super.print(); } public double tax(){ return wage() * 25%; } class Contractor extends Employee{ public Regular(String name, String ssn, double wage){ super(name, ssn); this.wage = wage; } public double wage(){ return wage; } public void print(){ System.out.print ("Regular: "); super.print(); } public double tax(){ return wage() * 25%; } class Regular extends Employee{ public Regular(String name, String ssn, double wage){ super(name, ssn); this.wage = wage; } public double wage(){ return wage; } public void print(){ System.out.print ("Regular: "); super.print(); } public double tax(){ return wage() * 25%; } √ × A pure object-oriented approach based on entities Pros: Any new kind of employee can be added to the system by creating a new type of the Employee class. Cons: The functional operations crosscut the various other class boundaries. Adding a new operation common to all subclasses is difficult. √ × Functional operation oriented. Visitor is separated with subject classes and can be freely added or deleted. Pros: Adding new operations is easy. Cons: Each operation crosscuts multiple visitor classes/aspects. Adding a new visitable type is hard. System description: Consider to build a simple payroll system of a company. Initially, there are three kinds of employees in the system: regulars, executives, and contractors. Each type of employee has different wage calculation function and output information. System evolution is performed along two dimensions: Changing or defining type of employees (e.g. Sales) Changing or adding operations (e.g. Tax) Inheritance Pattern Vertical modularization → each column = a class → Inheritance Pattern Horizontal modularization → each row = an aspect → Visitor, Mediator,…,Pattern For some software systems, the abstraction of all the necessary constructs in the system can be considered as a two-dimensional subject-function concern matrix. Most object-oriented design patterns (e.g., Visitor, Mediator, Abstract Factory) are generally defined as collaborations between several objects, which emerge as crosscutting concerns. Applying AOP toward modularizing object-oriented design patterns provides a more straightforward implementation strategy. When the two-dimensional concern matrix exists, pattern transformation can be implemented by source code transformation between object-orientation and aspect-orientation, based on the pluggable aspects. 3.Once new subject classes need to be added, transform the Visitor pattern to the Inheritance pattern (if it is not) by weaving the operations in every aspect into the corresponding class, and add the new subject classes using the Inheritance pattern. 1. Initially use either the Inheritance pattern or the Visitor pattern to build the system. 2.Once new functional behaviors need to be added or old functions need to be changed, transform the Inheritance pattern to the Visitor pattern (if it is not) by unweaving the operation methods of each class into individual aspect specifications, and then change the operations inside a visitor aspect or add new visitors to the system. The Visitor, Abstract Factory, Observer, and Mediator patterns all have drawbacks in adding new kinds of subject classes. Based on a similar 2D class-aspect concern matrix, the problem can be eliminated by transforming those patterns back and forth to the Inheritance pattern to accommodate change decisions. The Inheritance pattern and Visitor pattern transformation scheme has also been utilized successfully in the field of compiler design. The transformation between the Inheritance and Visitor patterns enables the compiler to evolve along two dimensions: defining new abstract syntax tree (AST) classes, or adding new operations. AST nodes are modularized as subject classes. Each phase of semantic analysis is encapsulated as an aspect. The underlying technology to realize the pattern transformation is aspect weaving and unweaving between object-orientation and aspect-orientation. Aspect weaving for inter-type declarations simply plugs those fields and methods defined in the aspect back to their corresponding classes. The aspect’s own fields/methods will be moved to the super class (e.g., Employee) as static members during the weaving process. Aspect unweaving for inter-type declarations and aspects’ own fields/methods simply undo the above processes. The aspect weaving and unweaving for join point-advice are not supported yet. NO DESIGN PATTERN IS A PANACEA ASPECT-ORIENTED DESIGN PATTERNS TWO-DIMENSIONAL CONCERN MATRIX PATTERN TRANSFORMATION APPROACH DESIGN PATTERN PAIRS CASE STUDY & TRANSFORMATION DETAILS PATTERN TRANSFORMATION APPLICATION Aspect- oriented Visitor pattern Object- oriented Visitor pattern Visitor Pattern Pattern Transformation