Aspect Oriented Programming


Published on

An Intro to Aspect oriented Programming

Published in: Education, Technology
No Downloads
Total views
On SlideShare
From Embeds
Number of Embeds
Embeds 0
No embeds

No notes for slide

Aspect Oriented Programming

  1. 1. Aspect Oriented Programming Anumod Kumar S CS-7 7211 Presented by:
  2. 2. Introduction <ul><li>Currently, the dominant programming paradigm is object-oriented programming that: </li></ul><ul><li>Object orientation is a clever idea, but has certain limitations </li></ul><ul><li>has been presented as a technology that can fundamentally aid software engineering </li></ul><ul><li>is reflected in the entire spectrum of current software development methodologies and tools </li></ul>Aspect Oriented Programming 1 1
  3. 3. Aspect Oriented Programming <ul><li>What is it? </li></ul><ul><ul><li>Programming methodology that modularizes code into processes. </li></ul></ul><ul><li>What does it do? </li></ul><ul><ul><li>Aids programmers in the separation of concerns/processes, specifically cross-cutting concerns, as an advance in modularization. </li></ul></ul>Aspect Oriented Programming 2
  4. 4. Object Oriented Programming <ul><li>What is it? </li></ul><ul><ul><li>Programming methodology that modularizes code into objects. </li></ul></ul><ul><li>What does it do? </li></ul><ul><ul><li>Aids programmers in separation of code into real world objects. </li></ul></ul>Aspect Oriented Programming 3
  5. 5. Object Oriented Programming <ul><li>Components of OOP </li></ul><ul><ul><li>Class </li></ul></ul><ul><ul><ul><li>Component that modularizes code in OOP. </li></ul></ul></ul><ul><ul><li>Function </li></ul></ul><ul><ul><ul><li>Contained inside a class. </li></ul></ul></ul><ul><ul><ul><li>Performs a process. </li></ul></ul></ul><ul><ul><ul><ul><li>Manipulates objects, attributes, etc. </li></ul></ul></ul></ul>Aspect Oriented Programming 4
  6. 6. Object Oriented Programming <ul><li>Advantages of OOP. </li></ul><ul><ul><li>Modularizes code into real world objects. </li></ul></ul><ul><ul><ul><li>Easy to understand code. </li></ul></ul></ul><ul><ul><li>Code is reusable if modularized correctly. </li></ul></ul><ul><ul><li>Code is easily maintained due to fix once, use everywhere principle. </li></ul></ul><ul><ul><li>Many development methodologies lend themselves to OOP. </li></ul></ul>Aspect Oriented Programming 5
  7. 7. Object Oriented Programming <ul><li>Disadvantages of OOP. </li></ul><ul><ul><li>Does not address cross-cutting concerns. </li></ul></ul><ul><ul><ul><li>Processes/Functionality cross into many code modules. </li></ul></ul></ul><ul><ul><ul><li>Creates duplicate code if not addressed. </li></ul></ul></ul><ul><ul><li>Unaddressed cross-cutting concerns may be hard to maintain. </li></ul></ul>Aspect Oriented Programming 6
  8. 8. Object Oriented Programming <ul><li>Similarities between AOP and OOP. </li></ul><ul><ul><li>Take advantage of code modularization. </li></ul></ul><ul><ul><ul><li>Code Reusability </li></ul></ul></ul><ul><ul><ul><li>Code Maintainability </li></ul></ul></ul><ul><li>Differences between AOP and OOP. </li></ul><ul><ul><li>OOP modularizes on basis of real world objects. </li></ul></ul><ul><ul><li>AOP modularizes on basis of Processes/Functionalities. </li></ul></ul>Aspect Oriented Programming 7
  9. 9. Need for AOP <ul><li>Problems with traditional Object Oriented Programming approach. </li></ul><ul><ul><li>OOP divides processes into classes, or objects. </li></ul></ul><ul><ul><li>These classes often cross over into many different processes. </li></ul></ul><ul><ul><ul><li>Leads to duplicated code. </li></ul></ul></ul><ul><ul><ul><li>Hard to maintain code. </li></ul></ul></ul><ul><ul><ul><li>Hard to use code. </li></ul></ul></ul>Aspect Oriented Programming 8
  10. 10. Traditional OOP Approach Oranges Storage Sell Buy Bananas Storage Sell Buy Apples Storage Sell Buy Fruit Shape Color Size Crosscutting Concerns Aspect Oriented Programming 9
  11. 11. Need for AOP <ul><li>Aspect Oriented Programming approach addresses cross cutting concerns. </li></ul><ul><ul><li>Better separates processes (concerns) than previous approaches. </li></ul></ul><ul><ul><ul><li>Creates cleaner code </li></ul></ul></ul><ul><ul><ul><li>Code is reusable at a greater extent than OOP </li></ul></ul></ul><ul><li>Properly separates business requirements into clean reusable code/ </li></ul>Aspect Oriented Programming 10
  12. 12. Advantage of AOP <ul><li>Currently with OOP, implementation is forced on developer </li></ul><ul><ul><li>Developer must implement requirements ahead of time. </li></ul></ul><ul><ul><li>Often time, developer is not clear on requirements up front. </li></ul></ul><ul><li>Problem solved by AOP. </li></ul><ul><ul><li>Implementation can be held off until clear. </li></ul></ul><ul><ul><li>Bad implementation is eliminated due to unclear requirements. </li></ul></ul>Aspect Oriented Programming 11
  13. 13. Aspects <ul><li>In AOP crosscutting concerns are implemented in aspects instead of fusing them into core modules. </li></ul><ul><li>Aspects are an additional unit of modularity. </li></ul><ul><li>Aspects can be reused. </li></ul><ul><li>By reducing code tangling it makes it easier to understand what the core functionality of a module is. </li></ul><ul><li>An “aspect weaver” takes the aspects and the core modules and composes the final system. </li></ul>Aspect Oriented Programming 12
  14. 14. AOP Key Idea base/core program aspect weave final system Aspect Oriented Programming 13
  15. 15. Aspect weaving <ul><li>Composition mechanism that coordinates aspects with the other modules of the system . </li></ul><ul><li>Performed by a specialized compiler called Weaver. </li></ul>Aspect Oriented Programming 14
  16. 16. Before AOP Timecard Transaction Security Scheduling Transaction Security Financial Transaction Security Crosscutting Concerns After AOP Timecard Scheduling Financial Transaction Security Aspect Oriented Programming 15
  17. 17. Conclusion <ul><li>Important to remember that AOP is not replacing OOP, but enhancing it. </li></ul><ul><ul><li>Can utilize OOP and AOP at same time. </li></ul></ul><ul><li>AOP approach involves not only technical changes, but methodology changes. </li></ul><ul><ul><li>Process oriented instead of Object oriented. </li></ul></ul>Aspect Oriented Programming 16
  18. 18. References: <ul><li>Wikipedia the free Encyclopedia </li></ul><ul><li>Aspect-Oriented Programming, Gregor Kiczales, John Lamping, Anurag Mendhekar, Chris Maeda, Cristina Videira Lopes, Jean-Marc Loingtier, John Irwin </li></ul><ul><li>Aspect-Oriented Programming with Model Checking, Naoyasu Ubayashi, Systems Integration Technology Center, Toshiba Corporation, Tokyo, Japan </li></ul><ul><li>An Initial Assessment of Aspect-oriented Programming,Robert J.Walker, Elisa L.A. Baniassad and Gail C. Murphy, Dept. of Computer Science, University of British Columbia, 201-2366 Main Mall, Vancouver, BC V6T 1Z4 Canada </li></ul>Aspect Oriented Programming 17
  19. 19. QUESTIONS Aspect Oriented Programming 18
  20. 20. THANK YOU!!!