SlideShare a Scribd company logo
Aspect-Oriented
Programming
How can aspects clean your code?
Basia Fusińska
About me
Aspect-Oriented ProgrammingHow can aspects clean your code? 2
@basiafusinska
Programmer
Architect
Coach
Manager
Teacher
Trainer
Agenda
3
❖ What the hell...are aspects?
❖ Some examples of AOP
❖ Demo 1: refactor your way to aspects
❖ Every-day aspects
❖ Demo 2: some not-so-obvious aspects
❖ How to test aspects
❖ Demo 3: testing in practice
❖ Q & A
How can aspects clean your code?Aspect-Oriented Programming
Some history
4
❖ Gregor Kiczales (1997), Xerox PARC
❖ OOP is unable to solve some common problems
❖ Aspects encapsulate cross-cutting concerns and make them easier to reuse
How can aspects clean your code?Aspect-Oriented Programming
Cross cutting concerns
5
❖ Cross-cutting concerns are scattered throughout the code
❖ Code becomes difficult to develop and modify
❖ Code breaks the Single Responsibility Principle
How can aspects clean your code?Aspect-Oriented Programming
Cross-cutting concerns are everywhere!
7
❖ Logging
❖ Validation
❖ Persistence
❖ Caching
❖ Synchronization
❖ Transactions
❖ Exception handling
❖ Authentication
❖ Authorization
❖ ...
How can aspects clean your code?Aspect-Oriented Programming
What the heck are aspects?
6
❖ Purpose: cross-cutting concerns – pieces of functionality used across multiple
parts of a system
❖ Job: the advice – code that performs cross-cutting concern
❖ Map: pointcut – set of joinpoints
❖ How: weaving
How can aspects clean your code?Aspect-Oriented Programming
How it works?
6How can aspects clean your code?Aspect-Oriented Programming
Types of advices?
6How can aspects clean your code?Aspect-Oriented Programming
❖ Entry
❖ Exit
❖ Exception
❖ Success
❖ Around
❖ Method boundaries vs method interceptions
Some benefits of AOP
8
❖ Code is cleaner
❖ DRY (Don’t Repeat Yourself): promotes code reuse
❖ Better encapsulation
How can aspects clean your code?Aspect-Oriented Programming
9How can aspects clean your code?Aspect-Oriented Programming
Demonstration #1
Refactor your way to aspects
You’ve been using AOP without knowing it
10
❖ IHttpModule - requests boundary aspects
❖ IActionFilter - code run before and after the action execution
❖ ASP.Net MVC Authentication - AuthorizeAttribute
❖ Actions per request (Session Open/Close, ORM changes saving)
How can aspects clean your code?Aspect-Oriented Programming
11How can aspects clean your code?Aspect-Oriented Programming
Demonstration #2
Some not-so-obvious aspects
Testing aspects
12
❖ Testing the pointcut – testing if aspects were used in correct places
❖ Testing the advice – testing if the aspects are doing what they are supposed
to do
How can aspects clean your code?Aspect-Oriented Programming
13How can aspects clean your code?Aspect-Oriented Programming
Demonstration #3
Testing aspects
Thank you :)
Any questions?
@basiafusinska
getbase.com/careers
basia.fusinska@getbase.com
itblogs.pl/coldfusion

More Related Content

PPTX
How aspects clean your code
PDF
Pair Programming (2015)
PDF
GDCR15 in Las Palmas, Gran Canaria
PPTX
Polar talks: code generation
PPTX
Code Quality Assurance
PPTX
Coding Standard And Code Review
PDF
TSC Summit #3 - Reverse engineering and anti debugging techniques
ODP
Java interfaces design perspective
How aspects clean your code
Pair Programming (2015)
GDCR15 in Las Palmas, Gran Canaria
Polar talks: code generation
Code Quality Assurance
Coding Standard And Code Review
TSC Summit #3 - Reverse engineering and anti debugging techniques
Java interfaces design perspective

What's hot (20)

PDF
Code Quality Assurance v4 (2013)
PPT
Code Quality
PDF
Coding Dojo: Mars Rover (2014)
PPT
Jug dynamic languages_in_jvm
PPTX
Java Code Quality Tools
PPTX
Aspect Oriented Programing - Introduction
PPTX
Componentize! by Lancer Kind XP Conference 2016
PPTX
Dvm internals intro
PDF
Letter to a Junior Developer: The Engineering Side of Programming
PDF
Understand Java for Android the Hard Way
ODP
Review june2014 june2015
ODP
Devoxx 2013 Summary/Keynotes
PDF
Coding Dojo: Bank OCR Outside-In (2015)
PDF
Software Craftsmanship Journeyman Tour (2013)
PDF
Coding Dojo: Functional Calisthenics (2016)
PDF
Idiomatic R for Rosetta Code (2013)
PPTX
Building domain-specific languages with Groovy
PDF
Extract Method Refactoring Workshop (2016)
ODP
TypeScript
Code Quality Assurance v4 (2013)
Code Quality
Coding Dojo: Mars Rover (2014)
Jug dynamic languages_in_jvm
Java Code Quality Tools
Aspect Oriented Programing - Introduction
Componentize! by Lancer Kind XP Conference 2016
Dvm internals intro
Letter to a Junior Developer: The Engineering Side of Programming
Understand Java for Android the Hard Way
Review june2014 june2015
Devoxx 2013 Summary/Keynotes
Coding Dojo: Bank OCR Outside-In (2015)
Software Craftsmanship Journeyman Tour (2013)
Coding Dojo: Functional Calisthenics (2016)
Idiomatic R for Rosetta Code (2013)
Building domain-specific languages with Groovy
Extract Method Refactoring Workshop (2016)
TypeScript
Ad

Viewers also liked (20)

PPTX
Nie rozwiązuj w testach jednostkowych problemów z testowanym kodem.
PDF
[QE 2015] Jarosław Pałka - Systematyczny architekt na drodze ku planowanemu p...
PPSX
Wyboista droga do dobrego kodu. ...
PPTX
Jakość jest w nas
PDF
DailyArt – jak zaprojektować aplikację mobilną kochaną przez ludzi?/WUD Siles...
PDF
Coś zupełnie offline: badania etnograficzne są kluczem do skutecznego zaangaż...
PPTX
[QE 2015] Katarzyna Mrowca - Refaktoring historyjek
PDF
Testy to za mało – czyli słów kilka o jakości w oprogramowaniu: czym jest, ja...
PPTX
Behaviour Driven Development
PPTX
Koncert życzeń + niekończące się zmiany w koncepcji = katastrofa? Jak to posk...
PPTX
[FDD 2016] Krzysztof Bartnicki - Wszechświat kontra programista systemów wbud...
PPTX
Bilans korzyści i kosztów z automatyzacji.
PPTX
Czy warstwa sprzętowa wyklucza testy automatyczne?
PDF
Wydajne API dla aplikacji mobilnych
PPTX
TDD – w poszukiwaniu źródeł jakości.
PDF
Michał Sajdak, Testy bezpieczeństwa -­‐ teoria a praktyka
PPTX
Kim jest Agile Coach?
PPTX
Biznes nie dorósł do Agile.
PDF
[QE 2015] Krzysztof Trzewiczek - Specification by Example w praktyce
PDF
[QE 2015] Mateusz Kocielski - W każdym programie jest jeszcze jeden błąd
Nie rozwiązuj w testach jednostkowych problemów z testowanym kodem.
[QE 2015] Jarosław Pałka - Systematyczny architekt na drodze ku planowanemu p...
Wyboista droga do dobrego kodu. ...
Jakość jest w nas
DailyArt – jak zaprojektować aplikację mobilną kochaną przez ludzi?/WUD Siles...
Coś zupełnie offline: badania etnograficzne są kluczem do skutecznego zaangaż...
[QE 2015] Katarzyna Mrowca - Refaktoring historyjek
Testy to za mało – czyli słów kilka o jakości w oprogramowaniu: czym jest, ja...
Behaviour Driven Development
Koncert życzeń + niekończące się zmiany w koncepcji = katastrofa? Jak to posk...
[FDD 2016] Krzysztof Bartnicki - Wszechświat kontra programista systemów wbud...
Bilans korzyści i kosztów z automatyzacji.
Czy warstwa sprzętowa wyklucza testy automatyczne?
Wydajne API dla aplikacji mobilnych
TDD – w poszukiwaniu źródeł jakości.
Michał Sajdak, Testy bezpieczeństwa -­‐ teoria a praktyka
Kim jest Agile Coach?
Biznes nie dorósł do Agile.
[QE 2015] Krzysztof Trzewiczek - Specification by Example w praktyce
[QE 2015] Mateusz Kocielski - W każdym programie jest jeszcze jeden błąd
Ad

