Skip to main content

SharpCrafters has created PostSharp Toolkits, an open source product that provides some useful pre-built aspects for common cross-cutting concerns. Currently, the only toolkit so far is the diagnostics toolkit, which includes aspects for logging, exception handling, etc.

You can find PostSharp Toolkits on Github. If you want support for PostSharp Toolkits, you can submit questions or suggest features in the PostSharp Toolkits support thread.

(It's being open sourced in order to get a shorter feedback loop, but most likely they aren't going to take unsolicited patches).

Surgery went well, thanks for asking. Now it's a few more months of rehab and I'll be almost good as new. I'm exercising my copy/paste skills again with this weeks Weekly Concerns link round-up:

That's all for this week.

Do you agree with these concepts?

TDD is great, BDD is better. DDD is the way it should be done. SOLID principles should always be followed. Don't repeat yourself. Be agile. Follow the boy scout rule. Use an IoC tool and/or dependency injection. Don't reinvent the wheel. Always normalize your SQL tables. Use AOP to avoid boilerplate and clutter.

I do. And a lot of other people do too. But why? Because:

  • ...it's been drilled into your head by peers and at software conferences?
  • ...you have baggage from a previous job or hate your current job?
  • ...you read about them all in a book like Clean Code, and assumed Uncle Bob knows what he's talking about?

Or have you actually researched and practiced each of these concepts and found them to be superior in many cases to the alternatives (which you've also researched and practiced)?

Well, for me, the answer is: all of the above. Except I don't hate my (current) job.

Yes, I just admitted that I've blindly subscribed to a lot of the tenets that you probably hold dear because of peer pressure and authority figures. This isn't necessarily a bad idea: authority figures and peer pressure can be useful constructs. But independent of your own healthy skepticism and critical thought, they can be dangerous too.

So before you run with any new acronym like BDD or AOP, do your research: see what your peers think, see what authority figures think, and finally use your own brain to put it all together.

Does PostSharp work on Windows 8 (or more correctly, with .NET 4.5)? The short answer is: not yet.

Long answer:

I tried to get it to work, I really did. I tried using the PostSharp Silverlight assembly. I tried installing with NuGet and I tried directly from the PostSharp installer. I tried it with a fox, I tried it on a box.

NuGet fail in VS11

I'm guessing that SharpCrafters is going to wait until Windows 8 / .NET 4.5 is more stable and closer to release before worrying about updating PostSharp. SharpCrafters is a very small company, so they probably can't afford to spend resources on updating their product to work for a framework and operating system that aren't even used by the general public yet, which is totally understandable.

Here are some technical details about why it's not working. I do think it should work fine with VS11 if you are writing a .NET 4 app, if you are already doing that for whatever reason (can you do that? I actually don't remember). I'm going to try some other AOP tools on Windows 8 and see what I come up with, just in case you desperately need AOP in your hot new Metro app. I'm guessing DynamicProxy probably works in a XAML/C# project, and any JavaScript AOP solutions would probably work in an HTML/JS project, but we'll see...

EDIT:

Chad England has confirmed in a blog post that you can get PostSharp working in VS11 with non-.NET 4.5 projects.

Terminology: aspect

March 04, 2012 mgroves 0 Comments
Tags: aspect terminology

I continue to try and cut through some of the confusion around AOP by providing simple definitions and examples of often obtuse terminology (see also: other terminology posts).

"Aspect" seems like the core term in "aspect oriented programming" doesn't it? An aspect is simply a way to indicate to an AOP tool: what and where. The "what" is the advice, and the "where" are join points.

Let's review the terms covered so far by looking at a very trivial example of AOP:

In that example:

  • The join point is "OnEntry", i.e. before a method is executed
  • The advice is the body of the OnEntry method (Logger.Write(...))
  • The aspect is the MyAspectAttribute class itself
  • The pointcut is a combination of the applied [MyAspect] attribute along with the join point
    • i.e. the complete pointcut is "before the MyMethod method of MyClass is executed"
    • in this illustration, it's a very specific pointcut, but useful real-world pointcuts would be broader
  • The cross-cutting concern is logging (haven't gotten to that term yet; what's the rush, it's only the name of the site!)
  • The weaving is performed by the PostSharp post-compiler (also haven't gotten to that term yet)

Looks like two more terminology posts to go. If there's a term that I'm missing or glossing over, let me know, and I'll write a post on it.

Matthew D. Groves

About the Author

Matthew D. Groves lives in Central Ohio. He works remotely, loves to code, and is a Microsoft MVP.

Latest Comments

Twitter