Thursday, September 2, 2010

Microsoft Patterns & Practice's Prism Demo

References:

Summary (from the official Microsoft Site)

Prism (Composite Application Guidance for WPF and Silverlight) is designed to help you more easily build enterprise-level Windows Presentation Foundation (WPF) client applications. This guidance will help you design and build flexiblecomposite client applications-composite applications use loosely coupled, independently evolvable pieces that work together in the overall application.
The Composite Application Guidance can help you develop your client application in a modular fashion. With this approach, you manage the complexity of a large application by breaking it down into smaller, simpler modules. The modules can evolve independently while working together as a unified application.
This version of the Composite Application Guidance is designed to help you build applications in WPF and Silverlight that have a single code base.


Architectural Goals

The Composite Application Library is designed to help architects and developers achieve the following objectives:
  • Create a complex application from modules that can be built, assembled, and, optionally, deployed by independent teams using WPF or Silverlight.
  • Minimize cross-team dependencies and allow teams to specialize in different areas, such as user interface (UI) design, business logic implementation, and infrastructure code development.
  • Use an architecture that promotes reusability across independent teams.
  • Increase the quality of applications by abstracting common services that are available to all the teams.
  • Incrementally integrate new capabilities.

Messaging and Event Aggregators

Comparing the Prism offering of Event Aggregator and with Mvvm Light, is clear that Mvvm Light is a far nicer syntax.

Mvvm Light Event Aggregator - Send a Message / Event Notification

Messenger.Default.Send(new NotificationMessage(this, "Show Modal Dialog"));

Mvvm Light Event Aggregator - Receive a Message / Event
Messenger.Default.Register<NotificationMessage>(this, SomeEventHandlerMethod);

Compare that with the Prism Event Aggregator:

Sender:
NotificationEvent x = eventAggregator.GetEvent<NotificationEvent>();
x.Publish("Show Modal Dialog");


Listener:
NotificationEvent x eventAggregator.GetEvent<NotificationEvent>();
x.Subscribe(message => SomeEventHandlerMethod(message));

Yep... I know which one I prefer.

I don't think I'll look any closer at Prism (or MEF or whatever its called this month) until I need more loose coupling with internal components.

No comments:

Post a Comment