SlideShare a Scribd company logo
Aspect-oriented  programming RAVITEJA.K.V.S
Introduction Currently, the dominant programming paradigm is object-oriented programming that: Object orientation is a clever idea, but has certain limitations has been presented as a technology that can fundamentally aid software engineering is reflected in the entire spectrum of current software development methodologies and tools
Introduction A new programming technique called aspect-oriented programming (AOP): makes it possible to clearly express those programs that OOP fail to support enables the modularization of  crosscutting  concerns  by supporting a new unit of sw modularity – aspects – that provide encapsulation for crosscutting concerns
What are aspects? The current working definition is: modular units that cross-cut the structure of other modular units units that is defined in terms of partial information from other units exist in both design and implementation
Concerns AOP is based on the idea that computer systems are better programmed by separately specifying the various concerns of a system Separation of concerns is an important software engineering principle guiding all stage of a sw development methodology Concerns: are properties or areas of interest can range from high-level notion to low level-notion can be functional or nonfunctional (systemic)
Example of crosscutting concerns Consider: This requires every method that moves a figure element to do the notification the UML for a simple figure editor in which there are two concrete classes of figure element, points and lines the concern that the screen manager should be notified whenever a figure element moves
Example of crosscutting concerns Display Figure FigureElement * Point Line getX() getY() getP1 setP1 DisplayUpdating setX(int) setY(int) setP1(Point) setP2(Point) 2 The red box is drawn around every method that must implement this concern DisplayUpdating  fits neither inside of nor around the other boxes in the figure DisplayUpdating cuts across the other boxes
What are aspects? Aspects are similar to classes because: have type can extend classes and other aspects can be abstract or concrete can have fields, methods, and types as members
aspects  vs  class Aspect are different than classes because: can additionally include as members  pointcuts  (picks out join points),  advice  (code that executes at each join point )  do not have constructor or finalizer and they cannot be created with the new operator priviliged aspects can access private members of other types
What are aspect? Aspects may arise at any stage of the software lifecycle Common example of crosscutting aspects are design or architectural constraints, systemic properties or behaviours and features
Examples of how aspects cross-cut components We wanted to implement a distributed digital library that stores documents in many forms and provides a wide range of operations on those documents application  components  aspects digital  database,  minimizing network Library  printers,  traffic,  services  synchronization  constraints, failure handling
Examples of how aspects cross-cut components There are several aspects of concerns, including: communication, by which we mean controlling the amount of network bandwidth the application uses by being careful about which objects get copied in remote method calls coordination constraints, by which we mean the synchronization rules require to ensure that the component program behaves correctly failure handling, by which we mean handling the many different forms of failure that can arise in a distributed system
The role of aspects    in software design AOP aims at providing better means of addressing the well-known problem of separation of concerns Three basic approaches to addressing the process of separation of concerns: language-based  framework-based  architecture-oriented
Language-based approach It is based on the definition of a set of language constructs Relevant concerns are identified at the problem domain and translated to aspectual construct The final application is obtained by weaving the primary structure with the crosscutting aspects
Framework-based approach Provides more flexible constructs Concerns are materialized as aspectual classes at the framework level Developers can customize these aspects using the mechanism supported by the framework These types of  framework  are known as AO frameworks (explicitly engineers concerns)
Architecture-oriented  approach Early identification of concerns using architectural organizational models Architectural view-point involves a higher level of abstraction than the previous approaches It tipically comprises two stages
Architecture-oriented  approach First, developers should determine the problem architecture Then, the approach enables several kinds of aspect materialization through different frameworks Concerns are initially mapped to architectural construct
AOP technologies example Empirical analysis based on a simulation case study of the temperature control system (TCS)  of a building () This comprises a building with rooms requiring specific temperatures and a network consisting of radiators, pipes and a boiler To simulate TCS, a simple mathematical model of temporal differential equations specifies the heat flow among the different components
AOP technologies example Relevant aspects in TCS Aspect It refers to how the simulated entities should run Relationships Synchronization Scheduling It basically involves access to shared variables and race condition Description It works together with scheduling It works together with synchronization
AOP technologies example TCS evaluation according to the different implementation Analyzed features: scheduling and synchronization OO modeling: SS are scattered across the components requiring these facilities (inheritance anomalies) EBA: SS are provided as built-in features in the framework. It may be difficult to customize some of these policies R-AO – AL: There are specific aspects dealing with SS. They are kept separated, but some problems about the way they interact (aspect composition) may arise
AOP technologies example Several execution of the simulation programs are maded TCS performance with the different implementation: results were very similar except in the case of R-AO similarities found in the study seem to indicate that both EBA and AL  run almost like standard code
AOP technologies example To obtain a measure of the complexity of the implementations, it is gathered code statistics (NCSS) about: number of methods per class the NCSS per methods cyclomatic complexity (CNN per methods) In particular, the best results were obtained with EBA (this payoff comes mainly from the autonomy of component and decoupling prescribed by framework).
AOP issues AOP must address both what the programmer can say and how the computer system will realize the program in a program system AOP system: provides a way of expressing crosscutting concerns also ensures these mechanisms are conceptually straighforward and have efficient implementations
AOP issues How an AOP system specifies aspects: What composition mechanisms the system provides:  join points aspect parameterization d ominant decomposition visibility mechanism provided
AOP issues Implementation mechanisms: Software process: static/dynamic distinction modular compilation target representation methodology or framework (the system provides for organizing the system-building activity) reusability domain-specificity
AspectJ Aspectj is: Aspectj enables the modular implementation of a wide range of crosscutting concerns a general-purpose Ao extension to Java Java platform compatible easy to learn and use freely available under an Open Source license
AspectJ When written as an aspect the structure of a crosscutting concern is explicit and easy to reason about Aspects are modular AspectJ enables: name-based crosscutting (tend to affect a small number of other classes) property-based crosscutting (range from small to large scale)
AspectJ Adoption of it into an existing project can be a straightforward and incremental task: The goals of the AspectJ project are to make AOP technology available to a wide range of programmers, to build and support an AspectJ user community to begin with development aspects other paths are possible,depending on the needs of the projects
What next? Software engineering researchers provide some help to determine if it is beneficial for sw development organization to adopt AOP for building their sw products A number of study have been conducted to asses the usefulness of AOP Two basic techniques for assessing a programming technology: experiments case study
What next? Three areas emerge as important in supporting the use of AOP: exposing join points managing aspect interface structuring aspects
Terminology A  join point  is a well-defined point in the program flow A  pointcut  is a group of join points Advice  is code that is executed at a pointcut Introduction  modifies the members of a class and the relationships between classes An  aspect  is a module for handling crosscutting concerns  Aspects are defined in terms of pointcuts, advice, and introduction Aspects are reusable and inheritable
AspectJ example An aspect is defined very much like a class and can have methods, fields, constructors, initializers, named pointcuts and advice An example is tracing aspect that prints messages before certain display operation The overall effect of this aspect is to print a descriptive message whenever the traced methods are called
AspectJ example Aspect SimpleTracing { pointcut traced() : call (void Display.update () ) || call (void Display.repaint (..) ); before() : traced () { println(“Entering:” + thisJoinPoint); } void println (String str) { <write to appropriate stream> } } Traced identifies calls to several key methods on Display Before advice on this pointcut uses a helper method of the aspect to print a message Advice uses the thisJoinPoint special variable to an object that describes the current join point

