A Brief Introduction to Aspect-Oriented Programming Zhenxiao Yang.

Slides:



Advertisements
Similar presentations
An Introduction to Programming General Concepts. What is a program? A program is an algorithm expressed in a programming language. programming language.
Advertisements

Programming Paradigms Introduction. 6/15/2005 Copyright 2005, by the authors of these slides, and Ateneo de Manila University. All rights reserved. L1:
Aspect Oriented Programming. AOP Contents 1 Overview 2 Terminology 3 The Problem 4 The Solution 4 Join point models 5 Implementation 6 Terminology Review.
An Aspect-Oriented Approach For Web Application Access Control Presented by: Mohamed Hassan Carleton University Carleton University
Aspect Oriented Programming - AspectJ Radhika Rajput.
An Overview of AspectJ Sabine Hauert. Today's Deserts  Whipped introduction served with its three berries syrup  Chocolate history soufflé  Design.
Secure Systems Research Group - FAU Aspect Oriented Programming Carlos Oviedo Secure Systems Research Group.
20-May-15 Aspect-Oriented Programming Dave Matuszek University of Pennsylvania.
Aspect-Oriented Programming In Eclipse ® Aspect-Oriented Programming in Eclipse with AspectJ Dr Helen Hawkins and Sian January.
University of British Columbia Software Practices Lab Fluid AOP Join Point Models Terry Hon Gregor Kiczales.
Java.sun.com/javaone/sf | 2004 JavaOne SM Conference | Session BUS JavaOne 2004 What is AOP? Gregor Kiczales AspectMentor.com and University of.
Object-Oriented Analysis and Design
Aspect-Oriented Programming: An Overview Brandon Wirick Feb
ASPECT ORIENTED SOFTWARE DEVELOPMENT Prepared By: Ebru Doğan.
High-Level Programming Languages
Introduction to Object-Oriented Programming (OOP)
26-Jun-15 Aspect-Oriented Programming. 2 Programming paradigms Procedural programming Executing a set of commands in a given sequence Fortran, C, Cobol,
Software modularity group Gregor Kiczales Professor and NSERC/Xerox/Sierra Systems Software Design Chair University of British Columbia Principal Scientist.
More on AspectJ. aspect MoveTracking { private static boolean _flag = false; public static boolean testAndClear() { boolean result = _flag; _flag = false;
Aspect-Oriented Programming with AspectJ™ AspectJ.org Xerox PARC Erik Hilsdale Gregor Kiczales with Bill Griswold, Jim Hugunin, Wes Isberg, Mik Kersten.
CSCI-383 Object-Oriented Programming & Design Lecture 15.
Subclasses and Subtypes CMPS Subclasses and Subtypes A class is a subclass if it has been built using inheritance. ▫ It says nothing about the meaning.
Like our natural language. Designed to facilitate the expression and communication ideas between people and computer Like our natural language. Designed.
Comparison of OO Programming Languages © Jason Voegele, 2003.
Outline Introduction Problem Statement Object-Oriented Design Aspect-Oriented Design Conclusion Demo.
Introduction to Object-oriented programming and software development Lecture 1.
Programming languages1 Programming paradigms Families of programming languages.
Introduction to Aspect Oriented Programming Presented By: Kotaiah Choudary. Ravipati M.Tech IInd Year. School of Info. Tech.
Aspect Oriented Programming Razieh Asadi University of Science & Technology Mazandran Babol Aspect Component Based Software Engineering (ACBSE)
Programming Paradigms Procedural Functional Logic Object-Oriented.
1 Metamodel Access Protocols for Extensible Aspect-Oriented Modeling Naoyasu Ubayashi(Kyushu Institute of Technology, Japan) Shinji Sano(Kyushu Institute.
1 Programming Language History and Evolution In Text: Chapter 2.
CSSE501 Object-Oriented Development. Chapter 12: Implications of Substitution  In this chapter we will investigate some of the implications of the principle.
Aspect Oriented Programming Sumathie Sundaresan CS590 :: Summer 2007 June 30, 2007.
Guided Notes Ch. 9 ADT and Modules Ch. 10 Object-Oriented Programming PHP support for OOP and Assignment 4 Term project proposal C++ and Java Designer.
Aspect Oriented Programming Gülşah KARADUMAN.
OOP and Dynamic Method Binding Chapter 9. Object Oriented Programming Skipping most of this chapter Focus on 9.4, Dynamic method binding – Polymorphism.
Generative Programming. Automated Assembly Lines.
OOP Class Lawrence D’Antonio Lecture 3 An Overview of C++
Design Rules for Increasing Modularity with CaesarJ Carlos Eduardo Pontual Advisor: Paulo Borba 17/06/2010.
AOSD1 Aspect-Oriented Software Design Karl Lieberherr Theo Skotiniotis.
AOP-1 Aspect Oriented Programming. AOP-2 Aspects of AOP and Related Tools Limitation of OO Separation of Concerns Aspect Oriented programming AspectJ.
CS 345: Programming Language Paradigms Chris Brooks HR 510 MWF 11:00-12:05.
Aspect-Oriented Programming and Modular Reasoning G. KiczalesM. Mezini Presented by Alex Berendeyev.
Towards Multi-Paradigm Software Development Valentino Vranić Department of Computer Science and Engineering Faculty of Electrical Engineering.
CS 3050 Object-Oriented Analysis and Design. Objectives What is “Object-Oriented?” Object-Oriented Approach Vs. Structured Approach How Has the Object-Oriented.
Aspect Oriented Development Alex Beatty.  Purpose  Cross-cutting Concerns  Join Points, Pointcuts, and Advices  Weaving  Invasive vs. Non-Invasive.
Alloy-based Lightweight Verification for Aspect-oriented Architecture Naoyasu Ubayashi(Kyushu Institute of Technology) Yuki Sato(Kyushu Institute of Technology)
AOP-Driven Variability in Software Product Lines Vander Alves, Ayla Dantas, and Paulo Borba Informatics Center – UFPE – Brazil
1 CERN-ITC Code Analysis Project Paolo Tonella ITC-irst, Centro per la Ricerca Scientifica e Tecnologica Povo, Trento, Italy
CSCI-383 Object-Oriented Programming & Design Lecture 24.
R R R A Brief Introduction to Aspect-Oriented Programming.
CSC450 Software Engineering Devon M. Simmonds University of North Carolina, Wilmington 1.
AspectScope: An Outline Viewer for AspectJ Programs Michihiro Horie, Shigeru Chiba Tokyo Institute of Technology, Japan.
Object orientation and Packaging in Java Object Orientation and Packaging Introduction: After completing this chapter, you will be able to identify.
 Is a programming paradigm  Extends OOP  Enables modularization of cross cutting concerns.
CSCI 383 Object-Oriented Programming & Design Lecture 15 Martin van Bommel.
Language Paradigms CS655.
CPS120 Introduction to Computer Science High Level Language: Paradigms.
Object-oriented programming (OOP) is a programming paradigm using "objects" – data structures consisting of data fields and methods together with their.
Aspect-Oriented Programming with the Eclipse AspectJ plug-in
An Introduction to Programming
Types of Programming Languages
A Brief Introduction to Aspect-Oriented Programming
Overview of Programming Paradigms
An Introduction to Programming
Programming Languages and Paradigms
AspectAda Aspect-Oriented Programming for Ada95
CPS120: Introduction to Computer Science
Presentation transcript:

A Brief Introduction to Aspect-Oriented Programming Zhenxiao Yang

Historical View Of Languages Procedural language Functional language Object-Oriented language

Procedural Language Also named imperative language Describe An explicit sequence of steps to follow to produce a result Examples: Basic, Pascal, C

Functional Language Also named declarative language Describe relationships between variables in terms of functions or inference rules. Examples Prolog: Logical programming language Haskell: Functional language

Object-Oriented Programming Describe A set of objects And communications among them to produce a result Basic features Encapsulation Inheritance Polymorphism

OOP (cont’d) Example languages First OOP language: SIMULA-67 (1970) Smalltalk, C++, Java Many other: Ada, Object Pascal, Objective C, DRAGOON, BETA, Emerald, POOL, Eiffel, Self, Oblog, ESP, POLKA, Loops, Perl, VB Are OOP languages procedural?

We Need More The nice things about OOP Modular structure The problems of OOP Issues distributed in different modules result in tangled code. Example: logging

We Need More (cont’d) We need a solution to this tangled-code problem One of the sound answer is Aspect- Oriented Programming

Basic Concepts in AOP cross-cut aspect joint point pointcut advice introduction

AspectJ by Example

AspectJ by Example (cont’d) Define pointcuts Define advice Introduction

Pointcuts pointcut pointcut move(): call(void FigureElement.setXY(int,int)) || call(void Point.setX(int)) || call(void Point.setY(int)) || call(void Line.setP1(Point)) || call(void Line.setP2(Point)); pointcut produce call(void Figure.make*(..)) pointcut setXY(FigureElement fe, int x, int y): call(void fe.setXY(x, y));

Advices Advice after(): move(){ System.out.println(“A figure element moved. ”); } after (FigureElement fe, int x, int y):setXY(fe,x,y){ System.out.println(fe + “ moved to ” +x,+ “, ” + y); }

Aspects aspect FigureLog{ pointcut setXY(FigureElement fe, int x, int y): calls(void fe.setXY(x, y)); after(FigureElement fe, int x, int y): setXY(fe, x, y){ System.out.println(fe + " moved to (" + x + ", " + y + ")."); }

Introduction Add members to a set of Classes Change inheritance structure of classes

Introduction (cont’d) aspect PointObserving { private Vector Point.observers = new Vector(); public static void addObserver(Point p, Screen s) { p.observers.add(s); } public static void removeObserver(Point p, Screen s) { p.observers.remove(s); }.... }

Introduction (cont’d) public class A1{ function foo(){…} } public class A2{ function foo(){…;super.foo();…} } public class A3{ function foo(){…;super.foo();…} } aspect A1A2A3{ declare parents: A2 extends A1; declare parents: A3 extends A2; }

Introduction (cont’d) public class A1{ function foo(){…} } public class A2{ function foo(){…;super.foo();…} } public class A3{ function foo(){…;super.foo();…} } aspect A1A3A2{ declare parents: A3 extends A1; declare parents: A2 extends A3; }

What Can AspectJ Do for Us Developing Tracing, Logging, and Profiling Pre- and Post-Conditions Contract Enforcement Production Change Monitoring Synchronization Context Passing Providing Consistent Behavior Introduction

Conclusion and Open Issues AOP vs OOP AOP is not substitute of OOP AOP makes OOP more powerful AOP also has runtime overhead We should use OOP as much as possible Reuse of aspects Tool support

Related Work AspectJ Reflection and meta-object protocols Meta-object provides mechanism to control over base-objects Subject-Oriented Programming

Thank You!