Parametric Aspects. A way to design-pattern implementation (...and others)? Jordi Alvarez Open University of Catalonia Barcelona - Spain

Slides:



Advertisements
Similar presentations
Creational Design Patterns. Creational DP: Abstracts the instantiation process Helps make a system independent of how objects are created, composed, represented.
Advertisements

Welcome to. Who am I? A better way to code Design Patterns ???  What are design patterns?  How many are there?  How do I use them?  When do I use.
Creational Patterns, Abstract Factory, Builder Billy Bennett June 11, 2009.
Copyright © Active Frameworks Inc. - All Rights Reserved - V2.0Creational Patterns - Page L4-1 PS95&96-MEF-L11-1 Dr. M.E. Fayad Creationa l Paradigm.
Framework is l Reusable Code, often domain specific (GUI, Net, Web, etc) l expressed as l a set of classes and l the way objects in those classes collaborate.
18-1 Verifying Object Behavior and Collaboration Role playing – the act of simulating object behavior and collaboration by acting out an object’s behaviors.
CSE3308/CSC Software Engineering: Analysis and DesignLecture 5B.1 Software Engineering: Analysis and Design - CSE3308 Patterns CSE3308/CSC3080/DMS/2000/12.
Plab – Tirgul 12 Design Patterns
Design Patterns for Object Oriented systems CSC 515 Ashwin Dandwate.
INTERPRETER Main Topics What is an Interpreter. Why should we learn about them.
CSE Software Engineering: Analysis and Design, 2005Lecture 8A.1 Software Engineering: Analysis and Design - CSE3308 Design and Analysis Patterns.
Nov, 1, Design Patterns PROBLEM CONTEXT SOLUTION A design pattern documents a proven solution to a recurring problem in a specific context and its.
CSE Software Engineering: Analysis and Design, 2002Lecture 7B.1 Software Engineering: Analysis and Design - CSE3308 Patterns CSE3308/DMS/2002/15.
Design Patterns. What are design patterns? A general reusable solution to a commonly occurring problem. A description or template for how to solve a problem.
CS350/550 Software Engineering Lecture 1. Class Work The main part of the class is a practical software engineering project, in teams of 3-5 people There.
PRESENTED BY SANGEETA MEHTA EECS810 UNIVERSITY OF KANSAS OCTOBER 2008 Design Patterns.
1 An introduction to design patterns Based on material produced by John Vlissides and Douglas C. Schmidt.
Linzhang Wang Dept. of Computer Sci&Tech, Nanjing University The Abstract Factory Pattern.
Pattern Abstract Factory
Deriving AO Software Architectures using the AO-ADL Tool Suite Luis Fernández, Lidia Fuentes, Mónica Pinto, Juan A. Valenzuela Universidad de Málaga
Creational Patterns Making Objects The Smart Way Brent Ramerth Abstract Factory, Builder.
Design Patterns.
1 CS 456 Software Engineering. 2 Contents 3 Chapter 1: Introduction.
Todd Snyder Development Team Lead Infragistics Experience Design Group.
An Introduction to Design Patterns. Introduction Promote reuse. Use the experiences of software developers. A shared library/lingo used by developers.
Object Oriented Analysis & Design & UML (Unified Modeling Language)1 Part V: Design The Design Workflow Design Classes Refining Analysis Relationships.
Creational Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
ECE450 - Software Engineering II1 ECE450 – Software Engineering II Today: Design Patterns IX Interpreter, Mediator, Template Method recap.
GoF Sections Design Problems and Design Patterns.
L11-12: Design Patterns Definition Iterator (L4: Inheritance)‏ Factory (L4: Inheritance)‏ Strategy (L5: Multiple Inheritance)‏ Composite (L6: Implementation.
Design Patterns CSIS 3701: Advanced Object Oriented Programming.
FACTORY METHOD. Design Pattern Space Purpose ScopeCreationalStructuralBehavioral ClassFactory MethodAdapterInterpreter Template Method ObjectAbstract.
Behavioral Patterns CSE301 University of Sunderland Harry R Erwin, PhD.
Design Pattern. Definition: A design pattern is a general reusable solution to a commonly occurring problem within a given context in software design.
1 Chapter 5:Design Patterns. 2 What are design pattern?  Schematic description of design solution to recurring problems in software design and,  Reusable.
Pattern Bridge. Definition Bridge is the structural pattern that separates abstraction from the implementation so that both of them can be changed independently.
Advanced Object-oriented Design Patterns Creational Design Patterns.
Example to motivate discussion We have two lists (of menu items) one implemented using ArrayList and another using Arrays. How does one work with these.
Chapter 8 Object Design Reuse and Patterns. More Patterns Abstract Factory: Provide manufacturer independence Builder: Hide a complex creation process.
CS 5150 Software Engineering Lecture 16 Program Design 3.
 Creational design patterns abstract the instantiation process.  make a system independent of how its objects are created, composed, and represented.
The Abstract Factory Pattern (Creational) ©SoftMoore ConsultingSlide 1.
Design Patterns Creational Patterns. Abstract the instantiation process Help make the system independent of how its objects are created, composed and.
Abstract Factory pattern Intent Provide an interface for creating families of related or dependent objects without specifying their concrete classes.
Banaras Hindu University. A Course on Software Reuse by Design Patterns and Frameworks.
CLASSIFICATION OF DESIGN PATTERNS Hladchuk Maksym.
Design Patterns CSCE 315 – Programming Studio Spring 2013.
Design Patterns: MORE Examples
Abstract Factory Pattern
Chapter 10 Design Patterns.
Chapter 5:Design Patterns
Design Patterns Lecture part 2.
Factory Patterns 1.
Introduction to Design Patterns
Design Patterns with C# (and Food!)
Abstract Factory Pattern
Intent (Thanks to Jim Fawcett for the slides)
Presented by Igor Ivković
Design Patterns - A few examples
Software Engineering Lecture 7 - Design Patterns
ADAPTIVE PROGRAMMING Sezen ERDEM December 2005.
CSC 480 Software Engineering
Ms Munawar Khatoon IV Year I Sem Computer Science Engineering
Structuring Adaptive Applications using AspectJ and AOM
Lesson 5: More on Creational Patterns
Creational Patterns.
CSC 480 Software Engineering
Chapter 8, Design Patterns Introduction
Presented by Igor Ivković
Presentation transcript:

Parametric Aspects. A way to design-pattern implementation (...and others)? Jordi Alvarez Open University of Catalonia Barcelona - Spain

Certain problems cannot be adequately solved with OO+AOP Example 1: Some design patterns in GoF can be implemented in an abstract way using AOP, but others not. Example 2: For some problems (like EJB development) we still need to provide a lot of redundant code. Motivation

Goal: provide aspect language extensions that allow to provide reusable implementations with no redundant code for a broader range of problems than that provided nowadays by OO+AOP. (Our) Solution Adapt parametric-type ideas to separation of concerns. This should be done in a very flexible way and allow powerful results!

Example domain 1: Design Patterns. OO solution Alternatives a) Automatic code-generation b) Reusable pattern implementation Design patterns Problem domain Program pattern code domain code