More Related Content

What's hot (20)

PPT
Rhapsody Software
Bill Duncan
 
PDF
[2016/2017] Architectural languages
Ivano Malavolta
 
PPTX
Clean coding in plsql and sql
Brendan Furey
 
PPT
Introduction to programming languages part 2
university of education,Lahore
 
PDF
Java quick reference
ArthyR3
 
PPT
5 software design
cherrybear2014
 
PDF
WhitePaperTemplate
Jo Marques
 
PDF
Aspect Oriented Development
tyrantbrian
 
PPTX
Aspect Oriented Programming
Rajesh Ganesan
 
PDF
[2015/2016] Modern development paradigms
Ivano Malavolta
 
PDF
Using Automation to Improve Software Services
International Society of Service Innovation Professionals
 
PPT
Rhapsody Eclipse
Bill Duncan
 
PPTX
Learning uml 2_part_1
Mark Gaad
 
PPTX
Software Design 1: Coupling & cohesion
Attila Magyar
 
PPT
Component Based Testing Using Finite Automata
Sanjoy Kumar Das
 
PPT
Design Principles
university of education,Lahore
 
PDF
OOP Comparative Study
Darren Tan
 
PPTX
Software Architecture Taxonomies - Behaviour: Components & Connectors
Jose Emilio Labra Gayo
 
PPTX
Software design
Syed Muhammad Hammad-ud-Din
 
