SlideShare a Scribd company logo
1 of 21
PRESENTED BY:
Shreya Chattopadhyay
The only problem with Object Oriented programming is that it
is essentially static, and a change in requirements can have a
profound impact on development timelines.
Solution?
Aspect Oriented Programming
• Aspect-Oriented Programming (AOP) complements OO programming :
by allowing the developer to dynamically modify the static OO model to create
a system that can grow to meet new requirements. Just as objects in the real world
can change their states during their lifecycles, an application can adopt new
characteristics as it develops.
• AOP allows us to dynamically modify our static model:
by including the code required to fulfill the secondary requirements without
having to modify the original static model .
• Aspect-Oriented programming allows us the ability to apply aspects that alter
behaviour to classes or objects independent of any inheritance hierarchy. We
can then apply these aspects either during runtime or compile time
• Allow us to do a better job of maintaining systems as they evolve.
1. Cross-cutting concerns:
Even though most classes in an OO model will perform a single, specific function, they often share
common, secondary requirements with other classes. For example, we may want to add logging to
classes within the data-access layer and also to classes in the UI layer whenever a thread enters or
exits a method. Even though the primary functionality of each class is very different, the code
needed to perform the secondary functionality is often identical.
2. Advice:
This is the additional code that you want to apply to your existing model. In our example, this is the
logging code that we want to apply whenever the thread enters or exits a method.
3. Join Point
Well defined points in code that can be identified.Eg: when code invokes a method, that point at
which that invocation occurs is considered the joinpoint.
4. Point-cut:
This is the term given to the point of execution in the application at which cross-cutting concern
needs to be applied. A Point cut also contains an advice that is to occur when the join-point is
reached.
5. Aspect:
The combination of the point-cut and the advice is termed an aspect. In the example below, we add
a logging aspect to our application by defining a point-cut and giving the correct advice.
6. Weaving: Combines advices with point cuts
• The type of logging required in our example is a cross-
cutting concern.
• It cannot be isolated or encapsulated in one or two specific
classes; the logging involves changes in many places across the
system. Our desire is to keep the system maintainable, and
therefore we want our logging approach to keep the code as
clean and simple as possible.
• We would also like to avoid significant structural changes to the
system's architecture.
So how do we implement a cross-cutting concern such as logging?
We could refactor all of the code by creating a logging class and
performing the appropriate insertions.
PROBLEMS?
However, in a large system, this would be a time-consuming, error-
prone job.
Late adaptations in response to environment changes :
• Environment changes:– policy/organizational changes
• access control, security, privacy
• recurring deployment-like adaptations
• service/usage-specific:- principal initiating a service call, time and context of a
service call
• asynchronous environment changes: location, level of service, usage of
system resources
The SOLUTION…
“AOP is a programming paradigm which aims to
increase modularity by allowing the separation of
cross-cutting concerns”
• AOP is designed to handle cross-cutting concerns by providing a
mechanism, named ASPECT, for expressing these concerns and
automatically incorporating them into a system.
• AOP does not replace existing programming paradigms and languages,
instead, it works with them to improve their expressiveness and utility.
•
• It enhances our ability to express the separation of concerns necessary for a
well-designed, maintainable software system. Some concerns are
appropriately expressed as encapsulated objects, or components. Others
are best expressed as cross-cutting concerns.
Image by Mark Rohde
AOP
AspectJ is perhaps the best known and most widely used AOP implementation.
The Finance system has an interface and several methods for updating an
employee's financial data. The names of the methods all begin with the
word update (e.g.,updateFederalTaxInfo), and each financial update takes an
Employee object as an argument. Employees' personnel information is also
updated through an Employee object
We can describe, in prose, what we need to do. Every time we call any of the
updating functions and the update succeeds, we write a logging message. For
simplicity, we will say that we print a logging message to the standard output.
In the real system we would write to a log file. We would take three steps to
implement our solution in AspectJ :
1. Identify places in the code where we want to insert the logging code. This
is called defining join points in AspectJ.
2. Write the logging code.
3. Compile the new code and integrate it into the system.
• Centralize concerns implementation
• Intercept method calls
• Inject new behaviour
• More reusable code
• Cleaner code
What’s in it for YOU?
 Write less code
 Read less code
 More concise and easy to understand
 More maintainable
 FEWER DEFECTS!
 Fewer code
 More interesting work
 Increased attention
 More PRODUCTIVITY!
 AOP is complementary to OOP
 AOP targets a specific problem
 Code modularization
 OOP – Real world objects
 AOP – Functionalities
 You can do AOP via:
 Dynamic Proxies
 Functional Programming
 Code Generation
 Dynamic Languages
 Static Weaving
 Requires modification to every function
 No support for matching rules
 Manual aspect composition
