SlideShare a Scribd company logo
1 of 26
Introduction 
to AOP
Programming paradigm 
which aims to increase modularity 
by allowing the separation of 
cross-cutting concerns 
en.wikipedia.org/wiki/aspect-oriented-programming
Programming Paradigm 
It is *NOT* 
- a programming language 
- solution to all your problems 
- a first class citizen in Java 
or .NET 
- a replacement for OOP 
It is 
- a programming pattern 
- a tool in your toolbox 
- an easily added language 
feature 
- complimentary to OOP
Modularity 
Aspects can… 
• Exist in isolated and encapsulated constructs 
• Be attached to almost any standard code construct 
• Be transported between projects
Cross-Cutting Concerns 
…aspects of a program that affect other concerns. 
These concerns often cannot be cleanly decomposed 
from the rest of the system in both the design and 
implementation, 
and can result in either scattering (code duplication), 
tangling (significant dependencies between systems), 
or both. 
http://en.wikipedia.org/wiki/Cross-cutting_concern
…more simply 
Any code functionality that repeats itself in a regular 
pattern across many unrelated tiers/layers within a 
codebase.
Cross-Cutting Concerns 
View 
ViewModel 
Model 
Services 
Domain Model 
Repositories 
Logging 
Security 
Auditing 
Validation 
INotifyPropertyChanged 
Undo/Redo 
Thread Management 
Unit of Work Management 
Circuit Breaker
AOP Styles 
1. Interception 
Interjecting the execution of cross-cutting concerns at 
run time. 
Non-invasive approach to modifying the code execution 
path. 
2. IL Weaving 
Interjecting the planned execution of cross-cutting 
concerns during the compilation process. 
Invasive approach to modifying the code execution 
path.
Interception 
• Existing in IoC container implementations 
• Follows a very strict decorator pattern 
• Likely implemented using weak typing 
• Run-time operation 
• Can be applied en-masse 
• Easy to implement if you’re already using IoC
Decorator Pattern 
//new functionality before 
//the code that already exists 
//new functionality after 
//exception handling
Weak Typing
En-masse Attachment
IL Weaving 
• Post compilation process 
• Alters the assembly/executable at an IL level 
• Scary to people 
• Can be attached to almost every code construct 
• Very rare that it required changes to existing code 
• Run and compile time operations 
• Can be much easier to add to legacy code
The Process 
Write Code 
Compile 
Application exe/dll 
AOP post 
compiler/weaver 
Throw 
compile-time 
error 
Deploy exe/dll
Constructs 
• Methods (private/public/internal/etc) 
• Properties 
• Field level variables 
• Events 
• Event registration/de-registration 
• Code generation
Run Time vs Compile Time 
Run Time 
• All aspect code executes in application context 
Compile Time 
• Code can be designated to run during post-compilation 
• Compilation can fail for correct syntaxes but incorrect 
business logic
Tooling 
• Interception 
• Castle Winsdor 
• StructureMap 
• Ninject (with Ninject.Extensions) 
• AutoFac (with Autofac.Extras) 
• IL Weaving 
• PostSharp (current) 
• LinFu
The Traditional Arguments Against AOP 
• It is “magic” 
• We won’t be able to debug properly 
• How do we know where aspects will be executed? 
• It’s another thing we have to learn 
• Changing the aspect will break the entire application
“Its magic!” & “We can’t debug it!” 
• Both interception and IL weaving provide full line-by-line 
debugging 
• Attachment of aspects is explicit as you want it to be
“But which aspect(s) will run?” 
• This is a tooling/discoverability problem, not a problem with 
AOP itself 
• PostSharp has very good VS integration showing what aspects 
are attached to a piece of code 
• Interceptor discoverability is a bigger problem
“Its another thing we have to learn” 
Is it worse if we train them and 
they leave or if we don’t train 
them and they stay?
“Changing the aspect can break the 
entire application!” 
• You can probably do that in an number of different ways with 
any codebase that doesn’t use AOP 
• This is a problem caused by tight coupling and poor separation 
of concerns
Your Project is Already Established… 
You use IoC 
• For logging, caching and possibly transaction management use 
interception 
• If the cross cutting concerns are more complex (Undo/Redo, 
thread management) use IL Weaving 
You don’t use IoC 
• The only real option is to use IL Weaving
You’re Starting a New Project… 
You have AOP buy-in from senior developers 
• Start with IL Weaving, but start with simple, pre-built aspects 
• Write custom aspects as experience and need grows 
AOP is still unknown to the senior people on the team 
• Start with IL Weaving, but start in a very isolated manner 
• Use this as a proof of concept until you have senior level buy-in
gracias 
Donald Belcham 
@dbelcham 
donald.belcham@igloocoder.com