PPTX
Software Architecture Taxonomies - modularity
Jose Emilio Labra Gayo
 
Rhapsody Software
Bill Duncan
 
[2016/2017] Architectural languages
Ivano Malavolta
 
Clean coding in plsql and sql
Brendan Furey
 
Introduction to programming languages part 2
university of education,Lahore
 
Java quick reference
ArthyR3
 
5 software design
cherrybear2014
 
WhitePaperTemplate
Jo Marques
 
Aspect Oriented Development
tyrantbrian
 
Aspect Oriented Programming
Rajesh Ganesan
 
[2015/2016] Modern development paradigms
Ivano Malavolta
 
Using Automation to Improve Software Services
International Society of Service Innovation Professionals
 
Rhapsody Eclipse
Bill Duncan
 
Learning uml 2_part_1
Mark Gaad
 
Software Design 1: Coupling & cohesion
Attila Magyar
 
Component Based Testing Using Finite Automata
Sanjoy Kumar Das
 
OOP Comparative Study
Darren Tan
 
Software Architecture Taxonomies - Behaviour: Components & Connectors
Jose Emilio Labra Gayo
 
Software Architecture Taxonomies - modularity
Jose Emilio Labra Gayo
 

Viewers also liked (10)

PDF
Chapter 10: Crosscutting Concerns
Presidential Human Rights Committee - Secretariat
 
PPTX
Cross cutting concerns
Radu Iscu
 
PPSX
DBA Lounge - Data Recovery and Fixing Database Corruptions
Dan Andrei Stefan
 
PPT
Introduction to Aspect Oriented Software Development
mukhtarhudaya
 
PPTX
Introduction to Aspect Oriented Programming
Yan Cui
 
PPT
Aspect Oriented Software Development
Jignesh Patel
 
DOCX
Spiral model
Hajji Mboowa Yahaya
 
PPTX
What is an aspect in aspect oriented requirements engineering
meriem sari
 
PPT
Spiral model explanation
Umar Farooq
 
PPT
Spiral model presentation
SayedFarhan110
 
Chapter 10: Crosscutting Concerns
Presidential Human Rights Committee - Secretariat
 
Cross cutting concerns
Radu Iscu
 
DBA Lounge - Data Recovery and Fixing Database Corruptions
Dan Andrei Stefan
 
Introduction to Aspect Oriented Software Development
mukhtarhudaya
 
Introduction to Aspect Oriented Programming
Yan Cui
 
Aspect Oriented Software Development
Jignesh Patel
 
Spiral model
Hajji Mboowa Yahaya
 
What is an aspect in aspect oriented requirements engineering
meriem sari
 
Spiral model explanation
Umar Farooq
 
Spiral model presentation
SayedFarhan110
 
Ad

Similar to ASPECT ORIENTED PROGRAMING(aop) (20)

PPT
Aop2007
Tuhin_Das
 
PPT
3 analysis and design overview
Châu Thanh Chương
 
PDF
Unit-1_Notes(OOAD).pdf
ganeshkarthy
 
PPT
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
VGaneshKarthikeyan
 
PPT
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
VGaneshKarthikeyan
 
PPT
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
VGaneshKarthikeyan
 
PDF
Software Designing - Software Engineering
Purvik Rana
 
PPTX
SA_UNIT_1.pptx
ShwetaGajbhiye12
 
PPTX
OOSAD-Object Oriented Systems Analysis and Design - Chapter06-Part I.pptx
girumdethio
 
PPTX
Object Oriented Approach for Software Development
Rishabh Soni
 
PPTX
chapter-6-Software_Engineering_P1_MohamedElhawy_19135002.pptx
MahmoudZidan53
 
ODP
Software Patterns
Sudarsun Santhiappan
 
PDF
Design Engineering is a topic of software engineering of second year fourth s...
38aartidhage
 
PDF
SADP PPTs of all modules - Shanthi D.L.pdf
B.T.L.I.T
 
PPT
Jar chapter 1
Reham Maher El-Safarini
 
PPT
Chapter1
Dang Tuan
 
PPT
Ssad system design
Ravi Shekhar
 
PPTX
UNIT V TESTING.pptx
anguraju1
 
PPT
Ooad
gantib
 
PPT
15 object orienteddesign
randhirlpu
 
Aop2007
Tuhin_Das
 
3 analysis and design overview
Châu Thanh Chương
 
