Wednesday, 16 September 2015

The magic of Aspect Oriented Programming with PostSharp

In this video tutorial, I explain what Aspect Oriented Programming (AOP) is all about, the issues it solves and the benefits of using it.
I demonstrate it with PostSharp, the best framework for implementing aspects and integrating them with your solution.

Quoting PostSharp, it allows developers to eradicate boilerplate by offloading repeating work from humans to machines. PostSharp contains ready-made implementations of the most common patterns and gives you the tools to build automation for your own patterns..

In my demo, I show how to use those ready-made implementations, as well as get started with your own custom ones (best viewed in full screen, for the code screencast).

Get the Powerpoint file here.
Get the demo project here.

Benefits of Aspect Oriented Programming

As I explain, in the video, the power of Aspect Oriented Programming, is mostly in:
  • Reusing repetitive boilerplate code across your project.
  • Avoiding errors and bugs.
  • Addressing cross-cutting concerns all over the place in an encapsulated way.
  • Keeping your code readable, maintainable, testable, well formatted, with less clutter, while still attending all the above.

Why  PostSharp

  • PostSharp is the most advanced AOP framework. 
  • It differs from other frameworks, by using the technique of IL-weaving.
  • It provides a wide, easy to use, infrastructure of components you can easily integrate into your code and get started building your own aspects,
  • It comes with a number of built-in customizable aspects for the most common cases, such as implementing INotifyPropertyChanged or logging. Those are extremely easy to apply across your entire solution.
  • It is well maintained, supported, documented, kept up-to-date.
  • Because it's transparent. sizeOf(Code).Matters();
See more on the PostSharp site, download it here (online documentation here).

Keep your spaghetti neat!

Additional resources

Check out this great AOP introduction by Donald Belcham

And check out this great tutorial about bacon weaving!

No comments:

Post a Comment