More Related Content

What's hot

La vita nella corsia di sorpasso; A tutta velocità, XPages!
La vita nella corsia di sorpasso; A tutta velocità, XPages!La vita nella corsia di sorpasso; A tutta velocità, XPages!
La vita nella corsia di sorpasso; A tutta velocità, XPages!Ulrich Krause
 
Key considerations for multithreaded architectures in LabVIEW
Key considerations for multithreaded architectures in LabVIEWKey considerations for multithreaded architectures in LabVIEW
Key considerations for multithreaded architectures in LabVIEWPiotr Demski
 
PHP Frameworks, or how I learnt to stop worrying and love the code
PHP Frameworks, or how I learnt to stop worrying and love the codePHP Frameworks, or how I learnt to stop worrying and love the code
PHP Frameworks, or how I learnt to stop worrying and love the codeMichal Juhas
 
Power-Up Your Test Suite with OLE Automation by Joshua Russell
Power-Up Your Test Suite with OLE Automation by Joshua RussellPower-Up Your Test Suite with OLE Automation by Joshua Russell
Power-Up Your Test Suite with OLE Automation by Joshua RussellQA or the Highway
 
Behaviour testing for single-page applications and API’s
Behaviour testing for single-page applications and API’sBehaviour testing for single-page applications and API’s
Behaviour testing for single-page applications and API’sAndrew Kirkpatrick
 
Ten Advices for Architects
Ten Advices for ArchitectsTen Advices for Architects
Ten Advices for ArchitectsEberhard Wolff
 
Accelerating time to delivery modern tools for cobol development
Accelerating time to delivery modern tools for cobol developmentAccelerating time to delivery modern tools for cobol development
Accelerating time to delivery modern tools for cobol developmentMicro Focus
 
Containerizing legacy applications
Containerizing legacy applicationsContainerizing legacy applications
Containerizing legacy applicationsAndrew Kirkpatrick
 
Robot Framework with actual robot
Robot Framework with actual robot Robot Framework with actual robot
Robot Framework with actual robot Eficode
 
Entity Framework: To the Unit of Work Design Pattern and Beyond
Entity Framework: To the Unit of Work Design Pattern and BeyondEntity Framework: To the Unit of Work Design Pattern and Beyond
Entity Framework: To the Unit of Work Design Pattern and BeyondSteve Westgarth
 
Next Level Unit Testing - Javacro 2019 - Dominik Poljak
Next Level Unit Testing - Javacro 2019 - Dominik PoljakNext Level Unit Testing - Javacro 2019 - Dominik Poljak
Next Level Unit Testing - Javacro 2019 - Dominik PoljakDominik Poljak
 
Belfast Selenium Meetup
Belfast Selenium MeetupBelfast Selenium Meetup
Belfast Selenium MeetupJustin Ison
 
Helpful Automation Techniques - Selenium Camp 2014
Helpful Automation Techniques - Selenium Camp 2014Helpful Automation Techniques - Selenium Camp 2014
Helpful Automation Techniques - Selenium Camp 2014Justin Ison
 
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...seleniumconf
 
DCAST Meetup - Washington, DC Feb 2016
DCAST Meetup - Washington, DC Feb 2016DCAST Meetup - Washington, DC Feb 2016
DCAST Meetup - Washington, DC Feb 2016Justin Ison
 
Test-driven development with Node.js
Test-driven development with Node.jsTest-driven development with Node.js
Test-driven development with Node.jsMirko Kiefer
 
Improving the Quality of Existing Software
Improving the Quality of Existing SoftwareImproving the Quality of Existing Software
Improving the Quality of Existing SoftwareSteven Smith
 
Zero redeployment with JRebel
Zero redeployment with JRebelZero redeployment with JRebel
Zero redeployment with JRebelMinh Hoang
 

What's hot (20)

La vita nella corsia di sorpasso; A tutta velocità, XPages!
La vita nella corsia di sorpasso; A tutta velocità, XPages!La vita nella corsia di sorpasso; A tutta velocità, XPages!
La vita nella corsia di sorpasso; A tutta velocità, XPages!
 