• We will need to modify our process to accommodate AOP
• Quality issues may be the biggest deterrents to adopting AOSD methods.
• Tools will play a major part in industry adoption of AOP. In addition to
compilers and editors, we need tools to help us reason about systems, identify
potential cross-cutting concerns, and help us test in the presence of aspects.
• Poor tool chain support - debuggers, profilers etc may not know about the AOP
and so may work on code as if all the aspects had been replaced by procedural
code.
• Code bloat - small source can lead to much larger object code as code is
"weaved" throughout the code base.
Aspect Oriented Programming

More Related Content

What's hot

Design Concept software engineering
Design Concept software engineeringDesign Concept software engineering
Design Concept software engineeringDarshit Metaliya
 
Introduction to Software Engineering
Introduction to Software EngineeringIntroduction to Software Engineering
Introduction to Software EngineeringZahoor Khan
 
Introduction to APIs (Application Programming Interface)
Introduction to APIs (Application Programming Interface) Introduction to APIs (Application Programming Interface)
Introduction to APIs (Application Programming Interface) Vibhawa Nirmal
 
Software Quality Assurance (May – 2019) [Choice Based | Question Paper]
Software Quality Assurance (May – 2019) [Choice Based | Question Paper]Software Quality Assurance (May – 2019) [Choice Based | Question Paper]
Software Quality Assurance (May – 2019) [Choice Based | Question Paper]Mumbai B.Sc.IT Study
 
Assembler design options
Assembler design optionsAssembler design options
Assembler design optionsMohd Arif
 
Architectural Styles and Case Studies, Software architecture ,unit–2
Architectural Styles and Case Studies, Software architecture ,unit–2Architectural Styles and Case Studies, Software architecture ,unit–2
Architectural Styles and Case Studies, Software architecture ,unit–2Sudarshan Dhondaley
 
Software design, software engineering
Software design, software engineeringSoftware design, software engineering
Software design, software engineeringRupesh Vaishnav
 
Software architecture
Software architectureSoftware architecture
Software architecturenazn
 
Software Deployment Principles & Practices
Software Deployment Principles & PracticesSoftware Deployment Principles & Practices
Software Deployment Principles & PracticesThyagarajan Krishnan
 
Architectural patterns part 1
Architectural patterns part 1Architectural patterns part 1
Architectural patterns part 1assinha
 
Requirements validation - requirements engineering
Requirements validation - requirements engineeringRequirements validation - requirements engineering
Requirements validation - requirements engineeringRa'Fat Al-Msie'deen
 
Introduction to Design Pattern
Introduction to Design  PatternIntroduction to Design  Pattern
Introduction to Design PatternSanae BEKKAR
 
Introduction to Compiler Construction
Introduction to Compiler Construction Introduction to Compiler Construction
Introduction to Compiler Construction Sarmad Ali
 
Lect2 conventional software management
Lect2 conventional software managementLect2 conventional software management
Lect2 conventional software managementmeena466141
 
Organization and team structures
Organization and team structuresOrganization and team structures
Organization and team structuresNur Islam
 

What's hot (20)

Design Concept software engineering
Design Concept software engineeringDesign Concept software engineering
Design Concept software engineering
 
Ch16 component based software engineering
Ch16 component based software engineeringCh16 component based software engineering
Ch16 component based software engineering
 
Introducing DevOps
Introducing DevOpsIntroducing DevOps
Introducing DevOps
 
Introduction to Software Engineering
Introduction to Software EngineeringIntroduction to Software Engineering
Introduction to Software Engineering
 
Introduction to APIs (Application Programming Interface)
Introduction to APIs (Application Programming Interface) Introduction to APIs (Application Programming Interface)
Introduction to APIs (Application Programming Interface)
 
