SlideShare a Scribd company logo
1 of 12
Introduction to Aspect Oriented
Programming in .NET with PostSharp
              Zubair Ahmed
        twitter.com/zubairdotnet
             zubairahmed.net
         inbox@zubairahmed.net
Agenda
•   The problem
•   What is AOP?
•   PostSharp
•   Writing Aspects in Visual Studio 2010
•   Learning Resources
The problem
• There was nothing in the beginning
  public class CustomerProcesses
  {
  }
The problem
• Then there was business code
  public class CustomerProcesses
  {
      public void RentBook( int bookId, int customerId )
      {
          Book book = Book.GetById( bookId );
          Customer customer = Customer.GetById( customerId );

          book.RentedTo = customer;
          customer.AccountLines.Add(
           string.Format( "Rental of book {0}.", book ), book.RentalPrice );
          customer.Balance -= book.RentalPrice;
      }
  }
The problem
• Then there was logging and exception handling
  internal class CustomerProcesses
  {
      private static readonly TraceSource trace =
          new TraceSource( typeof (CustomerProcesses).FullName );

          public void RentBook( int bookId, int customerId )
          {
             trace.TraceInformation(
                  "Entering CustomerProcesses.CreateCustomer( bookId = {0},
                   customerId = {1} )",
                  bookId, customerId );
             try
             {
                  Book book = Book.GetById( bookId );
                  Customer customer = Customer.GetById( customerId );

                  book.RentedTo = customer;
                  customer.AccountLines.Add(
                      string.Format( "Rental of book {0}.", book ), book.RentalPrice );
                  customer.Balance -= book.RentalPrice;

                  trace.TraceInformation(
                    "Leaving CustomerProcesses.CreateCustomer( bookId = {0}, customerId = {1} )",
                    bookId, customerId );
              }
              catch ( Exception e )
              {
                  trace.TraceEvent( TraceEventType.Error, 0,
                                    "Exception: CustomerProcesses.CreateCustomer(
                                    bookId = {0}, customerId = {1} ) failed : {2}",
                                    bookId, customerId, e.Message );
                   throw;
              }
      }
  }