Similar to Jak aspekty uporządkują twój kod. (20)

PDF
Solve cross cutting concerns with aspect oriented programming (aop)
PPTX
How to define an api
PPTX
How to Embed Codeless Test Automation Into DevOps
PPTX
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
PDF
Quick Intro to Clean Coding
PPTX
Linters for frontend code review
PDF
How to Design a Good API and Why it Matters.pdf
PDF
Be armed to the teeth to maintain a high quality iOS code
PDF
The View - Lotusscript coding best practices
PPTX
While You Are Coding
PPT
Aspect Oriented Programming
PDF
Software Defect Prevention via Continuous Inspection
PPT
Reverse engineering
ODP
Dealing With Legacy: The Real-World Experience
PPTX
Introduction to Aspect Oriented Programming (DDD South West 4.0)
PPTX
Software testing and quality assurance
PDF
BDD in Java using Cucumber
PDF
The View - 30 proven Lotuscript tips
PDF
Developer Job in Practice
PPTX
Build software like a bag of marbles, not a castle of LEGO®
Solve cross cutting concerns with aspect oriented programming (aop)
How to define an api
How to Embed Codeless Test Automation Into DevOps
2R-3KS03-OOP_UNIT-I (Part-A)_2023-24.pptx
Quick Intro to Clean Coding
Linters for frontend code review
How to Design a Good API and Why it Matters.pdf
Be armed to the teeth to maintain a high quality iOS code
The View - Lotusscript coding best practices
While You Are Coding
Aspect Oriented Programming
Software Defect Prevention via Continuous Inspection
Reverse engineering
Dealing With Legacy: The Real-World Experience
Introduction to Aspect Oriented Programming (DDD South West 4.0)
Software testing and quality assurance
BDD in Java using Cucumber
The View - 30 proven Lotuscript tips
Developer Job in Practice
Build software like a bag of marbles, not a castle of LEGO®

More from Future Processing (20)