Key considerations for multithreaded architectures in LabVIEW
Key considerations for multithreaded architectures in LabVIEWKey considerations for multithreaded architectures in LabVIEW
Key considerations for multithreaded architectures in LabVIEW
 
PHP Frameworks, or how I learnt to stop worrying and love the code
PHP Frameworks, or how I learnt to stop worrying and love the codePHP Frameworks, or how I learnt to stop worrying and love the code
PHP Frameworks, or how I learnt to stop worrying and love the code
 
Power-Up Your Test Suite with OLE Automation by Joshua Russell
Power-Up Your Test Suite with OLE Automation by Joshua RussellPower-Up Your Test Suite with OLE Automation by Joshua Russell
Power-Up Your Test Suite with OLE Automation by Joshua Russell
 
Behaviour testing for single-page applications and API’s
Behaviour testing for single-page applications and API’sBehaviour testing for single-page applications and API’s
Behaviour testing for single-page applications and API’s
 
Ten Advices for Architects
Ten Advices for ArchitectsTen Advices for Architects
Ten Advices for Architects
 
Accelerating time to delivery modern tools for cobol development
Accelerating time to delivery modern tools for cobol developmentAccelerating time to delivery modern tools for cobol development
Accelerating time to delivery modern tools for cobol development
 
Containerizing legacy applications
Containerizing legacy applicationsContainerizing legacy applications
Containerizing legacy applications
 
Robot Framework with actual robot
Robot Framework with actual robot Robot Framework with actual robot
Robot Framework with actual robot
 
Entity Framework: To the Unit of Work Design Pattern and Beyond
Entity Framework: To the Unit of Work Design Pattern and BeyondEntity Framework: To the Unit of Work Design Pattern and Beyond
Entity Framework: To the Unit of Work Design Pattern and Beyond
 
QAorHighway2016
QAorHighway2016QAorHighway2016
QAorHighway2016
 
Next Level Unit Testing - Javacro 2019 - Dominik Poljak
Next Level Unit Testing - Javacro 2019 - Dominik PoljakNext Level Unit Testing - Javacro 2019 - Dominik Poljak
Next Level Unit Testing - Javacro 2019 - Dominik Poljak
 
Belfast Selenium Meetup
Belfast Selenium MeetupBelfast Selenium Meetup
Belfast Selenium Meetup
 
Helpful Automation Techniques - Selenium Camp 2014
Helpful Automation Techniques - Selenium Camp 2014Helpful Automation Techniques - Selenium Camp 2014
Helpful Automation Techniques - Selenium Camp 2014
 
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
Testing Rapidly Changing Applications With Self-Testing Object-Oriented Selen...
 
DCAST Meetup - Washington, DC Feb 2016
DCAST Meetup - Washington, DC Feb 2016DCAST Meetup - Washington, DC Feb 2016
DCAST Meetup - Washington, DC Feb 2016
 
Test-driven development with Node.js
Test-driven development with Node.jsTest-driven development with Node.js
Test-driven development with Node.js
 
Benefits from AATs
Benefits from AATsBenefits from AATs
Benefits from AATs
 
Improving the Quality of Existing Software
Improving the Quality of Existing SoftwareImproving the Quality of Existing Software
Improving the Quality of Existing Software
 
Zero redeployment with JRebel
Zero redeployment with JRebelZero redeployment with JRebel
Zero redeployment with JRebel
 

Viewers also liked

45 aop-programming
45 aop-programming45 aop-programming
45 aop-programmingdaotuan85
 
ASPECT ORIENTED PROGRAMING(aop)
ASPECT ORIENTED PROGRAMING(aop)ASPECT ORIENTED PROGRAMING(aop)
ASPECT ORIENTED PROGRAMING(aop)kvsrteja
 
Introduction to aop
Introduction to aopIntroduction to aop
Introduction to aopDror Helper
 
AOP - Ideology, Mainstream, and Practice
AOP - Ideology, Mainstream, and PracticeAOP - Ideology, Mainstream, and Practice
AOP - Ideology, Mainstream, and Practiceademelt
 
How to build an AOP framework in ActionScript
How to build an AOP framework in ActionScriptHow to build an AOP framework in ActionScript
How to build an AOP framework in ActionScriptChristophe Herreman
 
