Nil Pun
Nil Pun

Reputation: 17373

Silverlight MVVM vs Prism

I'm a Silverlight newbie. I'm starting a new project and I would like to use existing patterns such as MVVM and PRISM.

Could anyone please guide me through which pattern is better for what type of scenario. And which one is mainly used in Silverlight, please

Upvotes: 4

Views: 1673

Answers (8)

akjoshi
akjoshi

Reputation: 15772

Prism is much more than MVVM, it provides a lot of features/base classes out of the box which you will have to implement yourself in your custom MVVM implementation; Prism provides a standard way of solving various problems/scenarios encountered in SL or WPF application (EventAggregator, Navigation framework, commanding etc.).

I agree with other answers that -

Prism is for large-scale applications which will be maintained/evolved for years by a lot of developers.

MVVM is better suited for light-weight applications which needs to be developed once and quickly. Although if you want flexibility you can develop your own MVVM framework or use available ones(like MVVM light etc.).

Also have a look at this question which I had asked about Prism - Custom MVVM implementation Vs. PRISM

Upvotes: 3

AProgrammer
AProgrammer

Reputation: 158

MVVM is a pattern, and you can use Prism framework to implement that. Also remember if you are putting any code in the codebehind then you are breaking the pattern. If you want any specific checks or operations seperately then use the Converter property by adding a class derived from Converter class (for eg: if you want to use animations on the grid/panel etc)

Upvotes: 3

user1469030
user1469030

Reputation:

I am also naive when it comes to learning Prism as well as Silverlight, but going through several tutorials on net for past couple of days I can say that, Prism is a framework, that is not meant for the small applications. So for creating a small application it will be better to use a MVVM pattern, as when you will be using Prism, then it will be a waste of effort, but if you think that your application can develop in the meantime, then using Prism will be a good idea. Although Prism also implements MVVM as one of the design patterns.

Upvotes: 1

Moble Joseph
Moble Joseph

Reputation: 657

I can see that we have already so many answers regarding what is MVVM and Prism. As said MVVM is a pattern which helps you to write cleaner "almost no code behind" UI and Prism is one of the frameworks which helps you in achieving that. But to use MVVM pattern, it is not a mandatory thing that you have to use any frameworks such as Prism, but if you use, they will give you some jump start. You could even try writing your own http://channel9.msdn.com/Events/MIX/MIX10/EX15

Upvotes: 0

GiCo
GiCo

Reputation: 586

I used MVVM and Prism in a project. Also I was coding alone, i liked both. Helped me hold the overview over the Project.

Prism and MVVM works perfectly together. The Region-Manager of Prism let me split the Views in parts and the Controller/Microkernel (I used Microsofts Unity / Not really Part of the Prism-Framework) helped me hold the parts loosly coupled. And there is more...

I had about 40k lines of code, and I strongly believe the work with the Prism Framework and the MVVM saved me more time than I spend. But it takes a little time at the start.

Reading tips about MVVM:

Josh Smith was for me a greate help. Here is one article: http://msdn.microsoft.com/en-us/magazine/dd419663.aspx

If german is OK for you I was reading a dotnetpro article a few month ago. That was exactly about some problems, which took me time to figure out: "Jörg Neumann / Flexibler Standard / dotnetpro 04/2012"

For Prism I do not really remember, but it wasn't so hard. I wouldn't say that using Prism is a hard deal. MVVM is much more tricky in the detail. But I couldn't imagine to programm WPF-applications without it.

Hope it helps!

Upvotes: 1

iCollect.it Ltd
iCollect.it Ltd

Reputation: 93561

The PRISM framework is best used for large scale modular projects, especially when the development may span teams. It provides very loose coupling allowing completely independent development of modules which can be downloaded separately or on-demand.

MVVM is a completely separate issue and can be used with most frameworks. It is basically a pattern for separating the view from the backing data by providing in intermediate object that the view binds against. This separation allows for separate testing of data objects and business logic and not tying up your view with lots of code-behind.

MVVM is the "most common" as it occurs in multiple frameworks including PRISM (or even with plain old Silverlight with no framework). PRISM is several orders of magnitude more work to learn and implement, but is well worth the effort on large projects.

Upvotes: 3

Rukshan
Rukshan

Reputation: 8066

PRISM is a framework and MVVM is a design pattern. So you can use both PRISM and MVVM in your Silverlight application.

Upvotes: 1

Derek Beattie
Derek Beattie

Reputation: 9478

MVVM is a pattern, PRISM is a framework that can be used to implement MVVM. To get started with Silverlight and MVVM I'd recommend looking at MVVM Light.

Upvotes: 4

Related Questions