What I Read Today–PRISM

In DevDash, I have a minimal event object called ILocalBus. It’s an easy way for unconnected objects to stay in touch. Anything can publish an event, and anything else can consume it. The messages are distributed to the subscribers asynchronously.

Today, someone showed a similar piece of code using object provided by PRISM. So, tonight’s topic was PRISM.

I did a search for Microsoft Prism, and I got a few links that were already visited. I did some reading on Prism earlier, and forgot about it. Why? Well, as soon as you click a link, you learn that it’s for WPF and Silverilght developmernt. Yea… I don’t do WPF or Silverlight development. Anything involving a visual component isn’t in my areas of interest or expertise. But, I read it anyway.

http://msdn.microsoft.com/en-us/library/gg406140.aspx

I wasn’t going to read all of this: http://msdn.microsoft.com/en-us/library/gg430865(PandP.40).aspx

But, I jumped to the section that I saw in code:

http://msdn.microsoft.com/en-us/library/ff921122(v=pandp.40).aspx

The section of interest is EVENT AGGREGATION.

Clearly, this thing is for WPF and Silverlight. It says it very frequently, but perhaps this one component is worthwhile outside of the gui. Even the event is called CompositePresentationEvent… not appealing, but it might work.

One interesting parameter is the ThreadOption when subscribing.

  • Publisher Thread – The default setting. So, the subscribers will block the publisher.
  • UI Thread – n/a for how I would want to use it.
  • Background Thread – that’s the ticket.

As I’ve mentioned before, my event bus is ILocalBus, and the implementation of it is StupidBus. I called it that to make sure it’s never accidentally over glorified. Yes, it’s really cool and really simple. It lets objects that know not of each other’s existence communicate with one another. But, in the end, it’s done with simple .net constructs. I see how I would like it to evolve, but chances are there’s already an object out there ready to go. Maybe the Prism EventAggregator is that class.

Advertisements

3 Responses to What I Read Today–PRISM

Leave a Reply

Please log in using one of these methods to post your comment:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: