SlideShare a Scribd company logo
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 (20)

PDF
Solving cross cutting concerns in PHP - PHPSerbia-2017
Alexander Lisachenko
 
PPT
Aspect Oriented Software Development
Jignesh Patel
 
PPTX
Performance analysis of synchronisation problem
harshit200793
 
PDF
Spring aop
Hamid Ghorbani
 
PPTX
Aspect Oriented Programming
Rajesh Ganesan
 
PPTX
Intro To AOP
Donald Belcham
 
PPT
ASPECT ORIENTED PROGRAMING(aop)
kvsrteja
 
PPTX
Aspect Oriented Programming - AOP/AOSD
Can R. PAHALI
 
PDF
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
Alexander Lisachenko
 
PPTX
Introduction To Aspect Oriented Programming
saeed shargi ghazani
 
PPTX
Introduction to Aspect Oriented Programming (DDD South West 4.0)
Yan Cui
 
PPTX
Introduction To AOP
Donald Belcham
 
PPTX
Introduction to Aspect Oriented Programming by Donald Belcham
.NET Conf UY
 
PPTX
Aspect Oriented Programing - Introduction
Venkaiah Chowdary Koneru
 
PPT
AOP-IOC made by Vi Quoc Hanh and Vu Cong Thanh in SC Team
Thuy_Dang
 
PPTX
Spring AOP
Radhakrishna Mutthoju
 
PDF
Aspect-oriented programming with AspectJ (as part of the the PTT lecture)
Ralf Laemmel
 
PPTX
UML for Aspect Oriented Design
Edison Lascano
 
PDF
IRJET- A Design Approach for Basic Telecom Operation
IRJET Journal
 
PPTX
Ch21.pptx
MohammedNouh7
 
Solving cross cutting concerns in PHP - PHPSerbia-2017
Alexander Lisachenko
 
Aspect Oriented Software Development
Jignesh Patel
 
Performance analysis of synchronisation problem
harshit200793
 
Spring aop
Hamid Ghorbani
 
Aspect Oriented Programming
Rajesh Ganesan
 
Intro To AOP
Donald Belcham
 
ASPECT ORIENTED PROGRAMING(aop)
kvsrteja
 
Aspect Oriented Programming - AOP/AOSD
Can R. PAHALI
 
Solving Cross-Cutting Concerns in PHP - DutchPHP Conference 2016
Alexander Lisachenko
 
Introduction To Aspect Oriented Programming
saeed shargi ghazani
 
Introduction to Aspect Oriented Programming (DDD South West 4.0)
Yan Cui
 
Introduction To AOP
Donald Belcham
 
Introduction to Aspect Oriented Programming by Donald Belcham
.NET Conf UY
 
Aspect Oriented Programing - Introduction
Venkaiah Chowdary Koneru
 
AOP-IOC made by Vi Quoc Hanh and Vu Cong Thanh in SC Team
Thuy_Dang
 
Aspect-oriented programming with AspectJ (as part of the the PTT lecture)
Ralf Laemmel
 
UML for Aspect Oriented Design
Edison Lascano
 
IRJET- A Design Approach for Basic Telecom Operation
IRJET Journal
 
Ch21.pptx
MohammedNouh7
 

Recently uploaded (20)

PDF
STUDY OF NOVEL CHANNEL MATERIALS USING III-V COMPOUNDS WITH VARIOUS GATE DIEL...
ijoejnl
 
PDF
20ME702-Mechatronics-UNIT-1,UNIT-2,UNIT-3,UNIT-4,UNIT-5, 2025-2026
Mohanumar S
 
PDF
All chapters of Strength of materials.ppt
girmabiniyam1234
 
PPTX
sunil mishra pptmmmmmmmmmmmmmmmmmmmmmmmmm
singhamit111
 
PPTX
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
DOCX
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
PPTX
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
PPTX
Water resources Engineering GIS KRT.pptx
Krunal Thanki
 
PPTX
ENSA_Module_7.pptx_wide_area_network_concepts
RanaMukherjee24
 
PPTX
MULTI LEVEL DATA TRACKING USING COOJA.pptx
dollysharma12ab
 
PPTX
Ground improvement techniques-DEWATERING
DivakarSai4
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PDF
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
PPTX
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
PDF
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
PDF
AI-Driven IoT-Enabled UAV Inspection Framework for Predictive Maintenance and...
ijcncjournal019
 
PDF
Advanced LangChain & RAG: Building a Financial AI Assistant with Real-Time Data
Soufiane Sejjari
 
PDF
CAD-CAM U-1 Combined Notes_57761226_2025_04_22_14_40.pdf
shailendrapratap2002
 
PDF
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
PPTX
Precedence and Associativity in C prog. language
Mahendra Dheer
 
STUDY OF NOVEL CHANNEL MATERIALS USING III-V COMPOUNDS WITH VARIOUS GATE DIEL...
ijoejnl
 
20ME702-Mechatronics-UNIT-1,UNIT-2,UNIT-3,UNIT-4,UNIT-5, 2025-2026
Mohanumar S
 
All chapters of Strength of materials.ppt
girmabiniyam1234
 
sunil mishra pptmmmmmmmmmmmmmmmmmmmmmmmmm
singhamit111
 
MT Chapter 1.pptx- Magnetic particle testing
ABCAnyBodyCanRelax
 
SAR - EEEfdfdsdasdsdasdasdasdasdasdasdasda.docx
Kanimozhi676285
 
22PCOAM21 Session 1 Data Management.pptx
Guru Nanak Technical Institutions
 
Water resources Engineering GIS KRT.pptx
Krunal Thanki
 
ENSA_Module_7.pptx_wide_area_network_concepts
RanaMukherjee24
 
MULTI LEVEL DATA TRACKING USING COOJA.pptx
dollysharma12ab
 
Ground improvement techniques-DEWATERING
DivakarSai4
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
67243-Cooling and Heating & Calculation.pdf
DHAKA POLYTECHNIC
 
business incubation centre aaaaaaaaaaaaaa
hodeeesite4
 
2010_Book_EnvironmentalBioengineering (1).pdf
EmilianoRodriguezTll
 
AI-Driven IoT-Enabled UAV Inspection Framework for Predictive Maintenance and...
ijcncjournal019
 
Advanced LangChain & RAG: Building a Financial AI Assistant with Real-Time Data
Soufiane Sejjari
 
CAD-CAM U-1 Combined Notes_57761226_2025_04_22_14_40.pdf
shailendrapratap2002
 
2025 Laurence Sigler - Advancing Decision Support. Content Management Ecommer...
Francisco Javier Mora Serrano
 
Precedence and Associativity in C prog. language
Mahendra Dheer
 
Ad

Aspect-oriented programming