Produce Cleaner Code with Aspect-Oriented Programming
Produce Cleaner Code with Aspect-Oriented ProgrammingProduce Cleaner Code with Aspect-Oriented Programming
Produce Cleaner Code with Aspect-Oriented ProgrammingPostSharp Technologies
 

Viewers also liked (7)

45 aop-programming
45 aop-programming45 aop-programming
45 aop-programming
 
ASPECT ORIENTED PROGRAMING(aop)
ASPECT ORIENTED PROGRAMING(aop)ASPECT ORIENTED PROGRAMING(aop)
ASPECT ORIENTED PROGRAMING(aop)
 
Introduction to aop
Introduction to aopIntroduction to aop
Introduction to aop
 
AOP - Ideology, Mainstream, and Practice
AOP - Ideology, Mainstream, and PracticeAOP - Ideology, Mainstream, and Practice
AOP - Ideology, Mainstream, and Practice
 
How to build an AOP framework in ActionScript
How to build an AOP framework in ActionScriptHow to build an AOP framework in ActionScript
How to build an AOP framework in ActionScript
 
Produce Cleaner Code with Aspect-Oriented Programming
Produce Cleaner Code with Aspect-Oriented ProgrammingProduce Cleaner Code with Aspect-Oriented Programming
Produce Cleaner Code with Aspect-Oriented Programming
 
How To Choose a Ceiling Fan
How To Choose a Ceiling FanHow To Choose a Ceiling Fan
How To Choose a Ceiling Fan
 

Similar to Introduction To AOP

10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Molieremfrancis
 
Introduction to Aspect Oriented Programming (DDD South West 4.0)
Introduction to Aspect Oriented Programming (DDD South West 4.0)Introduction to Aspect Oriented Programming (DDD South West 4.0)
Introduction to Aspect Oriented Programming (DDD South West 4.0)Yan Cui
 
Orthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable CodeOrthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable Codersebbe
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET Dmytro Mindra
 
MWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCMWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCUlrich Krause
 
JAVA object oriented programming (oop).ppt
JAVA object oriented programming (oop).pptJAVA object oriented programming (oop).ppt
JAVA object oriented programming (oop).pptAliyaJav
 
An Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesAn Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesUlrich Krause
 
Developing modular Java applications
Developing modular Java applicationsDeveloping modular Java applications
Developing modular Java applicationsJulien Dubois
 
Succeding with the Apache SOA stack
Succeding with the Apache SOA stackSucceding with the Apache SOA stack
Succeding with the Apache SOA stackJohan Edstrom
 
Features of Java.pptx
Features of Java.pptxFeatures of Java.pptx
Features of Java.pptxPeter Jose
 
Starting from scratch in 2017
Starting from scratch in 2017Starting from scratch in 2017
Starting from scratch in 2017Stefano Bonetta
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologiesprakashk453625
 
Java training in bangalore
Java training in bangaloreJava training in bangalore
Java training in bangalorezasi besant
 
Survive the Chaos - S4H151 - SAP TechED Barcelona 2017 - Lecture
Survive the Chaos - S4H151 - SAP TechED Barcelona 2017 - LectureSurvive the Chaos - S4H151 - SAP TechED Barcelona 2017 - Lecture
Survive the Chaos - S4H151 - SAP TechED Barcelona 2017 - LectureRainer Winkler
 
Intro to Microsoft.NET
Intro to Microsoft.NET Intro to Microsoft.NET
Intro to Microsoft.NET rchakra
 

Similar to Introduction To AOP (20)

10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
 
Introduction to Aspect Oriented Programming (DDD South West 4.0)
Introduction to Aspect Oriented Programming (DDD South West 4.0)Introduction to Aspect Oriented Programming (DDD South West 4.0)
Introduction to Aspect Oriented Programming (DDD South West 4.0)
 
The Architect Way
The Architect WayThe Architect Way
The Architect Way
 
Orthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable CodeOrthogonality: A Strategy for Reusable Code
Orthogonality: A Strategy for Reusable Code
 
NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET NetWork - 15.10.2011 - Applied code generation in .NET
NetWork - 15.10.2011 - Applied code generation in .NET
 
MWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVCMWLUG 2015 - An Introduction to MVC
MWLUG 2015 - An Introduction to MVC
 
