SlideShare ist ein Scribd-Unternehmen logo
1 von 16
Aspect-Oriented Programming Andrey Bratukhin, 2011
Contents ,[object Object]
Main conceptions in AOP
AspectJ as one of implementation
Pointcuts in AspectJ
Advice in AspectJ
Inter-type declaration
Weaving
Bad practicies
Conclusion
Introduction ,[object Object]
Aspect-oriented programming is a way of modularizing crosscutting concerns much like object-oriented programming is a way of modularizing common concerns.
Motivation void  transfer ( Account fromAcc, Account toAcc, int amount, User user, Logger logger ) throws  Exception  { logger.info ( &quot;transferring money...&quot; ); if   (!  checkUserPermission ( user )){ logger.info ( &quot;User has no permission.&quot; ); throw   new  UnauthorizedUserException (); } if   ( fromAcc.getBalance () <  amount ) { logger.info ( &quot;Insufficient Funds, sorry&quot; ); throw   new  InsufficientFundsException (); } fromAcc.withdraw ( amount ); toAcc.deposit ( amount ); //get database connection //save transactions logger.info ( &quot;Successful transaction.&quot; ); }
Tangled code
Dispersed code Module #1 Module #1 Module #1 Security API calls Security module
Extract common concerns Module #1 Module #1 Module #1 Automated integration of calls Security module Security  aspect

Weitere ähnliche Inhalte

Was ist angesagt?

Common ASP.NET Design Patterns - Telerik India DevCon 2013
Common ASP.NET Design Patterns - Telerik India DevCon 2013Common ASP.NET Design Patterns - Telerik India DevCon 2013
Common ASP.NET Design Patterns - Telerik India DevCon 2013Steven Smith
 
Design Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The WorldDesign Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The WorldSaurabh Moody
 
Performance analysis of synchronisation problem
Performance analysis of synchronisation problemPerformance analysis of synchronisation problem
Performance analysis of synchronisation problemharshit200793
 
Quick Tour to Front-End Unit Testing Using Jasmine
Quick Tour to Front-End Unit Testing Using JasmineQuick Tour to Front-End Unit Testing Using Jasmine
Quick Tour to Front-End Unit Testing Using JasmineGil Fink
 
Fast, Faster and Super-Fast Queries
Fast, Faster and Super-Fast QueriesFast, Faster and Super-Fast Queries
Fast, Faster and Super-Fast QueriesEdward Willink
 
Introduction to AOP, AspectJ, and Explicit Join Points
Introduction to AOP, AspectJ, and Explicit Join PointsIntroduction to AOP, AspectJ, and Explicit Join Points
Introduction to AOP, AspectJ, and Explicit Join PointsKevin Hoffman
 
Front end unit testing using jasmine
Front end unit testing using jasmineFront end unit testing using jasmine
Front end unit testing using jasmineGil Fink
 
C++ unit-1-part-10
C++ unit-1-part-10C++ unit-1-part-10
C++ unit-1-part-10Jadavsejal
 
Eclipse IDE Tips and Tricks - Lakshmi Priya Shanmugam
Eclipse IDE Tips and Tricks - Lakshmi Priya ShanmugamEclipse IDE Tips and Tricks - Lakshmi Priya Shanmugam
Eclipse IDE Tips and Tricks - Lakshmi Priya ShanmugamEclipse Day India
 
Styled Components & React.js
Styled Components & React.jsStyled Components & React.js
Styled Components & React.jsGrayson Hicks
 
Unit testing and mocking in Python - PyCon 2018 - Kenya
Unit testing and mocking in Python - PyCon 2018 - KenyaUnit testing and mocking in Python - PyCon 2018 - Kenya
Unit testing and mocking in Python - PyCon 2018 - KenyaErick M'bwana
 
Massively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerryMassively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerryTechFerry
 
Devday2016 real unittestingwithmockframework-phatvu
Devday2016 real unittestingwithmockframework-phatvuDevday2016 real unittestingwithmockframework-phatvu
Devday2016 real unittestingwithmockframework-phatvuPhat VU
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design PatternJaswant Singh
 
Styled components presentation
Styled components presentationStyled components presentation
Styled components presentationMaciej Matuszewski
 

Was ist angesagt? (20)

Spring AOP
Spring AOPSpring AOP
Spring AOP
 
Common ASP.NET Design Patterns - Telerik India DevCon 2013
Common ASP.NET Design Patterns - Telerik India DevCon 2013Common ASP.NET Design Patterns - Telerik India DevCon 2013
Common ASP.NET Design Patterns - Telerik India DevCon 2013
 
Design Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The WorldDesign Patterns For 70% Of Programmers In The World
Design Patterns For 70% Of Programmers In The World
 
Performance analysis of synchronisation problem
Performance analysis of synchronisation problemPerformance analysis of synchronisation problem
Performance analysis of synchronisation problem
 
Quick Tour to Front-End Unit Testing Using Jasmine
Quick Tour to Front-End Unit Testing Using JasmineQuick Tour to Front-End Unit Testing Using Jasmine
Quick Tour to Front-End Unit Testing Using Jasmine
 
Using Specflow for BDD
Using Specflow for BDDUsing Specflow for BDD
Using Specflow for BDD
 
Fast, Faster and Super-Fast Queries
Fast, Faster and Super-Fast QueriesFast, Faster and Super-Fast Queries
Fast, Faster and Super-Fast Queries
 
Introduction to AOP, AspectJ, and Explicit Join Points
Introduction to AOP, AspectJ, and Explicit Join PointsIntroduction to AOP, AspectJ, and Explicit Join Points
Introduction to AOP, AspectJ, and Explicit Join Points
 
Front end unit testing using jasmine
Front end unit testing using jasmineFront end unit testing using jasmine
Front end unit testing using jasmine
 
C++ unit-1-part-10
C++ unit-1-part-10C++ unit-1-part-10
C++ unit-1-part-10
 
Adapter Design Pattern
Adapter Design PatternAdapter Design Pattern
Adapter Design Pattern
 
Eclipse IDE Tips and Tricks - Lakshmi Priya Shanmugam
Eclipse IDE Tips and Tricks - Lakshmi Priya ShanmugamEclipse IDE Tips and Tricks - Lakshmi Priya Shanmugam
Eclipse IDE Tips and Tricks - Lakshmi Priya Shanmugam
 
Styled Components & React.js
Styled Components & React.jsStyled Components & React.js
Styled Components & React.js
 
spring aop
spring aopspring aop
spring aop
 
Unit testing and mocking in Python - PyCon 2018 - Kenya
Unit testing and mocking in Python - PyCon 2018 - KenyaUnit testing and mocking in Python - PyCon 2018 - Kenya
Unit testing and mocking in Python - PyCon 2018 - Kenya
 
Massively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerryMassively Scalable Applications - TechFerry
Massively Scalable Applications - TechFerry
 
Devday2016 real unittestingwithmockframework-phatvu
Devday2016 real unittestingwithmockframework-phatvuDevday2016 real unittestingwithmockframework-phatvu
Devday2016 real unittestingwithmockframework-phatvu
 
Factory Design Pattern
Factory Design PatternFactory Design Pattern
Factory Design Pattern
 
Java Custom Annotations- Part1
Java Custom Annotations- Part1Java Custom Annotations- Part1
Java Custom Annotations- Part1
 
Styled components presentation
Styled components presentationStyled components presentation
Styled components presentation
 

Ähnlich wie Aspect-Oriented Programming

Spring aop concepts
Spring aop conceptsSpring aop concepts
Spring aop conceptsRushiBShah
 
Introduction to aop
Introduction to aopIntroduction to aop
Introduction to aopDror Helper
 
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020Andrzej Jóźwiak
 
45 aop-programming
45 aop-programming45 aop-programming
45 aop-programmingdaotuan85
 
Generalized Functors - Realizing Command Design Pattern in C++
Generalized Functors - Realizing Command Design Pattern in C++Generalized Functors - Realizing Command Design Pattern in C++
Generalized Functors - Realizing Command Design Pattern in C++ppd1961
 
Ruslan Platonov - Transactions
Ruslan Platonov - TransactionsRuslan Platonov - Transactions
Ruslan Platonov - TransactionsDmitry Buzdin
 
МАКСИМ БАРВІНСЬКИЙ «AspectJ in Test Automation.» Lviv QA Day 2019
МАКСИМ БАРВІНСЬКИЙ «AspectJ in Test Automation.»  Lviv QA Day 2019МАКСИМ БАРВІНСЬКИЙ «AspectJ in Test Automation.»  Lviv QA Day 2019
МАКСИМ БАРВІНСЬКИЙ «AspectJ in Test Automation.» Lviv QA Day 2019GoQA
 
Mastering Mock Objects - Advanced Unit Testing for Java
Mastering Mock Objects - Advanced Unit Testing for JavaMastering Mock Objects - Advanced Unit Testing for Java
Mastering Mock Objects - Advanced Unit Testing for JavaDenilson Nastacio
 
Spring AOP @ DevClub.eu
Spring AOP @ DevClub.euSpring AOP @ DevClub.eu
Spring AOP @ DevClub.euarsenikum
 
OORPT Dynamic Analysis
OORPT Dynamic AnalysisOORPT Dynamic Analysis
OORPT Dynamic Analysislienhard
 
Production Time Profiling and Diagnostics on the JVM
Production Time Profiling and Diagnostics on the JVMProduction Time Profiling and Diagnostics on the JVM
Production Time Profiling and Diagnostics on the JVMMarcus Hirt
 
닷넷 개발자를 위한 패턴이야기
닷넷 개발자를 위한 패턴이야기닷넷 개발자를 위한 패턴이야기
닷넷 개발자를 위한 패턴이야기YoungSu Son
 
Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipseanshunjain
 
Scorex, the Modular Blockchain Framework
Scorex, the Modular Blockchain FrameworkScorex, the Modular Blockchain Framework
Scorex, the Modular Blockchain FrameworkAlex Chepurnoy
 
Intoduction to Play Framework
Intoduction to Play FrameworkIntoduction to Play Framework
Intoduction to Play FrameworkKnoldus Inc.
 
EclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling FrameworkEclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling FrameworkDave Steinberg
 
香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideShare香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideShareyayao
 
Handling Exceptions In C &amp; C++ [Part B] Ver 2
Handling Exceptions In C &amp; C++ [Part B] Ver 2Handling Exceptions In C &amp; C++ [Part B] Ver 2
Handling Exceptions In C &amp; C++ [Part B] Ver 2ppd1961
 

Ähnlich wie Aspect-Oriented Programming (20)

Spring aop concepts
Spring aop conceptsSpring aop concepts
Spring aop concepts
 
Aop spring
Aop springAop spring
Aop spring
 
Introduction to aop
Introduction to aopIntroduction to aop
Introduction to aop
 
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
Do I need tests when I have the compiler - Andrzej Jóźwiak - TomTom Dev Day 2020
 
45 aop-programming
45 aop-programming45 aop-programming
45 aop-programming
 
Generalized Functors - Realizing Command Design Pattern in C++
Generalized Functors - Realizing Command Design Pattern in C++Generalized Functors - Realizing Command Design Pattern in C++
Generalized Functors - Realizing Command Design Pattern in C++
 
Ruslan Platonov - Transactions
Ruslan Platonov - TransactionsRuslan Platonov - Transactions
Ruslan Platonov - Transactions
 
МАКСИМ БАРВІНСЬКИЙ «AspectJ in Test Automation.» Lviv QA Day 2019
МАКСИМ БАРВІНСЬКИЙ «AspectJ in Test Automation.»  Lviv QA Day 2019МАКСИМ БАРВІНСЬКИЙ «AspectJ in Test Automation.»  Lviv QA Day 2019
МАКСИМ БАРВІНСЬКИЙ «AspectJ in Test Automation.» Lviv QA Day 2019
 
Mastering Mock Objects - Advanced Unit Testing for Java
Mastering Mock Objects - Advanced Unit Testing for JavaMastering Mock Objects - Advanced Unit Testing for Java
Mastering Mock Objects - Advanced Unit Testing for Java
 
C# 6.0 Preview
C# 6.0 PreviewC# 6.0 Preview
C# 6.0 Preview
 
Spring AOP @ DevClub.eu
Spring AOP @ DevClub.euSpring AOP @ DevClub.eu
Spring AOP @ DevClub.eu
 
OORPT Dynamic Analysis
OORPT Dynamic AnalysisOORPT Dynamic Analysis
OORPT Dynamic Analysis
 
Production Time Profiling and Diagnostics on the JVM
Production Time Profiling and Diagnostics on the JVMProduction Time Profiling and Diagnostics on the JVM
Production Time Profiling and Diagnostics on the JVM
 
닷넷 개발자를 위한 패턴이야기
닷넷 개발자를 위한 패턴이야기닷넷 개발자를 위한 패턴이야기
닷넷 개발자를 위한 패턴이야기
 
Understanding Framework Architecture using Eclipse
Understanding Framework Architecture using EclipseUnderstanding Framework Architecture using Eclipse
Understanding Framework Architecture using Eclipse
 
Scorex, the Modular Blockchain Framework
Scorex, the Modular Blockchain FrameworkScorex, the Modular Blockchain Framework
Scorex, the Modular Blockchain Framework
 
Intoduction to Play Framework
Intoduction to Play FrameworkIntoduction to Play Framework
Intoduction to Play Framework
 
EclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling FrameworkEclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
EclipseCon 2008: Fundamentals of the Eclipse Modeling Framework
 
香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideShare香港六合彩 &raquo; SlideShare
香港六合彩 &raquo; SlideShare
 
Handling Exceptions In C &amp; C++ [Part B] Ver 2
Handling Exceptions In C &amp; C++ [Part B] Ver 2Handling Exceptions In C &amp; C++ [Part B] Ver 2
Handling Exceptions In C &amp; C++ [Part B] Ver 2
 

Aspect-Oriented Programming