Design patterns problem domain pattern code domain code Pattern application domain code Pattern library abstract patterns concrete aspects Reusable pattern implementation (Hannemann&Kiczales)

Code reuse: design patterns are implemented only once Pattern-code isolated from domain code (untangling) Pattern code unscattered Reusable implementation of design patterns: advantatges OO developmentAOP development pattern implementation pattern code domain code

Works on design pattern implementation Hannemann & Kickzales Hachani & Bardou Noda & Kishi - Study from 23 GoF patterns. - Remove dependencies between participants and patterns. - Implements 12 of them in a completely reusable way. - Implement Visitor and Strategy [GoF]. - Implement directly as an application. - Implement Observer, Composite and Adapter. - Code reuse.

Problematic patterns Creational Low level Too abstract Goal: provide (aspect) language extensions that allow us to board some of these patterns. Creation is related to the nature of the created entity. Correctly implemented without aspects. - Describe design structure. - It is complex to provide an implementation for them without taking into account the concrete application domain.

Parametric Aspects Proposal: add parametric-type ideas to AOP Detailed specification of patterns. Parameterized/template classes Patterns Parametric aspects Parameterized/template methods Parameterized/template expressions -Sets of classes (new role type) -Class generation from roles -Allowing also multiple class generation -Method generation from roles -Allowing also multiple role generation -Compile-time evaluable -Should allow class hierarchy traversal Name composition.

Abstract Factory Pattern

Abstract Factory applied to GUI components

Abstract Factory applied to GUI components : detailed role specification AbstractFactory ConcreteFactory AbstractProduct ConcreteProduct ProductSet

class { … } Class generation from roles abstract class ComponentFactory { … } aspect ComponentFactoryPattern extends FactoryPattern { class ComponentFactory plays AbstractFactory;... } Parameterized/template classes

class Factory extends { … } Parameterized/template classes Multiple generation of classes aspect ComponentFactoryP ext. FP {... class-set A plays ProductSet {... } class-set B plays ProductSet {... } } class AFactory extends ComponentFactory { … } class BFactory extends ComponentFactory { … } ProductSet=BProductSet=A

Method generation from roles / Multiple generation of roles class { public abstract create (); } abstract class CompFact { public abstract Window createWindow(); public abstract ScrollBar createScrollBar(); public abstract Button createButton(); } aspect ComponentFactoryPattern extends FactoryPattern { class ComponentFactory plays AbstractFactory; class Window plays AbstractProduct; class ScrollBar plays AbstractProduct; class Button plays AbstractProduct;... } Parameterized/template methods

Evaluable at compile-time Should allow class hierarchy traversal class Factory extends { public … create () { return new <subclasses(AbstractProduct) & members(ProductSet)>(); } class AFactory … { … return new AWindow(); … return new AScrollBar(); … return new AButton(); } class BFactory … { … return new AWindow(); … return new AScrollBar(); … return new AButton(); } aspect ComponentFactoryPattern extends FP { class Window plays AbstractProduct; class ScrollBar plays AbstractProduct; class Button plays AbstractProduct; class-set A plays ProductSet { AWindow, AScrollBar, AButton; } class-set B plays ProductSet {... } } Parameterized/template expressions

<subclasses(AbstractProduct) & members(ProductSet)> class AFactory … { … return new AWindow(); … return new AScrollBar(); … return new AButton(); } Class BFactory … { … return new AWindow(); … return new AScrollBar(); … return new AButton(); } Window A Parameterized/template expressions

What are we conceptually doing? Object Oriented (OO) hierarchical definition of behavior Aspect Oriented (AOP) Injects/intercepts code modifying the structure AOP + parametric aspects Injects/intercepts code modifying the structure Generates code based on the structure