JAVA object oriented programming (oop).ppt
JAVA object oriented programming (oop).pptJAVA object oriented programming (oop).ppt
JAVA object oriented programming (oop).ppt
 
An Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPagesAn Introduction To Model  View  Controller In XPages
An Introduction To Model  View  Controller In XPages
 
Stackato v6
Stackato v6Stackato v6
Stackato v6
 
Developing modular Java applications
Developing modular Java applicationsDeveloping modular Java applications
Developing modular Java applications
 
Introduction to Spring & Spring BootFramework
Introduction to Spring  & Spring BootFrameworkIntroduction to Spring  & Spring BootFramework
Introduction to Spring & Spring BootFramework
 
Stackato
StackatoStackato
Stackato
 
Succeding with the Apache SOA stack
Succeding with the Apache SOA stackSucceding with the Apache SOA stack
Succeding with the Apache SOA stack
 
Features of Java.pptx
Features of Java.pptxFeatures of Java.pptx
Features of Java.pptx
 
Starting from scratch in 2017
Starting from scratch in 2017Starting from scratch in 2017
Starting from scratch in 2017
 
.net Based Component Technologies
.net Based Component Technologies.net Based Component Technologies
.net Based Component Technologies
 
Java training in bangalore
Java training in bangaloreJava training in bangalore
Java training in bangalore
 
Survive the Chaos - S4H151 - SAP TechED Barcelona 2017 - Lecture
Survive the Chaos - S4H151 - SAP TechED Barcelona 2017 - LectureSurvive the Chaos - S4H151 - SAP TechED Barcelona 2017 - Lecture
Survive the Chaos - S4H151 - SAP TechED Barcelona 2017 - Lecture
 
Javascript best practices
Javascript best practicesJavascript best practices
Javascript best practices
 
Intro to Microsoft.NET
Intro to Microsoft.NET Intro to Microsoft.NET
Intro to Microsoft.NET
 

More from Donald Belcham

Introduction to Messaging
Introduction to MessagingIntroduction to Messaging
Introduction to MessagingDonald Belcham
 
Advanced messaging patterns
Advanced messaging patternsAdvanced messaging patterns
Advanced messaging patternsDonald Belcham
 
Microservices: The Nitty Gritty
Microservices: The Nitty GrittyMicroservices: The Nitty Gritty
Microservices: The Nitty GrittyDonald Belcham
 
Microservices: A Gentle Introduction
Microservices: A Gentle IntroductionMicroservices: A Gentle Introduction
Microservices: A Gentle IntroductionDonald Belcham
 
Source Control Abominations
Source Control AbominationsSource Control Abominations
Source Control AbominationsDonald Belcham
 
Is There Room for Craftsmanship in Software Development
Is There Room for Craftsmanship in Software DevelopmentIs There Room for Craftsmanship in Software Development
Is There Room for Craftsmanship in Software DevelopmentDonald Belcham
 
Reducing External Risk
Reducing External RiskReducing External Risk
Reducing External RiskDonald Belcham
 
Performance Tuning in the Trenches
Performance Tuning in the TrenchesPerformance Tuning in the Trenches
Performance Tuning in the TrenchesDonald Belcham
 
Reliability and Resilience
Reliability and ResilienceReliability and Resilience
Reliability and ResilienceDonald Belcham
 
Reliability and Reslience
Reliability and ReslienceReliability and Reslience
Reliability and ReslienceDonald Belcham
 
Design patterns you didn't know about
Design patterns you didn't know aboutDesign patterns you didn't know about
Design patterns you didn't know aboutDonald Belcham
 
Programming Closer to the Iron
Programming Closer to the IronProgramming Closer to the Iron
Programming Closer to the IronDonald Belcham
 
Taming Brownfield Codebases with AOP
Taming Brownfield Codebases with AOPTaming Brownfield Codebases with AOP
Taming Brownfield Codebases with AOPDonald Belcham
 
Domain Driven Design Primer
Domain Driven Design PrimerDomain Driven Design Primer
Domain Driven Design PrimerDonald Belcham
 
The Dark Side of Code Metrics
The Dark Side of Code MetricsThe Dark Side of Code Metrics
The Dark Side of Code MetricsDonald Belcham
 

More from Donald Belcham (19)

Introduction to Messaging
Introduction to MessagingIntroduction to Messaging
Introduction to Messaging
 
Advanced messaging patterns
Advanced messaging patternsAdvanced messaging patterns
Advanced messaging patterns
 