Software Quality Assurance (May – 2019) [Choice Based | Question Paper]
Software Quality Assurance (May – 2019) [Choice Based | Question Paper]Software Quality Assurance (May – 2019) [Choice Based | Question Paper]
Software Quality Assurance (May – 2019) [Choice Based | Question Paper]
 
Assembler design options
Assembler design optionsAssembler design options
Assembler design options
 
Architectural Styles and Case Studies, Software architecture ,unit–2
Architectural Styles and Case Studies, Software architecture ,unit–2Architectural Styles and Case Studies, Software architecture ,unit–2
Architectural Styles and Case Studies, Software architecture ,unit–2
 
Software design, software engineering
Software design, software engineeringSoftware design, software engineering
Software design, software engineering
 
Software Reliability
Software ReliabilitySoftware Reliability
Software Reliability
 
Software architecture
Software architectureSoftware architecture
Software architecture
 
Software process
Software processSoftware process
Software process
 
Software Deployment Principles & Practices
Software Deployment Principles & PracticesSoftware Deployment Principles & Practices
Software Deployment Principles & Practices
 
Architectural patterns part 1
Architectural patterns part 1Architectural patterns part 1
Architectural patterns part 1
 
Requirements validation - requirements engineering
Requirements validation - requirements engineeringRequirements validation - requirements engineering
Requirements validation - requirements engineering
 
Introduction to Design Pattern
Introduction to Design  PatternIntroduction to Design  Pattern
Introduction to Design Pattern
 
Introduction to Compiler Construction
Introduction to Compiler Construction Introduction to Compiler Construction
Introduction to Compiler Construction
 
Lect2 conventional software management
Lect2 conventional software managementLect2 conventional software management
Lect2 conventional software management
 
Phases of a Compiler
Phases of a CompilerPhases of a Compiler
Phases of a Compiler
 
Organization and team structures
Organization and team structuresOrganization and team structures
Organization and team structures
 

Similar to Aspect Oriented Programming

Aspect Oriented Programming - AOP/AOSD
Aspect Oriented Programming - AOP/AOSDAspect Oriented Programming - AOP/AOSD
Aspect Oriented Programming - AOP/AOSDCan R. PAHALI
 
Aspect Oriented Software Development
Aspect Oriented Software DevelopmentAspect Oriented Software Development
Aspect Oriented Software DevelopmentJignesh Patel
 
Secret Twists to Efficiently Develop Reactive Software Systems
Secret Twists to Efficiently Develop Reactive Software SystemsSecret Twists to Efficiently Develop Reactive Software Systems
Secret Twists to Efficiently Develop Reactive Software SystemsBart Jonkers
 
Formal Specification Ian Sommerville 9th Edition
Formal Specification Ian Sommerville 9th EditionFormal Specification Ian Sommerville 9th Edition
Formal Specification Ian Sommerville 9th EditionRupeshShrestha28
 
An intro to building an architecture repository meta model and modeling frame...
An intro to building an architecture repository meta model and modeling frame...An intro to building an architecture repository meta model and modeling frame...
An intro to building an architecture repository meta model and modeling frame...wweinmeyer79
 
Code Craftsmanship Checklist
Code Craftsmanship ChecklistCode Craftsmanship Checklist
Code Craftsmanship ChecklistRyan Polk
 
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing SoftwareSteven Smith
 
Performance analysis of synchronisation problem
Performance analysis of synchronisation problemPerformance analysis of synchronisation problem
Performance analysis of synchronisation problemharshit200793
 
Cs690 object oriented_software_engineering_team01_ report
Cs690 object oriented_software_engineering_team01_ reportCs690 object oriented_software_engineering_team01_ report
Cs690 object oriented_software_engineering_team01_ reportKhushboo Wadhwani
 
SOLID Design Principles for Test Automaion
SOLID Design Principles for Test AutomaionSOLID Design Principles for Test Automaion
SOLID Design Principles for Test AutomaionKnoldus Inc.
 
Drools Presentation for Tallink.ee
Drools Presentation for Tallink.eeDrools Presentation for Tallink.ee
Drools Presentation for Tallink.eeAnton Arhipov
 
