PostSharp & Spring.NET 2. PostSharp Architecture
you are now supposed to be woken up!
however, you should already know that!
The Big Picture Plug-Ins PostSharp Core PostSharp Laos Hosts MSBuild Host Command-Line Host Runtime Host
A finer picture PostSharp Core Code Object Model represents a .NET module Module Reader reads a .NET binary assembly  into...
Core vs. Laos PostSharp Core PostSharp Laos Objective Absolutely free editing of .NET assemblies Aspect-Oriented Programmi...
Compared Example: Logging <ul><li>Boring but instructive </li></ul>Hello, World
have you done your homework?
The Laos Solution <ul><li>Derive a custom attribute. </li></ul><ul><li>Implement “event handlers”. </li></ul><ul><li>Apply...
The Core Solution <ul><li>Define the Public Interface. </li></ul><ul><ul><li>Custom Attribute in the example, but anything...
Compound Aspects <ul><li>Implement  INotifyPropertyChanged . </li></ul>
Translating the implementation pattern to AOP Aspected Class Property 1 Property 2 Property 3 NotifyPropertyChangedImpl in...
Putting it together:  Compound Aspect <ul><li>True meta-programming at compile-time. </li></ul><ul><li>No limitation to cu...
Summary <ul><li>With PostSharp Core, you are completely free but you have to pay the price. </li></ul><ul><li>PostSharp La...
 
Upcoming SlideShare
Loading in …5
×

Spring.Net, Feb 2008, PostSharp: A Technical Introduction

1,083 views

Published on

Published in: Technology
0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total views
1,083
On SlideShare
0
From Embeds
0
Number of Embeds
21
Actions
Shares
0
Downloads
26
Comments
0
Likes
0
Embeds 0
No embeds

No notes for slide

Spring.Net, Feb 2008, PostSharp: A Technical Introduction

  1. 1. PostSharp & Spring.NET 2. PostSharp Architecture
  2. 2. you are now supposed to be woken up!
  3. 3. however, you should already know that!
  4. 4. The Big Picture Plug-Ins PostSharp Core PostSharp Laos Hosts MSBuild Host Command-Line Host Runtime Host
  5. 5. A finer picture PostSharp Core Code Object Model represents a .NET module Module Reader reads a .NET binary assembly into the Code Object Model Module Writer writes the Code Object Model into a binary assembly (using ILASM) Code Weaver provides the infrastructure for MSIL injection Platform Infrastructure executes projects, loads plug-ins, loads and schedules tasks Plug-in performs specific analysis or transformation Host bootstraps PostSharp and invoke project executions Independent Program uses PostSharp without the Platform Infrastructure PostSharp Laos PostSharp4EntLib PostSharp.Samples.Trace custom plug-ins command-line utility MSBuild task PostSharp.Samples.Host custom application servers PostSharp.Samples.Explorer
  6. 6. Core vs. Laos PostSharp Core PostSharp Laos Objective Absolutely free editing of .NET assemblies Aspect-Oriented Programming Easily Primitives Low-Level (MSIL) High-Level Audience ISV, MSIL/PostSharp specialist Everyone Learning Curve Steep High Complexity / Error Proneness High Low Runtime performance Fast Slower Licensing of extensions GPL/Commercial Any
  7. 7. Compared Example: Logging <ul><li>Boring but instructive </li></ul>Hello, World
  8. 8. have you done your homework?
  9. 9. The Laos Solution <ul><li>Derive a custom attribute. </li></ul><ul><li>Implement “event handlers”. </li></ul><ul><li>Apply/multicast the custom attribute. </li></ul><ul><li>Compile-time instantiation. </li></ul><ul><li>Deserialization. </li></ul><ul><li>Reflector. </li></ul>
  10. 10. The Core Solution <ul><li>Define the Public Interface. </li></ul><ul><ul><li>Custom Attribute in the example, but anything else is allowed (XML, DSL). </li></ul></ul><ul><li>Implement the weaver. </li></ul><ul><ul><li>Advice. </li></ul></ul><ul><ul><li>Advice Provider (pointcut evaluation). </li></ul></ul><ul><li>Plug-In Manifest. </li></ul><ul><li>Discovery. </li></ul><ul><li>Reflector. </li></ul>
  11. 11. Compound Aspects <ul><li>Implement INotifyPropertyChanged . </li></ul>
  12. 12. Translating the implementation pattern to AOP Aspected Class Property 1 Property 2 Property 3 NotifyPropertyChangedImpl internal OnPropertyChanged event PropertyChanged Property Setter Aspect OnSuccess handler Composition Aspect
  13. 13. Putting it together: Compound Aspect <ul><li>True meta-programming at compile-time. </li></ul><ul><li>No limitation to custom attributes. </li></ul><ul><li>The base of PostSharp bridges to Microsoft Enterprise Library or Microsoft Entity Framework. </li></ul>
  14. 14. Summary <ul><li>With PostSharp Core, you are completely free but you have to pay the price. </li></ul><ul><li>PostSharp Laos allows to do pretty much things, but: </li></ul><ul><ul><li>It is slower: it generates suboptimal instructions . </li></ul></ul><ul><ul><li>No division of compile-time and run-time logic. </li></ul></ul><ul><ul><li>Attention to abuses! </li></ul></ul>

×