Microservices: The Nitty Gritty
Microservices: The Nitty GrittyMicroservices: The Nitty Gritty
Microservices: The Nitty Gritty
 
Microservices: A Gentle Introduction
Microservices: A Gentle IntroductionMicroservices: A Gentle Introduction
Microservices: A Gentle Introduction
 
AOP & Patterns
AOP & PatternsAOP & Patterns
AOP & Patterns
 
Source Control Abominations
Source Control AbominationsSource Control Abominations
Source Control Abominations
 
Is There Room for Craftsmanship in Software Development
Is There Room for Craftsmanship in Software DevelopmentIs There Room for Craftsmanship in Software Development
Is There Room for Craftsmanship in Software Development
 
Reducing External Risk
Reducing External RiskReducing External Risk
Reducing External Risk
 
Performance Tuning in the Trenches
Performance Tuning in the TrenchesPerformance Tuning in the Trenches
Performance Tuning in the Trenches
 
Reliability and Resilience
Reliability and ResilienceReliability and Resilience
Reliability and Resilience
 
Reliability and Reslience
Reliability and ReslienceReliability and Reslience
Reliability and Reslience
 
Design patterns you didn't know about
Design patterns you didn't know aboutDesign patterns you didn't know about
Design patterns you didn't know about
 
Programming Closer to the Iron
Programming Closer to the IronProgramming Closer to the Iron
Programming Closer to the Iron
 
Taming Brownfield Codebases with AOP
Taming Brownfield Codebases with AOPTaming Brownfield Codebases with AOP
Taming Brownfield Codebases with AOP
 
Domain Driven Design Primer
Domain Driven Design PrimerDomain Driven Design Primer
Domain Driven Design Primer
 
Hacking Hardware
Hacking HardwareHacking Hardware
Hacking Hardware
 
Advanced AOP
Advanced AOPAdvanced AOP
Advanced AOP
 
The Dark Side of Code Metrics
The Dark Side of Code MetricsThe Dark Side of Code Metrics
The Dark Side of Code Metrics
 
Continuous Deployment
Continuous DeploymentContinuous Deployment
Continuous Deployment
 

Recently uploaded

Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Modelsaagamshah0812
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024Mind IT Systems
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park masabamasaba
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfproinshot.com
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesVictorSzoltysek
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension AidPhilip Schwarz
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfryanfarris8
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfonteinmasabamasaba
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsArshad QA
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providermohitmore19
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfkalichargn70th171
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedDelhi Call girls
 

Recently uploaded (20)

Microsoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdfMicrosoft AI Transformation Partner Playbook.pdf
Microsoft AI Transformation Partner Playbook.pdf
 
Unlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language ModelsUnlocking the Future of AI Agents with Large Language Models
Unlocking the Future of AI Agents with Large Language Models
 
10 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 202410 Trends Likely to Shape Enterprise Technology in 2024
10 Trends Likely to Shape Enterprise Technology in 2024
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICECHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
CHEAP Call Girls in Pushp Vihar (-DELHI )🔝 9953056974🔝(=)/CALL GIRLS SERVICE
 
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park %in kempton park+277-882-255-28 abortion pills for sale in kempton park
%in kempton park+277-882-255-28 abortion pills for sale in kempton park
 
Exploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdfExploring the Best Video Editing App.pdf
Exploring the Best Video Editing App.pdf
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM TechniquesAI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
AI Mastery 201: Elevating Your Workflow with Advanced LLM Techniques
 
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
Direct Style Effect Systems -The Print[A] Example- A Comprehension AidDirect Style Effect Systems -The Print[A] Example- A Comprehension Aid
Direct Style Effect Systems - The Print[A] Example - A Comprehension Aid
 
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdfAzure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
Azure_Native_Qumulo_High_Performance_Compute_Benchmarks.pdf
 
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
%in Stilfontein+277-882-255-28 abortion pills for sale in Stilfontein
 
Software Quality Assurance Interview Questions
Software Quality Assurance Interview QuestionsSoftware Quality Assurance Interview Questions
Software Quality Assurance Interview Questions
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
TECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service providerTECUNIQUE: Success Stories: IT Service provider
TECUNIQUE: Success Stories: IT Service provider
 
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdfPayment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
Payment Gateway Testing Simplified_ A Step-by-Step Guide for Beginners.pdf
 
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verifiedSector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
Sector 18, Noida Call girls :8448380779 Model Escorts | 100% verified
 