The problem
• Then precondition checks
  internal class CustomerProcesses
  {
      private static readonly TraceSource trace =
          new TraceSource(typeof(CustomerProcesses).FullName);

      public void RentBook(int bookId, int customerId)
      {
          if (bookId <= 0) throw new ArgumentOutOfRangeException("bookId");
          if (customerId <= 0) throw new ArgumentOutOfRangeException("customerId");

          trace.TraceInformation(
              "Entering CustomerProcesses.CreateCustomer( bookId = {0}, customerId = {1} )",
              bookId, customerId);

          try
          {
                  . . . .
      }
  }
The problem
• Resulting code is:
  – B oil e r pl a te
  – H ig hl y Coupl e d
What is AOP?
• An approach that extends OOP and addresses the
  issue of Cross -cutting concerns
  – Enca ps ul a te cro s s -cutting co nce rns into As pe cts
  – Im prov e s cod e re us a b il ity, m od ul a rity a nd
    s e pa ra tion of conce rns
  – Re d uce s d e f e cts b y re d ucing b o il e r -pl a te cod e
Identify Cross-cutting concerns
• Ca nnot b e s e pa ra te d into a m od ul e
• Cha l l e ng e to a chie v e s e pa ra tion of conce rns
• Some cros s -cutting co nce rns
   – Exception Handling
   – Caching
   – Tracing
   – Validation
   – Authorization
   – Transactions
PostSharp
• A AOP Framework for .NET
• Works w ith a l l v e rs ions of .N ET
• Inte g ra te s into Vis ua l Stud io
• Supports s ta tic ‘b uil t -tim e ’ w e a v ing
Demo
• Aspects with PostSharp in Visual Studio 2010
Learning Resources
•   sharpcrafters.com/postsharp/documentation/screencasts
•   sharpcrafters.com/postsharp/documentation#blogposts
•   infoq.com/presentations/Advanced -AOP
•   dimecasts.net/Casts/ByTag/PostSharp
My Contacts
• twitter.com/zubairdotnet
• zubairahmed.net
• inbox@zubairahmed.net

More Related Content

Similar to Introduction to Aspect Oriented Programming in .NET with PostSharp by Zubair Ahmed

How to survive in a BASE world
How to survive in a BASE worldHow to survive in a BASE world
How to survive in a BASE worldUwe Friedrichsen
 
In memory OLAP engine
In memory OLAP engineIn memory OLAP engine
In memory OLAP engineWO Community
 
S01 e01 schema-design
S01 e01 schema-designS01 e01 schema-design
S01 e01 schema-designMongoDB
 
W5_Modeling Design Diagram (2) - OBJECT ORIENTED DESIGN.pptx
W5_Modeling Design Diagram (2) - OBJECT ORIENTED DESIGN.pptxW5_Modeling Design Diagram (2) - OBJECT ORIENTED DESIGN.pptx
W5_Modeling Design Diagram (2) - OBJECT ORIENTED DESIGN.pptxemanqaroonibahrain
 
ITB2017 - Intro to Behavior Driven Development
ITB2017 - Intro to Behavior Driven DevelopmentITB2017 - Intro to Behavior Driven Development
ITB2017 - Intro to Behavior Driven DevelopmentOrtus Solutions, Corp
 
SH 1 - SES 8 - Stitch_Overview_TLV.pptx
SH 1 - SES 8 - Stitch_Overview_TLV.pptxSH 1 - SES 8 - Stitch_Overview_TLV.pptx
SH 1 - SES 8 - Stitch_Overview_TLV.pptxMongoDB
 
Webinar: Position and Trade Management with MongoDB
Webinar: Position and Trade Management with MongoDBWebinar: Position and Trade Management with MongoDB
Webinar: Position and Trade Management with MongoDBMongoDB
 
VBA API for scriptDB primer
VBA API for scriptDB primerVBA API for scriptDB primer
VBA API for scriptDB primerBruce McPherson
 
HashiCorp Vault Plugin Infrastructure
HashiCorp Vault Plugin InfrastructureHashiCorp Vault Plugin Infrastructure
HashiCorp Vault Plugin InfrastructureNicolas Corrarello
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedMarcinStachniuk
 
API-Entwicklung bei XING
API-Entwicklung bei XINGAPI-Entwicklung bei XING
API-Entwicklung bei XINGMark Schmidt
 
Power & flexibility of the Google Sheets API
Power & flexibility of the Google Sheets APIPower & flexibility of the Google Sheets API
Power & flexibility of the Google Sheets APIwesley chun
 
LJC Conference 2014 Cassandra for Java Developers
LJC Conference 2014 Cassandra for Java DevelopersLJC Conference 2014 Cassandra for Java Developers
LJC Conference 2014 Cassandra for Java DevelopersChristopher Batey
 
MongoDB at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDCMike Dirolf
 
Cooking your Ravioli "al dente" with Hexagonal Architecture
Cooking your Ravioli "al dente" with Hexagonal ArchitectureCooking your Ravioli "al dente" with Hexagonal Architecture
Cooking your Ravioli "al dente" with Hexagonal ArchitectureJeroen Rosenberg
 
Functional programming in C#
Functional programming in C#Functional programming in C#
Functional programming in C#Thomas Jaskula
 
Using AI to solve business challenges
Using AI to solve business challengesUsing AI to solve business challenges
Using AI to solve business challengesMarvin Heng
 

Similar to Introduction to Aspect Oriented Programming in .NET with PostSharp by Zubair Ahmed (20)

Evolve your coding with some BDD
Evolve your coding with some BDDEvolve your coding with some BDD
Evolve your coding with some BDD
 
How to survive in a BASE world
How to survive in a BASE worldHow to survive in a BASE world
How to survive in a BASE world
 
In memory OLAP engine
In memory OLAP engineIn memory OLAP engine
In memory OLAP engine
 
Super spike
Super spikeSuper spike
Super spike
 
S01 e01 schema-design
S01 e01 schema-designS01 e01 schema-design
S01 e01 schema-design
 
W5_Modeling Design Diagram (2) - OBJECT ORIENTED DESIGN.pptx
W5_Modeling Design Diagram (2) - OBJECT ORIENTED DESIGN.pptxW5_Modeling Design Diagram (2) - OBJECT ORIENTED DESIGN.pptx
W5_Modeling Design Diagram (2) - OBJECT ORIENTED DESIGN.pptx
 
ITB2017 - Intro to Behavior Driven Development
ITB2017 - Intro to Behavior Driven DevelopmentITB2017 - Intro to Behavior Driven Development
ITB2017 - Intro to Behavior Driven Development
 
SH 1 - SES 8 - Stitch_Overview_TLV.pptx
SH 1 - SES 8 - Stitch_Overview_TLV.pptxSH 1 - SES 8 - Stitch_Overview_TLV.pptx
SH 1 - SES 8 - Stitch_Overview_TLV.pptx
 
Webinar: Position and Trade Management with MongoDB
Webinar: Position and Trade Management with MongoDBWebinar: Position and Trade Management with MongoDB
Webinar: Position and Trade Management with MongoDB
 
VBA API for scriptDB primer
VBA API for scriptDB primerVBA API for scriptDB primer
VBA API for scriptDB primer
 
HashiCorp Vault Plugin Infrastructure
HashiCorp Vault Plugin InfrastructureHashiCorp Vault Plugin Infrastructure
HashiCorp Vault Plugin Infrastructure
 
GraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learnedGraphQL - when REST API is not enough - lessons learned
GraphQL - when REST API is not enough - lessons learned
 
API-Entwicklung bei XING
API-Entwicklung bei XINGAPI-Entwicklung bei XING
API-Entwicklung bei XING
 
Power & flexibility of the Google Sheets API
Power & flexibility of the Google Sheets APIPower & flexibility of the Google Sheets API
Power & flexibility of the Google Sheets API
 
LJC Conference 2014 Cassandra for Java Developers
LJC Conference 2014 Cassandra for Java DevelopersLJC Conference 2014 Cassandra for Java Developers
LJC Conference 2014 Cassandra for Java Developers
 
MongoDB at ZPUGDC
MongoDB at ZPUGDCMongoDB at ZPUGDC
MongoDB at ZPUGDC
 
Cooking your Ravioli "al dente" with Hexagonal Architecture
Cooking your Ravioli "al dente" with Hexagonal ArchitectureCooking your Ravioli "al dente" with Hexagonal Architecture
Cooking your Ravioli "al dente" with Hexagonal Architecture
 
Functional programming in C#
Functional programming in C#Functional programming in C#
Functional programming in C#
 
Using AI to solve business challenges
Using AI to solve business challengesUsing AI to solve business challenges
Using AI to solve business challenges
 
Node.js extensions in C++
Node.js extensions in C++Node.js extensions in C++
Node.js extensions in C++
 

Recently uploaded

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfsudhanshuwaghmare1
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdflior mazor
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesBoston Institute of Analytics
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingEdi Saputra
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...apidays
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Drew Madelung
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Principled Technologies
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)Gabriella Davis
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...Martijn de Jong
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Scriptwesley chun
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FMESafe Software
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationSafe Software
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CVKhem
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsRoshan Dwivedi
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?Igalia
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘RTylerCroy
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodJuan lago vázquez
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processorsdebabhi2
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerThousandEyes
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024The Digital Insurer
 