Unit-1_Notes(OOAD).pdf
ganeshkarthy
 
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
VGaneshKarthikeyan
 
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
VGaneshKarthikeyan
 
UNIT-I(Unified_Process_and_Use Case_Diagrams)_OOAD.ppt
VGaneshKarthikeyan
 
Software Designing - Software Engineering
Purvik Rana
 
SA_UNIT_1.pptx
ShwetaGajbhiye12
 
OOSAD-Object Oriented Systems Analysis and Design - Chapter06-Part I.pptx
girumdethio
 
Object Oriented Approach for Software Development
Rishabh Soni
 
chapter-6-Software_Engineering_P1_MohamedElhawy_19135002.pptx
MahmoudZidan53
 
Software Patterns
Sudarsun Santhiappan
 
Design Engineering is a topic of software engineering of second year fourth s...
38aartidhage
 
SADP PPTs of all modules - Shanthi D.L.pdf
B.T.L.I.T
 
Chapter1
Dang Tuan
 
Ssad system design
Ravi Shekhar
 
UNIT V TESTING.pptx
anguraju1
 
Ooad
gantib
 
15 object orienteddesign
randhirlpu
 
Ad

ASPECT ORIENTED PROGRAMING(aop)

  • 2. Introduction Currently, the dominant programming paradigm is object-oriented programming that: Object orientation is a clever idea, but has certain limitations has been presented as a technology that can fundamentally aid software engineering is reflected in the entire spectrum of current software development methodologies and tools
  • 3. Introduction A new programming technique called aspect-oriented programming (AOP): makes it possible to clearly express those programs that OOP fail to support enables the modularization of crosscutting concerns by supporting a new unit of sw modularity – aspects – that provide encapsulation for crosscutting concerns
  • 4. What are aspects? The current working definition is: modular units that cross-cut the structure of other modular units units that is defined in terms of partial information from other units exist in both design and implementation
  • 5. Concerns AOP is based on the idea that computer systems are better programmed by separately specifying the various concerns of a system Separation of concerns is an important software engineering principle guiding all stage of a sw development methodology Concerns: are properties or areas of interest can range from high-level notion to low level-notion can be functional or nonfunctional (systemic)
  • 6. Example of crosscutting concerns Consider: This requires every method that moves a figure element to do the notification the UML for a simple figure editor in which there are two concrete classes of figure element, points and lines the concern that the screen manager should be notified whenever a figure element moves
  • 7. Example of crosscutting concerns Display Figure FigureElement * Point Line getX() getY() getP1 setP1 DisplayUpdating setX(int) setY(int) setP1(Point) setP2(Point) 2 The red box is drawn around every method that must implement this concern DisplayUpdating fits neither inside of nor around the other boxes in the figure DisplayUpdating cuts across the other boxes
  • 8. What are aspects? Aspects are similar to classes because: have type can extend classes and other aspects can be abstract or concrete can have fields, methods, and types as members
  • 9. aspects vs class Aspect are different than classes because: can additionally include as members pointcuts (picks out join points), advice (code that executes at each join point ) do not have constructor or finalizer and they cannot be created with the new operator priviliged aspects can access private members of other types
  • 10. What are aspect? Aspects may arise at any stage of the software lifecycle Common example of crosscutting aspects are design or architectural constraints, systemic properties or behaviours and features
  • 11. Examples of how aspects cross-cut components We wanted to implement a distributed digital library that stores documents in many forms and provides a wide range of operations on those documents application components aspects digital database, minimizing network Library printers, traffic, services synchronization constraints, failure handling
  • 12. Examples of how aspects cross-cut components There are several aspects of concerns, including: communication, by which we mean controlling the amount of network bandwidth the application uses by being careful about which objects get copied in remote method calls coordination constraints, by which we mean the synchronization rules require to ensure that the component program behaves correctly failure handling, by which we mean handling the many different forms of failure that can arise in a distributed system
  • 13. The role of aspects in software design AOP aims at providing better means of addressing the well-known problem of separation of concerns Three basic approaches to addressing the process of separation of concerns: language-based framework-based architecture-oriented
  • 14. Language-based approach It is based on the definition of a set of language constructs Relevant concerns are identified at the problem domain and translated to aspectual construct The final application is obtained by weaving the primary structure with the crosscutting aspects
  • 15. Framework-based approach Provides more flexible constructs Concerns are materialized as aspectual classes at the framework level Developers can customize these aspects using the mechanism supported by the framework These types of framework are known as AO frameworks (explicitly engineers concerns)
  • 16. Architecture-oriented approach Early identification of concerns using architectural organizational models Architectural view-point involves a higher level of abstraction than the previous approaches It tipically comprises two stages
  • 17. Architecture-oriented approach First, developers should determine the problem architecture Then, the approach enables several kinds of aspect materialization through different frameworks Concerns are initially mapped to architectural construct
  • 18. AOP technologies example Empirical analysis based on a simulation case study of the temperature control system (TCS) of a building () This comprises a building with rooms requiring specific temperatures and a network consisting of radiators, pipes and a boiler To simulate TCS, a simple mathematical model of temporal differential equations specifies the heat flow among the different components
  • 19. AOP technologies example Relevant aspects in TCS Aspect It refers to how the simulated entities should run Relationships Synchronization Scheduling It basically involves access to shared variables and race condition Description It works together with scheduling It works together with synchronization
  • 20. AOP technologies example TCS evaluation according to the different implementation Analyzed features: scheduling and synchronization OO modeling: SS are scattered across the components requiring these facilities (inheritance anomalies) EBA: SS are provided as built-in features in the framework. It may be difficult to customize some of these policies R-AO – AL: There are specific aspects dealing with SS. They are kept separated, but some problems about the way they interact (aspect composition) may arise
  • 21. AOP technologies example Several execution of the simulation programs are maded TCS performance with the different implementation: results were very similar except in the case of R-AO similarities found in the study seem to indicate that both EBA and AL run almost like standard code
  • 22. AOP technologies example To obtain a measure of the complexity of the implementations, it is gathered code statistics (NCSS) about: number of methods per class the NCSS per methods cyclomatic complexity (CNN per methods) In particular, the best results were obtained with EBA (this payoff comes mainly from the autonomy of component and decoupling prescribed by framework).
  • 23. AOP issues AOP must address both what the programmer can say and how the computer system will realize the program in a program system AOP system: provides a way of expressing crosscutting concerns also ensures these mechanisms are conceptually straighforward and have efficient implementations
  • 24. AOP issues How an AOP system specifies aspects: What composition mechanisms the system provides: join points aspect parameterization d ominant decomposition visibility mechanism provided
  • 25. AOP issues Implementation mechanisms: Software process: static/dynamic distinction modular compilation target representation methodology or framework (the system provides for organizing the system-building activity) reusability domain-specificity
  • 26. AspectJ Aspectj is: Aspectj enables the modular implementation of a wide range of crosscutting concerns a general-purpose Ao extension to Java Java platform compatible easy to learn and use freely available under an Open Source license
  • 27. AspectJ When written as an aspect the structure of a crosscutting concern is explicit and easy to reason about Aspects are modular AspectJ enables: name-based crosscutting (tend to affect a small number of other classes) property-based crosscutting (range from small to large scale)
  • 28. AspectJ Adoption of it into an existing project can be a straightforward and incremental task: The goals of the AspectJ project are to make AOP technology available to a wide range of programmers, to build and support an AspectJ user community to begin with development aspects other paths are possible,depending on the needs of the projects
  • 29. What next? Software engineering researchers provide some help to determine if it is beneficial for sw development organization to adopt AOP for building their sw products A number of study have been conducted to asses the usefulness of AOP Two basic techniques for assessing a programming technology: experiments case study
  • 30. What next? Three areas emerge as important in supporting the use of AOP: exposing join points managing aspect interface structuring aspects
  • 31. Terminology A join point is a well-defined point in the program flow A pointcut is a group of join points Advice is code that is executed at a pointcut Introduction modifies the members of a class and the relationships between classes An aspect is a module for handling crosscutting concerns Aspects are defined in terms of pointcuts, advice, and introduction Aspects are reusable and inheritable
  • 32. AspectJ example An aspect is defined very much like a class and can have methods, fields, constructors, initializers, named pointcuts and advice An example is tracing aspect that prints messages before certain display operation The overall effect of this aspect is to print a descriptive message whenever the traced methods are called
  • 33. AspectJ example Aspect SimpleTracing { pointcut traced() : call (void Display.update () ) || call (void Display.repaint (..) ); before() : traced () { println(“Entering:” + thisJoinPoint); } void println (String str) { <write to appropriate stream> } } Traced identifies calls to several key methods on Display Before advice on this pointcut uses a helper method of the aspect to print a message Advice uses the thisJoinPoint special variable to an object that describes the current join point