Presentation on theme: "Jim McKeeth | Podcast at Delphi.org"— Presentation transcript:
1 Jim McKeeth | Podcast at Delphi.org Introduction to Aspect Oriented Programming with Cirrus and Delphi Prism
2 Agenda What is AOP? Why AOP? Two AOP Paradigms The Cirrus Framework ExamplesDebuggingOther AOP FrameworksFuture2
3 What is Aspect-Oriented Programming? HMOY know what AOP is?You have come to the right place
4 A Paradigm ShiftAspect-Oriented programming is to Object-Oriented programmingObject-Oriented programming is to Procedural programmingasWon’t it be slower / harder to debug?Why do we need a new paradigm?I can do this already!
5 A Definition Super-Encapsulation Think of it as A programming paradigm that increases modularity by enabling improved separation of concerns. This entails breaking down a program into distinct parts allowing the separation of cross-cutting concerns.Think of it asSuper-Encapsulation
7 What is a Concern?A distinct and cohesive area of functionalityExamples:Business logicUser interfaceDatabase accessError handlingLoggingThreadingTransactionsSecurityException handlingSecondary requirements, but often the bulk of our code!
8 What Makes a Concern Cross-Cut? Error handlingBusiness logicThread lockingUser Interface
9 The Principles of OODSRP The Single Responsibility Principle - A class should have one, and only one, reason to change.OCP The Open Closed Principle You should be able to extend a classes behavior, without modifying it.LSP The Liskov Substitution Principle Derived classes must be substitutable for their base classes.ISP The Interface Segregation Principle Make fine grained interfaces that are client specific.DIP The Dependency Inversion Principle Depend on abstractions, not on concretions.Robert C. Martin“Uncle Bob”butUncleBob.com
10 Two AOP Paradigms Pre-Compile / At-Compile Post-Compile Decorating the code with the aspects before compilation (method used by Cirrus)Concerns are woven in during compilation.Post-CompileWeave the advice in after compilation via Point-Cut definitions (method used by AspectJ)Allows modification of existing functionality without modifying code.
16 Cirrus Fundamentals Add reference to RemObjects.Oxygene.Cirrus. Not necessary to deploy.Aspects must be in a separate assembly.Also not necessary to deploy.Aspects woven in at compile time.Cirrus exists as a series of Interfaces (callbacks).Aspects are applied via Attributes with the aspect: prefix.