Recently uploaded (20)

Boost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdfBoost Fertility New Invention Ups Success Rates.pdf
Boost Fertility New Invention Ups Success Rates.pdf
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
HTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation StrategiesHTML Injection Attacks: Impact and Mitigation Strategies
HTML Injection Attacks: Impact and Mitigation Strategies
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
Apidays Singapore 2024 - Building Digital Trust in a Digital Economy by Veron...
 
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
Strategies for Unlocking Knowledge Management in Microsoft 365 in the Copilot...
 
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
Deploy with confidence: VMware Cloud Foundation 5.1 on next gen Dell PowerEdg...
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...2024: Domino Containers - The Next Step. News from the Domino Container commu...
2024: Domino Containers - The Next Step. News from the Domino Container commu...
 
Automating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps ScriptAutomating Google Workspace (GWS) & more with Apps Script
Automating Google Workspace (GWS) & more with Apps Script
 
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers:  A Deep Dive into Serverless Spatial Data and FMECloud Frontiers:  A Deep Dive into Serverless Spatial Data and FME
Cloud Frontiers: A Deep Dive into Serverless Spatial Data and FME
 
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time AutomationFrom Event to Action: Accelerate Your Decision Making with Real-Time Automation
From Event to Action: Accelerate Your Decision Making with Real-Time Automation
 
Real Time Object Detection Using Open CV
Real Time Object Detection Using Open CVReal Time Object Detection Using Open CV
Real Time Object Detection Using Open CV
 
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live StreamsTop 5 Benefits OF Using Muvi Live Paywall For Live Streams
Top 5 Benefits OF Using Muvi Live Paywall For Live Streams
 