PDF
DPTO_Inżynieria oprogramowania to proces uczenia się.pdf
PDF
DPTO_QA w świecie wartości biznesowych.pdf
PDF
DPTO_Hello_Clean_Architekture.pdf
PDF
[Quality Meetup #20] Michał Górski - Continuous Deployment w chmurze
PDF
[Quality Meetup #20] Dorota Tadych - Hyperion - wystarczy jeden shake
PDF
[Quality Meetup #19] Magdalena Drechsler-Nowak - Tester w pułapce myślenia
PDF
[Quality Meetup #19] Adrian Gonciarz - Testerska ruletka
PDF
[FDD 2018] Krzysztof Sikora - Jak Service Fabric rozwiąże twoje problemy z mi...
PDF
[FDD 2018] Ł. Turchan, A. Hulist, M. Duchnowski - CUDA - results over coffee ...
PDF
[FDD 2018] Lech Kalinowski - Prywatny Blockchain
PPTX
[FDD 2018] W. Malara, K. Kotowski - Autoenkodery – czyli zalety funkcji F(X)≈X
PPTX
[FDD 2018] Jarosław Ogiegło - Ludzie, zabezpieczajcie się! Wprowadzenie do OA...
PDF
[JuraSIC! Meetup] Krzysztof Sikora- Jak Service Fabric rozwiąże twoje problem...
PDF
[JuraSIC! Meetup] Mateusz Stasch - Monady w .NET
PDF
[QE 2018] Aleksandra Kornecka – Kognitywne podejście do testowania aplikacji ...
PDF
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
PDF
[QE 2018] Łukasz Gawron – Testing Batch and Streaming Spark Applications
PDF
[QE 2018] Marek Puchalski – Web Application Security Test Automation
PDF
[QE 2018] Rob Lambert – How to Thrive as a Software Tester
PDF
[QE 2018] Paul Gerrard – Automating Assurance: Tools, Collaboration and DevOps
DPTO_Inżynieria oprogramowania to proces uczenia się.pdf
DPTO_QA w świecie wartości biznesowych.pdf
DPTO_Hello_Clean_Architekture.pdf
[Quality Meetup #20] Michał Górski - Continuous Deployment w chmurze
[Quality Meetup #20] Dorota Tadych - Hyperion - wystarczy jeden shake
[Quality Meetup #19] Magdalena Drechsler-Nowak - Tester w pułapce myślenia
[Quality Meetup #19] Adrian Gonciarz - Testerska ruletka
[FDD 2018] Krzysztof Sikora - Jak Service Fabric rozwiąże twoje problemy z mi...
[FDD 2018] Ł. Turchan, A. Hulist, M. Duchnowski - CUDA - results over coffee ...
[FDD 2018] Lech Kalinowski - Prywatny Blockchain
[FDD 2018] W. Malara, K. Kotowski - Autoenkodery – czyli zalety funkcji F(X)≈X
[FDD 2018] Jarosław Ogiegło - Ludzie, zabezpieczajcie się! Wprowadzenie do OA...
[JuraSIC! Meetup] Krzysztof Sikora- Jak Service Fabric rozwiąże twoje problem...
[JuraSIC! Meetup] Mateusz Stasch - Monady w .NET
[QE 2018] Aleksandra Kornecka – Kognitywne podejście do testowania aplikacji ...
[QE 2018] Adam Stasiak – Nadchodzi React Native – czyli o testowaniu mobilnyc...
[QE 2018] Łukasz Gawron – Testing Batch and Streaming Spark Applications
[QE 2018] Marek Puchalski – Web Application Security Test Automation
[QE 2018] Rob Lambert – How to Thrive as a Software Tester
[QE 2018] Paul Gerrard – Automating Assurance: Tools, Collaboration and DevOps

Recently uploaded (20)

DOCX
The AUB Centre for AI in Media Proposal.docx
PPT
Teaching material agriculture food technology
PPTX
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
PDF
Chapter 3 Spatial Domain Image Processing.pdf
PDF
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
PDF
Unlocking AI with Model Context Protocol (MCP)
PDF
Review of recent advances in non-invasive hemoglobin estimation
PDF
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
PPTX
Digital-Transformation-Roadmap-for-Companies.pptx
PDF
Building Integrated photovoltaic BIPV_UPV.pdf
PPTX
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
PDF
Advanced methodologies resolving dimensionality complications for autism neur...
PPTX
sap open course for s4hana steps from ECC to s4
PDF
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
PDF
Machine learning based COVID-19 study performance prediction
PDF
Diabetes mellitus diagnosis method based random forest with bat algorithm
PDF
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
PDF
Electronic commerce courselecture one. Pdf
PDF
Mobile App Security Testing_ A Comprehensive Guide.pdf
PDF
NewMind AI Weekly Chronicles - August'25 Week I
The AUB Centre for AI in Media Proposal.docx
Teaching material agriculture food technology
Effective Security Operations Center (SOC) A Modern, Strategic, and Threat-In...
Chapter 3 Spatial Domain Image Processing.pdf
Peak of Data & AI Encore- AI for Metadata and Smarter Workflows
Unlocking AI with Model Context Protocol (MCP)
Review of recent advances in non-invasive hemoglobin estimation
7 ChatGPT Prompts to Help You Define Your Ideal Customer Profile.pdf
Digital-Transformation-Roadmap-for-Companies.pptx
Building Integrated photovoltaic BIPV_UPV.pdf
ACSFv1EN-58255 AWS Academy Cloud Security Foundations.pptx
Advanced methodologies resolving dimensionality complications for autism neur...
sap open course for s4hana steps from ECC to s4
Architecting across the Boundaries of two Complex Domains - Healthcare & Tech...
Machine learning based COVID-19 study performance prediction
Diabetes mellitus diagnosis method based random forest with bat algorithm
Blue Purple Modern Animated Computer Science Presentation.pdf.pdf
Electronic commerce courselecture one. Pdf
Mobile App Security Testing_ A Comprehensive Guide.pdf
NewMind AI Weekly Chronicles - August'25 Week I

Jak aspekty uporządkują twój kod.

  • 1. Aspect-Oriented Programming How can aspects clean your code? Basia Fusińska
  • 2. About me Aspect-Oriented ProgrammingHow can aspects clean your code? 2 @basiafusinska Programmer Architect Coach Manager Teacher Trainer
  • 3. Agenda 3 ❖ What the hell...are aspects? ❖ Some examples of AOP ❖ Demo 1: refactor your way to aspects ❖ Every-day aspects ❖ Demo 2: some not-so-obvious aspects ❖ How to test aspects ❖ Demo 3: testing in practice ❖ Q & A How can aspects clean your code?Aspect-Oriented Programming
  • 4. Some history 4 ❖ Gregor Kiczales (1997), Xerox PARC ❖ OOP is unable to solve some common problems ❖ Aspects encapsulate cross-cutting concerns and make them easier to reuse How can aspects clean your code?Aspect-Oriented Programming
  • 5. Cross cutting concerns 5 ❖ Cross-cutting concerns are scattered throughout the code ❖ Code becomes difficult to develop and modify ❖ Code breaks the Single Responsibility Principle How can aspects clean your code?Aspect-Oriented Programming
  • 6. Cross-cutting concerns are everywhere! 7 ❖ Logging ❖ Validation ❖ Persistence ❖ Caching ❖ Synchronization ❖ Transactions ❖ Exception handling ❖ Authentication ❖ Authorization ❖ ... How can aspects clean your code?Aspect-Oriented Programming
  • 7. What the heck are aspects? 6 ❖ Purpose: cross-cutting concerns – pieces of functionality used across multiple parts of a system ❖ Job: the advice – code that performs cross-cutting concern ❖ Map: pointcut – set of joinpoints ❖ How: weaving How can aspects clean your code?Aspect-Oriented Programming
  • 8. How it works? 6How can aspects clean your code?Aspect-Oriented Programming
  • 9. Types of advices? 6How can aspects clean your code?Aspect-Oriented Programming ❖ Entry ❖ Exit ❖ Exception ❖ Success ❖ Around ❖ Method boundaries vs method interceptions
  • 10. Some benefits of AOP 8 ❖ Code is cleaner ❖ DRY (Don’t Repeat Yourself): promotes code reuse ❖ Better encapsulation How can aspects clean your code?Aspect-Oriented Programming
  • 11. 9How can aspects clean your code?Aspect-Oriented Programming Demonstration #1 Refactor your way to aspects
  • 12. You’ve been using AOP without knowing it 10 ❖ IHttpModule - requests boundary aspects ❖ IActionFilter - code run before and after the action execution ❖ ASP.Net MVC Authentication - AuthorizeAttribute ❖ Actions per request (Session Open/Close, ORM changes saving) How can aspects clean your code?Aspect-Oriented Programming
  • 13. 11How can aspects clean your code?Aspect-Oriented Programming Demonstration #2 Some not-so-obvious aspects
  • 14. Testing aspects 12 ❖ Testing the pointcut – testing if aspects were used in correct places ❖ Testing the advice – testing if the aspects are doing what they are supposed to do How can aspects clean your code?Aspect-Oriented Programming
  • 15. 13How can aspects clean your code?Aspect-Oriented Programming Demonstration #3 Testing aspects
  • 16. Thank you :) Any questions? @basiafusinska getbase.com/careers basia.fusinska@getbase.com itblogs.pl/coldfusion