Introduction To AOP

  • 2. Programming paradigm which aims to increase modularity by allowing the separation of cross-cutting concerns en.wikipedia.org/wiki/aspect-oriented-programming
  • 3. Programming Paradigm It is *NOT* - a programming language - solution to all your problems - a first class citizen in Java or .NET - a replacement for OOP It is - a programming pattern - a tool in your toolbox - an easily added language feature - complimentary to OOP
  • 4. Modularity Aspects can… • Exist in isolated and encapsulated constructs • Be attached to almost any standard code construct • Be transported between projects
  • 5. Cross-Cutting Concerns …aspects of a program that affect other concerns. These concerns often cannot be cleanly decomposed from the rest of the system in both the design and implementation, and can result in either scattering (code duplication), tangling (significant dependencies between systems), or both. http://en.wikipedia.org/wiki/Cross-cutting_concern
  • 6. …more simply Any code functionality that repeats itself in a regular pattern across many unrelated tiers/layers within a codebase.
  • 7.
  • 8. Cross-Cutting Concerns View ViewModel Model Services Domain Model Repositories Logging Security Auditing Validation INotifyPropertyChanged Undo/Redo Thread Management Unit of Work Management Circuit Breaker
  • 9. AOP Styles 1. Interception Interjecting the execution of cross-cutting concerns at run time. Non-invasive approach to modifying the code execution path. 2. IL Weaving Interjecting the planned execution of cross-cutting concerns during the compilation process. Invasive approach to modifying the code execution path.
  • 10. Interception • Existing in IoC container implementations • Follows a very strict decorator pattern • Likely implemented using weak typing • Run-time operation • Can be applied en-masse • Easy to implement if you’re already using IoC
  • 11. Decorator Pattern //new functionality before //the code that already exists //new functionality after //exception handling
  • 14. IL Weaving • Post compilation process • Alters the assembly/executable at an IL level • Scary to people • Can be attached to almost every code construct • Very rare that it required changes to existing code • Run and compile time operations • Can be much easier to add to legacy code
  • 15. The Process Write Code Compile Application exe/dll AOP post compiler/weaver Throw compile-time error Deploy exe/dll
  • 16. Constructs • Methods (private/public/internal/etc) • Properties • Field level variables • Events • Event registration/de-registration • Code generation
  • 17. Run Time vs Compile Time Run Time • All aspect code executes in application context Compile Time • Code can be designated to run during post-compilation • Compilation can fail for correct syntaxes but incorrect business logic
  • 18. Tooling • Interception • Castle Winsdor • StructureMap • Ninject (with Ninject.Extensions) • AutoFac (with Autofac.Extras) • IL Weaving • PostSharp (current) • LinFu
  • 19. The Traditional Arguments Against AOP • It is “magic” • We won’t be able to debug properly • How do we know where aspects will be executed? • It’s another thing we have to learn • Changing the aspect will break the entire application
  • 20. “Its magic!” & “We can’t debug it!” • Both interception and IL weaving provide full line-by-line debugging • Attachment of aspects is explicit as you want it to be
  • 21. “But which aspect(s) will run?” • This is a tooling/discoverability problem, not a problem with AOP itself • PostSharp has very good VS integration showing what aspects are attached to a piece of code • Interceptor discoverability is a bigger problem
  • 22. “Its another thing we have to learn” Is it worse if we train them and they leave or if we don’t train them and they stay?
  • 23. “Changing the aspect can break the entire application!” • You can probably do that in an number of different ways with any codebase that doesn’t use AOP • This is a problem caused by tight coupling and poor separation of concerns
  • 24. Your Project is Already Established… You use IoC • For logging, caching and possibly transaction management use interception • If the cross cutting concerns are more complex (Undo/Redo, thread management) use IL Weaving You don’t use IoC • The only real option is to use IL Weaving
  • 25. You’re Starting a New Project… You have AOP buy-in from senior developers • Start with IL Weaving, but start with simple, pre-built aspects • Write custom aspects as experience and need grows AOP is still unknown to the senior people on the team • Start with IL Weaving, but start in a very isolated manner • Use this as a proof of concept until you have senior level buy-in
  • 26. gracias Donald Belcham @dbelcham donald.belcham@igloocoder.com