A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?A Year of the Servo Reboot: Where Are We Now?
A Year of the Servo Reboot: Where Are We Now?
 
🐬 The future of MySQL is Postgres 🐘
🐬  The future of MySQL is Postgres   🐘🐬  The future of MySQL is Postgres   🐘
🐬 The future of MySQL is Postgres 🐘
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 

Introduction to Aspect Oriented Programming in .NET with PostSharp by Zubair Ahmed

  • 1. Introduction to Aspect Oriented Programming in .NET with PostSharp Zubair Ahmed twitter.com/zubairdotnet zubairahmed.net inbox@zubairahmed.net
  • 2. Agenda • The problem • What is AOP? • PostSharp • Writing Aspects in Visual Studio 2010 • Learning Resources
  • 3. The problem • There was nothing in the beginning public class CustomerProcesses { }
  • 4. The problem • Then there was business code public class CustomerProcesses { public void RentBook( int bookId, int customerId ) { Book book = Book.GetById( bookId ); Customer customer = Customer.GetById( customerId ); book.RentedTo = customer; customer.AccountLines.Add( string.Format( "Rental of book {0}.", book ), book.RentalPrice ); customer.Balance -= book.RentalPrice; } }
  • 5. The problem • Then there was logging and exception handling internal class CustomerProcesses { private static readonly TraceSource trace = new TraceSource( typeof (CustomerProcesses).FullName ); public void RentBook( int bookId, int customerId ) { trace.TraceInformation( "Entering CustomerProcesses.CreateCustomer( bookId = {0}, customerId = {1} )", bookId, customerId ); try { Book book = Book.GetById( bookId ); Customer customer = Customer.GetById( customerId ); book.RentedTo = customer; customer.AccountLines.Add( string.Format( "Rental of book {0}.", book ), book.RentalPrice ); customer.Balance -= book.RentalPrice; trace.TraceInformation( "Leaving CustomerProcesses.CreateCustomer( bookId = {0}, customerId = {1} )", bookId, customerId ); } catch ( Exception e ) { trace.TraceEvent( TraceEventType.Error, 0, "Exception: CustomerProcesses.CreateCustomer( bookId = {0}, customerId = {1} ) failed : {2}", bookId, customerId, e.Message ); throw; } } }
  • 6. The problem • Then precondition checks internal class CustomerProcesses { private static readonly TraceSource trace = new TraceSource(typeof(CustomerProcesses).FullName); public void RentBook(int bookId, int customerId) { if (bookId <= 0) throw new ArgumentOutOfRangeException("bookId"); if (customerId <= 0) throw new ArgumentOutOfRangeException("customerId"); trace.TraceInformation( "Entering CustomerProcesses.CreateCustomer( bookId = {0}, customerId = {1} )", bookId, customerId); try { . . . . } }
  • 7. The problem • Resulting code is: – B oil e r pl a te – H ig hl y Coupl e d
  • 8. What is AOP? • An approach that extends OOP and addresses the issue of Cross -cutting concerns – Enca ps ul a te cro s s -cutting co nce rns into As pe cts – Im prov e s cod e re us a b il ity, m od ul a rity a nd s e pa ra tion of conce rns – Re d uce s d e f e cts b y re d ucing b o il e r -pl a te cod e
  • 9. Identify Cross-cutting concerns • Ca nnot b e s e pa ra te d into a m od ul e • Cha l l e ng e to a chie v e s e pa ra tion of conce rns • Some cros s -cutting co nce rns – Exception Handling – Caching – Tracing – Validation – Authorization – Transactions
  • 10. PostSharp • A AOP Framework for .NET • Works w ith a l l v e rs ions of .N ET • Inte g ra te s into Vis ua l Stud io • Supports s ta tic ‘b uil t -tim e ’ w e a v ing
  • 11. Demo • Aspects with PostSharp in Visual Studio 2010
  • 12. Learning Resources • sharpcrafters.com/postsharp/documentation/screencasts • sharpcrafters.com/postsharp/documentation#blogposts • infoq.com/presentations/Advanced -AOP • dimecasts.net/Casts/ByTag/PostSharp My Contacts • twitter.com/zubairdotnet • zubairahmed.net • inbox@zubairahmed.net