How to Migrate Applications Off a Mainframe
How to Migrate Applications Off a MainframeHow to Migrate Applications Off a Mainframe
How to Migrate Applications Off a MainframeVMware Tanzu
 
Topic 19. User Requirements.pptx
Topic 19. User Requirements.pptxTopic 19. User Requirements.pptx
Topic 19. User Requirements.pptxssuserec6f52
 
Aspect Oriented Programming
Aspect Oriented ProgrammingAspect Oriented Programming
Aspect Oriented ProgrammingRodger Oates
 
Software engineering introduction
Software engineering introductionSoftware engineering introduction
Software engineering introductionVishal Singh
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure rupeshchanchal
 
Designing and documenting software architecture unit 5
Designing and documenting software architecture unit 5Designing and documenting software architecture unit 5
Designing and documenting software architecture unit 5Sudarshan Dhondaley
 

Similar to Aspect Oriented Programming (20)

Aspect Oriented Programming - AOP/AOSD
Aspect Oriented Programming - AOP/AOSDAspect Oriented Programming - AOP/AOSD
Aspect Oriented Programming - AOP/AOSD
 
Aspect Oriented Software Development
Aspect Oriented Software DevelopmentAspect Oriented Software Development
Aspect Oriented Software Development
 
Coding
CodingCoding
Coding
 
Secret Twists to Efficiently Develop Reactive Software Systems
Secret Twists to Efficiently Develop Reactive Software SystemsSecret Twists to Efficiently Develop Reactive Software Systems
Secret Twists to Efficiently Develop Reactive Software Systems
 
Formal Specification Ian Sommerville 9th Edition
Formal Specification Ian Sommerville 9th EditionFormal Specification Ian Sommerville 9th Edition
Formal Specification Ian Sommerville 9th Edition
 
An intro to building an architecture repository meta model and modeling frame...
An intro to building an architecture repository meta model and modeling frame...An intro to building an architecture repository meta model and modeling frame...
An intro to building an architecture repository meta model and modeling frame...
 
Code Craftsmanship Checklist
Code Craftsmanship ChecklistCode Craftsmanship Checklist
Code Craftsmanship Checklist
 
Improving The Quality of Existing Software
Improving The Quality of Existing SoftwareImproving The Quality of Existing Software
Improving The Quality of Existing Software
 
Performance analysis of synchronisation problem
Performance analysis of synchronisation problemPerformance analysis of synchronisation problem
Performance analysis of synchronisation problem
 
Cs690 object oriented_software_engineering_team01_ report
Cs690 object oriented_software_engineering_team01_ reportCs690 object oriented_software_engineering_team01_ report
Cs690 object oriented_software_engineering_team01_ report
 
Coding
CodingCoding
Coding
 
SOLID Design Principles for Test Automaion
SOLID Design Principles for Test AutomaionSOLID Design Principles for Test Automaion
SOLID Design Principles for Test Automaion
 
Spring aop
Spring aopSpring aop
Spring aop
 
Drools Presentation for Tallink.ee
Drools Presentation for Tallink.eeDrools Presentation for Tallink.ee
Drools Presentation for Tallink.ee
 
How to Migrate Applications Off a Mainframe
How to Migrate Applications Off a MainframeHow to Migrate Applications Off a Mainframe
How to Migrate Applications Off a Mainframe
 
Topic 19. User Requirements.pptx
Topic 19. User Requirements.pptxTopic 19. User Requirements.pptx
Topic 19. User Requirements.pptx
 
Aspect Oriented Programming
Aspect Oriented ProgrammingAspect Oriented Programming
Aspect Oriented Programming
 
Software engineering introduction
Software engineering introductionSoftware engineering introduction
Software engineering introduction
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure
 
Designing and documenting software architecture unit 5
Designing and documenting software architecture unit 5Designing and documenting software architecture unit 5
Designing and documenting software architecture unit 5
 

Recently uploaded

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptxLBM Solutions
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphNeo4j
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...shyamraj55
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):comworks
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsRizwan Syed
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDGMarianaLemus7
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentationphoebematthew05
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxnull - The Open Security Community
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraDeakin University
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticscarlostorres15106
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 

