I have often come across this question – Why use PRISM? Microsoft have provided a very good documentation and guidance on this whole subject, however to a newbie it might seem a bit daunting. So I thought to put it down as bullet points in simple terms, what are the benefits/advantages PRISM 4.0 offers:
- Separation of Presentation Layer – better design/develop collaboration
- Full support for MVVM model
- Full support for Command, DI and Strategy patterns
- Promotes service oriented architecture
- Fully modular approach for efficient and effective maintenance, scalability and deployment
- Completely decoupling between individual parts of composite application.
- Complete testability
- Support for Plug-in type architecture
The following components of PRISM 4.0 are used to obtain the feature mentioned above:
- Modules and Views – offers composite UI development
- IEventAggregator – offers communication between decoupled modules
- IServiceLocator – offers support for SOA
- Unity & MEF- serve as conatiners for DI
- IRegionManager – offers static and dynamic composition of UI at run-time
That was my version of benefits offered by PRISM. To see what the official documentation says, please read on…
Prism is intended for software developers building WPF or Silverlight applications that typically feature multiple screens, rich user interaction and data visualization, and that embody significant presentation and business logic. These applications typically interact with multiple back-end systems and services and, using a layered architecture, may be physically deployed across multiple tiers. It is expected that the application will evolve significantly over its lifetime in response to new requirements and business opportunities. In short, these applications are “built to last” and “built for change.” Applications that do not demand these characteristics may not benefit from using Prism.
Client Application Development Challenges
Typically, developers of client applications face quite a few challenges. Application requirements can change over time. New business opportunities and challenges may present themselves, new technologies may become available, or even ongoing customer feedback during the development cycle may significantly affect the requirements of the application. Therefore, it is important to build the application so that it is flexible and can be easily modified or extended over time. Designing for this type of flexibility can be hard to accomplish. It requires an architecture that allows individual parts of the application to be independently developed and tested and that can be modified or updated later, in isolation, without affecting the rest of the application.
Most enterprise applications are sufficiently complex that they require more than one developer, maybe even a large team of developers that includes user interface (UI) designers and localizers in addition to developers. It can be a significant challenge to decide how to design the application so that multiple developers or subteams can work effectively on different pieces of the application independently, yet ensuring that the pieces come together seamlessly when integrated into the application.
Designing and building applications in a monolithic style can lead to an application that is very difficult and inefficient to maintain. In this case, “monolithic” refers to an application in which the components are very tightly coupled and there is no clear separation between them. Typically, applications designed and built this way suffer from problems that make the developer’s life hard. It is difficult to add new features to the system or replace existing features, it is difficult to resolve bugs without breaking other portions of the system, and it is difficult to test and deploy. Also, it impacts the ability of developers and designers to work efficiently together.
Composite applications provide many benefits, including the following:
- They allow modules to be individually developed, tested, and deployed by different individuals or subteams; they also allow them to be modified or extended with new functionality more easily, thereby allowing the application to be more easily extended and maintained. Note that even single-person projects experience benefits in creating more testable and maintainable applications using the composite approach.
- They provide a common shell composed of UI components contributed from various modules that interact in a loosely coupled way. This reduces the contention that arises from multiple developers adding new functionality to the UI, and it promotes a common appearance.
- They promote reuse and a clean separation of concerns between the application’s horizontal capabilities, such as logging and authentication, and the vertical capabilities, such as business functionality that is specific to your application. This also allows you to more easily manage the dependencies and interactions between application components.
- They help maintain a separation of roles by allowing different individuals or subteams to focus on a specific task or piece of functionality according to their focus or expertise. In particular, it provides a cleaner separation between the UI and the business logic of the application—this means the UI designer can focus on creating a richer user experience.
Challenges Not Addressed by Prism
- Occasional connectivity and data synchronization
- Service and messaging infrastructure design
- Authentication and authorization
- Application performance
- Application versioning
- Error handling and fault tolerance