BT

Aspect Oriented Programming for Silverlight

by Jonathan Allen on Aug 04, 2008 |

AOP or Aspect Oriented Programming allows developers to “weave” code fragments through their object and methods without explicitly placing the code in the class’s source. This additional code, often referred to as “advice”, is often stored in configuration files but other options exist. Probably the most widely AOP system is AspectJ, an extension for Java.

AOP has been controversial over the years. While many people swear by it for mundane tasks like security and logging, others balk at injecting code that cannot be easily viewed in the source. But even if you don’t like it, sooner or later chances are you are going to happen across code that uses it.

For .NET developers current using AOP or interested in trying it out, one option is PostSharp. PostSharp uses post-processing to add advice to classes. This involves modifying the compiled EXE or DLL to inject the necessary code fragments. For PostSharp, advice is usually indicated by Attributes.

Recently it has been announced that PostSharp 1.5 supports Silverlight 2. This CTP release also includes support for .NET Compact Framework and Novell’s Mono. Chris Koenig shows some examples of PostSharp.

Hello stranger!

You need to Register an InfoQ account or or login to post comments. But there's so much more behind being registered.

Get the most out of the InfoQ experience.

Tell us what you think

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread
Community comments

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Allowed html: a,b,br,blockquote,i,li,pre,u,ul,p

Email me replies to any of my messages in this thread

Discuss

Educational Content

General Feedback
Bugs
Advertising
Editorial
InfoQ.com and all content copyright © 2006-2014 C4Media Inc. InfoQ.com hosted at Contegix, the best ISP we've ever worked with.
Privacy policy
BT