Recently uploaded (20)

Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 
Key Features Of Token Development (1).pptx
Key  Features Of Token  Development (1).pptxKey  Features Of Token  Development (1).pptx
Key Features Of Token Development (1).pptx
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge GraphSIEMENS: RAPUNZEL – A Tale About Knowledge Graph
SIEMENS: RAPUNZEL – A Tale About Knowledge Graph
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
Automating Business Process via MuleSoft Composer | Bangalore MuleSoft Meetup...
 
CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):CloudStudio User manual (basic edition):
CloudStudio User manual (basic edition):
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Scanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL CertsScanning the Internet for External Cloud Exposures via SSL Certs
Scanning the Internet for External Cloud Exposures via SSL Certs
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
APIForce Zurich 5 April Automation LPDG
APIForce Zurich 5 April  Automation LPDGAPIForce Zurich 5 April  Automation LPDG
APIForce Zurich 5 April Automation LPDG
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
costume and set research powerpoint presentation
costume and set research powerpoint presentationcostume and set research powerpoint presentation
costume and set research powerpoint presentation
 
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptxMaking_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
Making_way_through_DLL_hollowing_inspite_of_CFG_by_Debjeet Banerjee.pptx
 
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptxVulnerability_Management_GRC_by Sohang Sengupta.pptx
Vulnerability_Management_GRC_by Sohang Sengupta.pptx
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Artificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning eraArtificial intelligence in the post-deep learning era
Artificial intelligence in the post-deep learning era
 
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 

Aspect Oriented Programming

  • 2. The only problem with Object Oriented programming is that it is essentially static, and a change in requirements can have a profound impact on development timelines. Solution? Aspect Oriented Programming
  • 3. • Aspect-Oriented Programming (AOP) complements OO programming : by allowing the developer to dynamically modify the static OO model to create a system that can grow to meet new requirements. Just as objects in the real world can change their states during their lifecycles, an application can adopt new characteristics as it develops. • AOP allows us to dynamically modify our static model: by including the code required to fulfill the secondary requirements without having to modify the original static model . • Aspect-Oriented programming allows us the ability to apply aspects that alter behaviour to classes or objects independent of any inheritance hierarchy. We can then apply these aspects either during runtime or compile time • Allow us to do a better job of maintaining systems as they evolve.
  • 4. 1. Cross-cutting concerns: Even though most classes in an OO model will perform a single, specific function, they often share common, secondary requirements with other classes. For example, we may want to add logging to classes within the data-access layer and also to classes in the UI layer whenever a thread enters or exits a method. Even though the primary functionality of each class is very different, the code needed to perform the secondary functionality is often identical. 2. Advice: This is the additional code that you want to apply to your existing model. In our example, this is the logging code that we want to apply whenever the thread enters or exits a method. 3. Join Point Well defined points in code that can be identified.Eg: when code invokes a method, that point at which that invocation occurs is considered the joinpoint. 4. Point-cut: This is the term given to the point of execution in the application at which cross-cutting concern needs to be applied. A Point cut also contains an advice that is to occur when the join-point is reached. 5. Aspect: The combination of the point-cut and the advice is termed an aspect. In the example below, we add a logging aspect to our application by defining a point-cut and giving the correct advice. 6. Weaving: Combines advices with point cuts
  • 5. • The type of logging required in our example is a cross- cutting concern. • It cannot be isolated or encapsulated in one or two specific classes; the logging involves changes in many places across the system. Our desire is to keep the system maintainable, and therefore we want our logging approach to keep the code as clean and simple as possible. • We would also like to avoid significant structural changes to the system's architecture. So how do we implement a cross-cutting concern such as logging? We could refactor all of the code by creating a logging class and performing the appropriate insertions. PROBLEMS? However, in a large system, this would be a time-consuming, error- prone job.
  • 6.
  • 7. Late adaptations in response to environment changes : • Environment changes:– policy/organizational changes • access control, security, privacy • recurring deployment-like adaptations • service/usage-specific:- principal initiating a service call, time and context of a service call • asynchronous environment changes: location, level of service, usage of system resources
  • 9. “AOP is a programming paradigm which aims to increase modularity by allowing the separation of cross-cutting concerns”
  • 10. • AOP is designed to handle cross-cutting concerns by providing a mechanism, named ASPECT, for expressing these concerns and automatically incorporating them into a system. • AOP does not replace existing programming paradigms and languages, instead, it works with them to improve their expressiveness and utility. • • It enhances our ability to express the separation of concerns necessary for a well-designed, maintainable software system. Some concerns are appropriately expressed as encapsulated objects, or components. Others are best expressed as cross-cutting concerns.
  • 11. Image by Mark Rohde AOP
  • 12. AspectJ is perhaps the best known and most widely used AOP implementation. The Finance system has an interface and several methods for updating an employee's financial data. The names of the methods all begin with the word update (e.g.,updateFederalTaxInfo), and each financial update takes an Employee object as an argument. Employees' personnel information is also updated through an Employee object
  • 13. We can describe, in prose, what we need to do. Every time we call any of the updating functions and the update succeeds, we write a logging message. For simplicity, we will say that we print a logging message to the standard output. In the real system we would write to a log file. We would take three steps to implement our solution in AspectJ : 1. Identify places in the code where we want to insert the logging code. This is called defining join points in AspectJ. 2. Write the logging code. 3. Compile the new code and integrate it into the system.
  • 14. • Centralize concerns implementation • Intercept method calls • Inject new behaviour • More reusable code • Cleaner code
  • 15. What’s in it for YOU?
  • 16.  Write less code  Read less code  More concise and easy to understand  More maintainable  FEWER DEFECTS!  Fewer code  More interesting work  Increased attention  More PRODUCTIVITY!
  • 17.  AOP is complementary to OOP  AOP targets a specific problem  Code modularization  OOP – Real world objects  AOP – Functionalities
  • 18.  You can do AOP via:  Dynamic Proxies  Functional Programming  Code Generation  Dynamic Languages  Static Weaving
  • 19.  Requires modification to every function  No support for matching rules  Manual aspect composition
  • 20. • We will need to modify our process to accommodate AOP • Quality issues may be the biggest deterrents to adopting AOSD methods. • Tools will play a major part in industry adoption of AOP. In addition to compilers and editors, we need tools to help us reason about systems, identify potential cross-cutting concerns, and help us test in the presence of aspects. • Poor tool chain support - debuggers, profilers etc may not know about the AOP and so may work on code as if all the aspects had been replaced by procedural code. • Code bloat - small source can lead to much larger object code as code is "weaved" throughout the code base.

