SlideShare a Scribd company logo
1 of 35
18-Feb-20
Aspect-Oriented
Present by: M. Hayeri, A. Hajati
Supervisor: PhD. H. Motameni
Introduction
Programming paradigm which aims to increase
modularity by allowing the separation of cross-cutting
concern
2
Content
 Example: OOP
 Solution: OOP
 Problem
 What’s wrong with OOP?
 Introduction
 Modularity
 Cross-Cutting Concern
 Scattering
 Tangling
 Example
 AOP what is *NOT*
 Development Stages
 Aspectual Decomposition
 Concern Implementation
 Aspectual Re-composition
 OOP compare with AOP
 Terminology
 Decorator pattern
 Decorator Structure
 AOP Tools
 The Figure Element example
 AOP disadvantage
 Conclusions
3
Example: OOP
4
Solution: OOP
5
Problem
6
CONCERN
O1
O2O3
Problem
 Some programming tasks cannot be neatly encapsulated
in objects
7
What’s wrong with OOP?
8
Aspect Oriented Programming
 Modularity
 Cross-Cutting Concern
9
Modularity
 AOP introduces aspects, which encapsulate behaviors
that affect multiple classes into reusable modules.
 Exist in isolated and encapsulated constructs
 Be attached to almost any standard code construct
 Be transported between projects
10
Cross-Cutting Concern
 Concern:
 a concern is a particular set of information that has an effect
on the code of a computer program.
 Cross-Cutting Concern:
 the necessary concern “cuts across” many different classes
and methods
 aspects of a program that affect other concerns. These
concerns often cannot be cleanly decomposed from the rest of
the system in both the design and implementation.
11
Cross-Cutting Concern
 Scattering (code duplication) :
12
Cross-Cutting Concern
 Tangling(significant dependencies between systems):
13
Example
 Security(Authentication,…)
 Logging
 Caching
 Data Validation
 Error Detection
 ...
14
AOP what is *NOT* …
 OOP vs. AOP .Why "vs"? It is not "vs"
 A programming language dependent
 Silver bullet for all your problem
15
Development Stages
Aspect-Oriented Programming involves three different
development steps.
 Aspectual Decomposition
 Concern Implementation
 Aspectual re-composition
16
Aspectual Decomposition
 In the first step, the requirements are decomposed to
identify crosscutting and common concerns. Here, the
core concerns are separated from the crosscutting
system level concerns.
17
Concern Implementation
 In the second step of the development, each concern is
implemented separately
18
Aspectual Re-composition
 In the last step, an aspect integrator specifies re-
composition rules by creating modularization units
(aspects). The re-composition process is also called
weaving or integrating.
19
Development Stages
20
Development Stages
21
Terminology
 Join point
 Place where behavior can be added
 A join point is a well-defined point in the program flow
 Advice
 Code that can be injected at join points
 Advice is a code that is executed at a point-cut
 Point cut
 A point cut is a group of join points
 Aspect
 Container holding point cuts and advice
 An aspect is a module for handling crosscutting concerns
 Aspects are reusable and inheritable
 Weaving
 Combines advices with point cuts
22
AOP Tools
 …
23
24
AspectJ
 AspectJ is a small, well-integrated extension to Java
 Based on the 1997 PhD thesis by Christina Lopes, A
Language Framework for Distributed Programming
 AspectJ modularizes crosscutting concerns
 That is, code for one aspect of the program (such as tracing) is
collected together in one place
 The AspectJ compiler is free and open source
 AspectJ works with JBuilder, Forté, Eclipse, probably
others
 Best online write-up:
http://www.eclipse.org/aspectj/
 Parts of this lecture were taken from the above paper
25
The Figure Element Example
26
The Figure Element Example
 A point-cut named move that chooses various method calls:
 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));
 Advice (code) that runs before the move point-cut:
 before(): move() {
System.out.println("About to move");
}
 Advice that runs after the move point-cut:
 after(): move() {
System.out.println("Just successfully moved");
}
OOP compare with AOP
27
Decorator pattern
 Intent
 The decorator pattern can be used to extend (decorate) the functionality of a certain
object statically, or in some cases at run-time, independently of other instances of
the same class, provided some groundwork is done at design time.
 Dynamically adds responsibility to the interface by wrapping the original code
 Motivation
 As an example, consider a window in a windowing system. To
allow scrolling of the window's contents, one may wish to add
horizontal or vertical scrollbars to it, as appropriate.
 Usage
 A decorator makes it possible to add or alter behavior of an
interface at run-time
28
Decorator Pattern
29
Decorator Structure
30
 Decorator UML class diagram
Decorator Example Code
31
AOP disadvantage
 As AOP is a new technology, it is not very well tested
and documented.
32
Conclusions
 Aspect-Oriented Programming introduces a new way of
handling crosscutting concerns.
 It is hard to predict what AOP will become in the future,
but one thing is clear, AOP will be part of future
programming paradigms.
33
Reference
34
https://en.wikipedia.org/wiki/Cross-cutting_concern
https://www.cis.upenn.edu/~matuszek/cit597-2003/Lectures/45-
aop-programming.ppt
www.unc.edu/~stotts/comp523/aopStotts.ppt
Gang of Four Design Patterns
35
The End

