aspect oriented programming with dependency injection
play

Aspect-Oriented Programming with Dependency Injection Mark Seemann - PowerPoint PPT Presentation

Aspect-Oriented Programming with Dependency Injection Mark Seemann @ploeh Cross-Cutting Concerns Security Security Auditing Auditing Logging Logging Caching Caching Metering Metering Stability patterns Stability patterns Transactions


  1. Aspect-Oriented Programming with Dependency Injection Mark Seemann @ploeh

  2. Cross-Cutting Concerns Security Security Auditing Auditing Logging Logging Caching Caching Metering Metering Stability patterns Stability patterns Transactions Transactions

  3. Objective • Single Responsibility Principle • Open/Closed Principle SOLID • Liskov Substitution Principle • Interface Segregation Principle • Dependency Inversion Principle DRY •Don’t Repeat Yourself

  4. Staying SOLID • Single Responsibility Principle • Open/Closed Principle SOLID • Liskov Substitution Principle • Interface Segregation Principle • Dependency Inversion Principle DRY •Don’t Repeat Yourself

  5. Prerequisite Program to an interface, not an implementation - Design Patterns, 1995

  6. Conjecture • It’s always possible to apply a Decorator to an interface

  7. Using Decorators to add aspects Client IFoo ConcreteFoo

  8. Using Decorators to add aspects IFoo AuditingFoo Client IFoo ConcreteFoo

  9. Using Decorators to add aspects IFoo SecureFoo IFoo AuditingFoo Client IFoo ConcreteFoo

  10. Staying SOLID with Decorators DEMO

  11. Staying SOLID • Single Responsibility Principle • Open/Closed Principle SOLID • Liskov Substitution Principle • Interface Segregation Principle • Dependency Inversion Principle DRY •Don’t Repeat Yourself

  12. Staying DRY • Single Responsibility Principle • Open/Closed Principle SOLID • Liskov Substitution Principle • Interface Segregation Principle • Dependency Inversion Principle DRY •Don’t Repeat Yourself

  13. Dynamic interception From here Commonly on, dynamic supplied by interception a DI is required Container

  14. DI Containers with Interception Castle Unity Windsor Spring.NET LinFu

  15. Using a DI Container DEMO

  16. Interception Xyz

  17. Interception IFoo XyzFoo Xyz Xyz

  18. Interception IFoo XyzFoo Xyz IBar Xyz XyzBar Xyz

  19. Interception IFoo XyzFoo Xyz IBar Xyz XyzBar Xyz IBaz XyzBaz Xyz

  20. Adding interceptors DEMO

  21. Pointcut IFoo ConcreteFoo Xyz IBar Abc ConcreteBar IBaz Æøå ConcreteBaz

  22. Pointcut IFoo ConcreteFoo Xyz IBar Match Abc ConcreteBar IBaz Æøå ConcreteBaz

  23. Adding a pointcut DEMO

  24. Objective • Single Responsibility Principle • Open/Closed Principle SOLID • Liskov Substitution Principle • Interface Segregation Principle • Dependency Inversion Principle DRY •Don’t Repeat Yourself

  25. Staying Staying DRY SOLID only requires requires dynamic loose interception coupling

  26. http://blog.ploeh.dk/ @ploeh MARK SEEMANN

Download Presentation
Download Policy: The content available on the website is offered to you 'AS IS' for your personal information and use only. It cannot be commercialized, licensed, or distributed on other websites without prior consent from the author. To download a presentation, simply click this link. If you encounter any difficulties during the download process, it's possible that the publisher has removed the file from their server.

Recommend


More recommend