Editor's Notes

  1. Which finally brings us to aspect oriented programming, and I’ll give you a second to read this quick definition from Wikipedia.
  2. Which finally brings us to aspect oriented programming, and I’ll give you a second to read this quick definition from Wikipedia.
  3. That’s all very nice, but why should you care about writing reusable and clean code? What do you get out of it?
  4. Well, for one, you end up writing less code, and therefore you will need to read less code too. The code that you end up reading will be more concise and easy to understand as they’re no longer convoluted by cross-cutting concerns. As you reduce the complexity of your code, it becomes more maintainable too.
  5. AOP and OOP are not mutually exclusive; AOP is in fact complimentary to OOP and help you become a better OOP developer by helping you enforce some important design principles of OOP. Unlike OOP, functional programming or declarative programming, which are general purpose paradigms aimed to solve most of the programming problems we face, and all competing to be the core paradigm of a language. AOP on the other hand, is a paradigm which attempts to solve one very specific problem. AOP and OOP both encourage code modularization and encapsulation, which leads to better code reusability and maintainability. The difference between the two paradigms come in the form of WHAT they modularize on: - OOP modularizes on basis of real world entities AOP modularizes on basis of functionalities
  6. So hopefully that’s sufficient evidence for you to want to give AOP a go, but in terms of actually start doing some aspect-oriented programming you have quite a number of different options, including: Dynamic proxies with IoC frameworks - Functional programming using higher-order functions - Code generation using tools like T4 - Dynamic languages using their meta-programming capabilities - Static weaving, by modifying the MSIL in a post-compilation process
  7. But, as I have demonstrated with recursive function, if you want to use the memoized version of the function f everywhere in your code, you’ll need to modify all the places where f is being used. Also, there’s no support for matching rules that lets you apply the same aspect to multiple functions in bulk. And when you want compose different aspects together, i.e. combining multiple higher-order functions, you’ll need to do it manually which is a task that’s easier said than done.