More Related Content

Similar to Aspect-oriented programming

SADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfSADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdf
B.T.L.I.T
 

Similar to Aspect-oriented programming (20)

Ch21.pptx
Ch21.pptxCh21.pptx
Ch21.pptx
 
5 software design
5 software design5 software design
5 software design
 
lecture10-patterns.ppt
lecture10-patterns.pptlecture10-patterns.ppt
lecture10-patterns.ppt
 
lecture10-patterns.ppt
lecture10-patterns.pptlecture10-patterns.ppt
lecture10-patterns.ppt
 
SE-software design.ppt
SE-software design.pptSE-software design.ppt
SE-software design.ppt
 
Aspect Oriented Programming
Aspect Oriented ProgrammingAspect Oriented Programming
Aspect Oriented Programming
 
OOSAD Chapter 6 Object Oriented Design.pptx
OOSAD Chapter 6 Object Oriented Design.pptxOOSAD Chapter 6 Object Oriented Design.pptx
OOSAD Chapter 6 Object Oriented Design.pptx
 
Introduction To Design Patterns
Introduction To Design PatternsIntroduction To Design Patterns
Introduction To Design Patterns
 
View Alignment Techniques
View Alignment TechniquesView Alignment Techniques
View Alignment Techniques
 
Spring aop
Spring aopSpring aop
Spring aop
 
Object Oriented Analysis and Design
Object Oriented Analysis and DesignObject Oriented Analysis and Design
Object Oriented Analysis and Design
 
Power point presentation 1
Power point presentation 1Power point presentation 1
Power point presentation 1
 
Week 6
Week 6Week 6
Week 6
 
Aspect Oriented Programming
Aspect Oriented ProgrammingAspect Oriented Programming
Aspect Oriented Programming
 
AOP on Android
AOP on AndroidAOP on Android
AOP on Android
 
SADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdfSADP PPTs of all modules - Shanthi D.L.pdf
SADP PPTs of all modules - Shanthi D.L.pdf
 
Building modular software with OSGi - Ulf Fildebrandt
Building modular software with OSGi - Ulf FildebrandtBuilding modular software with OSGi - Ulf Fildebrandt
Building modular software with OSGi - Ulf Fildebrandt
 
Aspect Oriented Programming
Aspect Oriented ProgrammingAspect Oriented Programming
Aspect Oriented Programming
 
Design Patterns - General Introduction
Design Patterns - General IntroductionDesign Patterns - General Introduction
Design Patterns - General Introduction
 
A Program Transformation Technique To Support AOP Within C Template
A Program Transformation Technique To Support AOP Within C   TemplateA Program Transformation Technique To Support AOP Within C   Template
A Program Transformation Technique To Support AOP Within C Template
 

Recently uploaded

Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
9953056974 Low Rate Call Girls In Saket, Delhi NCR
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
dharasingh5698
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Dr.Costas Sachpazis
 

Recently uploaded (20)

Vivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design SpainVivazz, Mieres Social Housing Design Spain
Vivazz, Mieres Social Housing Design Spain
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort ServiceCall Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
Call Girls in Ramesh Nagar Delhi 💯 Call Us 🔝9953056974 🔝 Escort Service
 
Extrusion Processes and Their Limitations
Extrusion Processes and Their LimitationsExtrusion Processes and Their Limitations
Extrusion Processes and Their Limitations
 
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank  Design by Working Stress - IS Method.pdfIntze Overhead Water Tank  Design by Working Stress - IS Method.pdf
Intze Overhead Water Tank Design by Working Stress - IS Method.pdf
 
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
VIP Model Call Girls Kothrud ( Pune ) Call ON 8005736733 Starting From 5K to ...
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Coefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptxCoefficient of Thermal Expansion and their Importance.pptx
Coefficient of Thermal Expansion and their Importance.pptx
 
UNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular ConduitsUNIT-II FMM-Flow Through Circular Conduits
UNIT-II FMM-Flow Through Circular Conduits
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICSUNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
UNIT-IFLUID PROPERTIES & FLOW CHARACTERISTICS
 
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
Structural Analysis and Design of Foundations: A Comprehensive Handbook for S...
 
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
(INDIRA) Call Girl Aurangabad Call Now 8617697112 Aurangabad Escorts 24x7
 
Thermal Engineering Unit - I & II . ppt
Thermal Engineering  Unit - I & II . pptThermal Engineering  Unit - I & II . ppt
Thermal Engineering Unit - I & II . ppt
 
Online banking management system project.pdf
Online banking management system project.pdfOnline banking management system project.pdf
Online banking management system project.pdf
 
UNIT-III FMM. DIMENSIONAL ANALYSIS
UNIT-III FMM.        DIMENSIONAL ANALYSISUNIT-III FMM.        DIMENSIONAL ANALYSIS
UNIT-III FMM. DIMENSIONAL ANALYSIS
 
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
Call Girls Pimpri Chinchwad Call Me 7737669865 Budget Friendly No Advance Boo...
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 

Aspect-oriented programming