What is the best way to document Prism Modules? - wpf

I am attempting to document a WPF Prism application made up of multiple modules. This scenario begs for module documentation, but I'm not sure if there is a formalized way of doing this in UML, either as separate packages or something more generalized.

Usually, your documentation / design modeling methodology are determined by your company's Software Development Plan or Process. If your company doesn't have one, you may be well served to first define your design documentation process, independent of what fits best for Prism - particularly if you have applications that have been developed that are not reliant on Prism. In my experience, Prism, in and of itself, doesn't lend itself necessarily better or worse to any design modeling approach.
That aside, and with respect to UML specifically, Prism modules can usually be logically divided into packages or use cases quite easily. You've actually already done that when you divided your application into modules in the first place: each module is a loosely coupled, reasonably independent portion of your application.
For example, UI concern modules can often be grouped both according to use case and as separate packages. Take the StockTraderRI for example: the News, Position, and Watch modules lend themselves quite easily to separate use cases (View News, View Position, Add Stock to Watch, etc.) Obviously, these can also be represented easily as separate packages, complete with static class diagrams.
With business or data layer modules, such as Infrastructure or service oriented modules, the representation may be almost exclusively as package / class diagrams, with some use case realization diagrams (sequence, etc.) being used to illustrate communication coming from the UI to the services. Again, with the StockTraderRI application, the Market module and Infrastructure DLL seem to lend themselves to a more static approach.
Again, your approach to documentation and modeling of your application shouldn't be dictated by Prism, as any good modeling language will be able to accommodate Prism.

Related

Do data models define the logical split between modules in a Prism application?

With some background on MVVM, I’m moving to Prism now for a large-scale application. I’ve read and—mostly—understood the excellent Developer’s Guide to Prism.
What eludes me is: where do I logically separate my application into various models? It seems that different data sources (or models) dictate this, but I haven’t found a solid statement.
In my case, I’ve got a single data source: a data base containing a multitude of entries but in a single table, translating into a single object type. However, I’d like to have various entirely different visual representations of the data, depending on what the user wants to do with it. Are these representations better implemented as different modules or as different views within the same module? My feeling is that it’s the latter, since I can’t see how using the same data model over various modules would be implemented MVVM-wise, but I’d like to see it confirmed by the experts out there.
This question is somewhat similar to Where does the data model go in a Prism app?, but not entirely the same…
Are these representations better implemented as different modules or as different views within the same module?
Only you as a developer or architect could decide this. But I would also say the latter, i.e. different views within the same module.
A Prism module is nothing but a "loosely coupled functional unit". This is not the same thing as a different visual representation of the same (or almost the same) data.
Even a single view can be implemented to display several different visual representations of the same underlying data so you certainly don't need several modules to be able to this. So you should probably start with a single module. You can always add additional modules later on if you need to for some reason.

Building a database-aware application with PRISM

I am building an application using WPF, MVVM, and PRISM. the application is an intensive CRUD app, and the db is accessed using entity framework. i want to build the application using modules but i can't figure out where to put the data access code (more accurately i can't figure out where to put the repository interface) . if they go into an infrastructure project. then all modules will depend on that and it doesn't seem like the right place. on the other hand if the interfaces go into their respective modules then there will be lots of inter-dependencies between the modules which is bad.
Question: best way of designing a database-aware modular PRISM MVVM application and perhaps the best solution to my case ?
I think you may take a look at MEF. It allows you to have the level of abstraction and modularity you will need for this while everything working together in a seamless way.
I would recommend you to read official Prism guide.
I use this separation:
MyApp - shell project
MyApp.Infrastructure - all shared interfaces - including your IRepository
MyApp.DAL - contains all DAL classes, and also Repository implementation
MyApp.Modules.SimpleModule
MyApp.Modules.AnotherModel
etc.
Main thing about modules - they should not depend on each other, but they could depend on shared modules (e.g. MyApp.Infrastructure).

WPF Composite Application: Prism modules or MEF parts?

I need to write a composite WPF application with parts being potentially developed by other teams. These parts are actually indepndent applications now, and we want to put them under common "roof".
Two main options I consider for composition is Prism modules vs. MEF parts, and I am not 100% sure which to choose, since both have pros and cons. Note, that this is NOT about the IoC container choice, this is about discovering pluggable components. I am pretty much settled on the opinion that MEF is not to be used as an IoC container.
If I go with MEF for pluggability, the biggest plus is that it is baked in into the .NET framework, so there are no versioning issues. From the other hand, I will have to (partialy) reinvent mechanisms such as Prism region managers and other UI composition features.
If I go with Prism modules, I get much richer integration functionality (regions, event aggregator, etc.), but for that to work everyone must be on the same version of Prism, and preferrably the same version of Unity, to avoid unpleasant surprises. Upgrading to a next version of Prism/Unity will thus become a challenge.
I would like to hear your opinion about the choice.
I had a similar choice several years ago and choose Prism. I'm glad that I did. Unless I was building a trivial app, I wouldn't consider doing it without Prism. You can have different dev groups work in near isolation on their modules and integrate them when complete. The same goes for bugs and requirement changes: much easier to handle.
Yes, you'll want everyone working on the same version, but that's a small price to pay and very common. If you have specific questions, let me know.

High Level Modelling Advice for Prism MVVM

I'm beginning modelling an existing application for controlling a cash collection terminal. I'm very new to the Prism / Composite Application Library and would like some advice on how I could begin modelling this application using the Prism library.
Basically the application manages a cash terminal that accepts frequent cash drops, counts notes in the deposits, communicates via a 3G/Edge connection with our central server to replicate deposit and other data, and performs cashups. Central to all this is management of the cash canister. The application is not UI intensive, but we are moving away from WinForms to WPF, and I am supposed to use this framework for all future development.
At its most fundamental core, Prism is an application composition framework. It allows you to modularize your application. The thing to start thinking about it what parts of your application need to be modular.
A module is a unit of functionality that is useful on its own, but doesn't make the application useless if it is replaced or removed. For example, in an application I've written for work we have two different types of contacts for which we handle cases. We have a module for each contact type that contributes functionality specific to that contact type. The application is still usable without one or the other and in this way we can work on or test each component individually as well as together.
Hopefully this gives you a guide to how to model your application. Prism seems complicated, but it helps to understand that what you really get with Prism is this ability to slice up your application. From a high level, this is what you'd probably be more interested in modeling.

Is PRISM meant for large scale application development?

I am developing a silverlight application for the past 6 months using prism framework. When I look at the code base now it has grown huge with lots of modules, event aggregators, inter module communication code etc. On hindsight I am contemplating whether I made the right choice. Is there any other simpler framework I should have gone for ?
Prism is at its best when targeting a large application. Why? Because the core concepts Prism provides, such as Modularity, UI Composition, support for MVVM, etc. are used the most in this kind of applications.
The idea, as you said, is that you are likely to end up with a bunch of modules. The benefit of that is that your application is decoupled, and modules can be tested in absolute isolation so they are easy to maintain.
By using Prism, or any other library/framework that modularizes your application, (correctly) in large applications, you don't need to go through your entire application looking for bugs when you make a change to one of the parts. This is not true in monolithic applications, where making a minor change might bring down the entire app.
Another plus for Prism in this scenarios is that it allows multiple teams to work on different modules simultaneously, without affecting each other's work. This is specially useful when working with distributed teams.
The thing that would convince you of making the right choice, would be comparing the application you created with the same one but with high coupling of its components.
I hope this helps

Resources