Compare and contrast Caliburn v. MVVM Light Toolkit (mainly for Silverlight)? - silverlight

I want to learn more about a MVVM framework but I don't have a lot of time to devote. Does someone have experience with Caliburn (or micro Caliburn) and MVVM Light Toolkit and can give some reasons to start with one framework over the other? This would mainly be for Silverlight development.
Or perhaps is there another framework that might be easier to start with?
thanks

Have a look at this nice article that provides a summary and comparison of various MVVM frameworks - http://www.japf.fr/2009/10/a-quick-tour-of-existing-mvvm-frameworks/. The choice of an MVVM framework depends on the time available and the complexity of your project. If you wish to learn how to use a MVVM framework, it is best to work on a small project first in which you explore one or more frameworkss. MVVMLight and Caliburn are popular frameworks and they are used by both Silverlight and Windows Phone 7 developers. There are numerous sample applications available on the web that illustrate the use of these frameworks.
HTH, indyfromoz

Related

WPF Desktop application and design patterns

I have to develop a desktop application and the back end will be SQL Express.
I am new to wpf.
Any design patterns i can use? any sample application for wpf with db?
Please help me.
Prism 4 is by Microsoft Patterns and Practices team and it advocates MVVM, Dependency Injection, and modular application development. The book (which I bought and read) is now free online. The book covers several design practices and should be a fairly good start to everything you would need to know to write maintainable, testable, flexible applications in WPF. Prism is also a framework which aids in modular app development and MVVM. It is also fairly popular.
Prism 4.1
^ Seriously, read this book. It takes 2 days max.
As per my suggestion MVVM pattern would be nice if you use in your application. Because it has many ways to reuse your code.
You can find tutorial on the same at below links:
http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
http://www.codeproject.com/Articles/126249/MVVM-Pattern-in-WPF-A-Simple-Tutorial-for-Absolute
http://wpftutorial.net/MVVM.html
Let me know if you need more help.
You can use MVVM design pattern, It will help you to Reuse of code, Flexibility and Customization, Separation of the UI design and development , Testing ...
Refer these article to understand the MVVM pattern and also for sample WPF application..
http://www.codeproject.com/Articles/278901/MVVM-Pattern-Made-Simple
http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
http://msdn.microsoft.com/en-us/library/gg405484%28v=pandp.40%29.aspx

Silverlight 5 MVVM Best Practices

Seeing as how MVVM is being highly regarded as a good system design pattern, I thought I might just jump aboard and give MVVM a shot.
Just a little background about myself before I begin with questions:
I have done a few years of development with ASP.NET Webforms. I have also done a fair bit of development in ASP.NET MVC, which I am quite comfortable with.
Currently, we have a number of "backbone" applications written using ASP.NET MVC 3 which we customize and sell to our clients whenever we're approached. These applications are all meant for internal use, hence plug-ins wouldn't be much of a problem.
The real problem with development is that for large scale business applications with complex business rules, ASP.NET MVC tends to slow us down (writing jQuery / javascript > server side processing > return result, use jQuery to notify > alter view, something along this line).
Then I began looking for answers that will help us improve our time to delivery and also responsiveness (well, we all know how JavaScript is capable of killing us) and my search brought me to Silverlight (we have the time to change, no worries there).
So here comes the questions:
I have come across many Silverlight MVVM samples online, but all of them show applications as simple as interacting with only one Database table. Is MVVM pattern well suited for large applications?
In MVC, I'm used to Dependency Injection from Ninject to pass an implementation of UnitOfWork to my Controller. In all samples I found online, none of them use any form of DI. Is it really unnecessary? Since the idea of MVVM is to decouple, so why not also decouple ViewModel from Model?
I've gone through a book published by Jeremy Likness called Designing Silverlight Business Applications. He used MEF to do the decoupling, which I think doesn't really fit into our application. We do not really need to do "hot-plugging". What's your take on this?
MVVM is all about Commands, Databindings and No Code-behinds. What if I want to interact with UIs that do not expose to commands? (I'm not too sure about this, I'm guessing ListView OnSelectionChange?)
To add to the previous answer:
We are developing a large corporate-wide Silverlight platform and a set of applications using MVVM. Seems to be working pretty well.
We are using DI extensively. Our system is built on top of Prism. Prism contains a large amount of sample applications of various complexity illustrating the use of DI in MVVM.
We use Unity as our IoC container. Prism contains guidance for both MEF and Unity. Unity seems to be a more traditional IoC approach.
In the vast majority of cases using Bindings and Commands covered our needs. For the others we use Expression Triggers and Actions. You can also create custom Triggers/Actions if necessary.
I have no answers for all your answers (never used MEF) but I can tell you my experience:
1- I've been in the development of a quite-large silverlight application and MVVM fits perfect to have a maintainable application. The bigger problems we had because of application size were because of Silverlight, not MVVM 8-)
2- I haven't used it too much but it's useful in many cases. There are several toolkits to use DI with Silverlight like MVVM Light Toolkit:
http://compiledexperience.com/blog/posts/blendable-mvvm-dependency-injection-and-unit-testing
4- For interaction between UIs you can use the Mediator pattern. The same MVVM Light Toolkit has a Messenger to subscribe, send and receive messages and maitain every layer decoupled.
Hope this helps you ;-)

Retired Content Model View Presenter on MSDN

I am learning to develop windows forms application with Entity Framework using Model View Presenter pattern, since it is the suggested design pattern for windows forms development on stackoverflow. On the other hand, there is a 'retired content' note on every article about MVP, on MSDN.
This is quite confusing, as I don't whether I should continue learning about MVP and try to implement it in windows forms development or there is another better design pattern that I should follow.
Any suggestion?
links:
http://msdn.microsoft.com/en-us/library/ff647543.aspx
http://msdn.microsoft.com/en-us/library/ff649820.aspx
For WinForms you should stick with MVP (Supervising Controller).
The reason you are seeing retired content is because Microsoft is heavily invested in the new Windows 8, Metro Style applications. WinRT built using C++, C# and WPF, or HTML5 + JavaScript are going to be what you will build applications in going forward, so it makes sense to learn at least one of those.
WinForms isn't officially deprecated, but don't expect it to get a lot of love from MS. I would spend some time learning XAML, and the MVVM pattern. That being said, the concepts for all UI design patterns (MVC, MVP, MVVM) are all very similar, so learning one will help you understand the others.

What is Prism for WPF?

I've come across something called Prism a lot recently. Microsoft, who run the project, describe it as
Guidelines for composite applications in WPF and Silverlight.
Even after reading the more detailed descriptions out there, I have next to no clue what it's actually about, I'm afraid.
I'm hoping here that someone could give me a clear succinct explanation of what Prism actually is and why I should learn it. I have been a WPF developer for a couple of years now, used MVVM my fair share, and have lately encountered people using Prism, but personally feel a bit out of the loop here.
In particular, I'm wondering about the following points:
Is Prism literally just (or mainly) a booklet, as given on the MSDN site? Does it include any libraries, if so for what exactly?
Is Prism an MVVM framework? Should I be using it as the "official Microsoft MVVM framework" over others out there or my own?
Does it provide dependency injection? Does it relate to MEF at all in this way?
Anything else I should know about what Prism does, as a WPF/Silverlight developer.
Prism is the Microsoft Patterns and Practices Team official guidance for building "composite applications" in WPF and Silverlight.
It's intended to provide guidance on the best practices for building large scale applications which are flexible in terms of development and maintainability.
This includes guidance on dependency injection (via Unity or MEF), layout (including using MVVM), composite event handling, etc.
Is Prism literally just (or mainly) a booklet, as given on the MSDN site? Does it include any libraries, if so for what exactly?
It is a book, but also includes the libraries for support (on the GitHub site).
Is Prism an MVVM framework? Should I be using it as the "official Microsoft MVVM framework" over others out there or my own?
Yes and no. It includes guidance for using MVVM, but is far more than an MVVM framework. It's really not, in and of itself, an "MVVM framework" - though it does include MVVM guidance.
Does it provide dependency injection? Does it relate to MEF at all in this way?
Yes. It originally included Unity, but the latest release includes using MEF for DI.
Anything else I should know about what Prism does, as a WPF/Silverlight developer.
It's worth taking a look at how they do things. They have a very elaborate "region" concept, as well as good event aggregation support. It also includes good practices for developing against WPF, Silverlight, and Windows Phone simulataneously.
It's a framework for building WPF and Silverlight apps.
http://compositewpf.codeplex.com/
It used to be called "Prism" before Microsoft renamed it to "CompositeWPF."
Answers:
1) Prism is an MVVM framework to use as a foundation for your applications
2) I suggest so depending on your specific requirements. You should post another question with specific details so you can get some specific answers.
3) Prism uses dependency injection (Unity) but does not "provide" it
4) Imo, Prism provides a lot of functionality but is heavy on the learning curve. For small projects with you as the sole developer, you may not need the abstraction and tools that it provides.
A more contemporary answer of what Prism is, is answered on the Github home page.
Prism is a framework for building loosely coupled, maintainable, and
testable XAML applications in WPF, Xamarin Forms, Uno Platform and
WinUI.
To elaborate, Prism is a collection of libraries to aid in implementing enterprise applications following Microsoft recommended best practice design and architectural patterns.
Prism consists of the following Nuget packages:
Prism.Core
Prism.Wpf
Prism.Forms
Prism.Uno
Prism supports different DI (Dependency Inversion) / IoC (Inversion of Control) techniques and libraries. It ships with the Unity library for dependency injection, with additional IoC helper functions and classes.
Some of the areas the libraries address:
Decoupled Event messaging and handling
Command
View Model Navigation
INotifyPropertyChanged implementation
Dependency Injection
Prism is part of the .NET Foundation.
You may be interested in looking at the Windows Community Toolkit, which follows many of the same principles and patterns adopted by Prism.

Do you know any real-world, useful WPF/Silverlight applications using MVVM?

I'm looking for code of full applications that (1) use the MVVM pattern and (2) are approachable for WPF/Silverlight/MVVM beginners. So far I have only found:
Crack.NET - A runtime debugging and scripting tool (useful but quite complicated)
CipherText - WPF Password Manager (perfect but written in VB.NET)
What are some others?
preferably smaller helper apps or tools that use MVVM but that have a completed feel, perhaps with WPF/Silverlight graphic/animation goodness, etc. which show not only the MVVM concepts being used but in a context of a real-world, completed application
My Contribution
Thanks for all the tips, I collected together a list of 15+ MVVM code examples and posted the here:
Overview of WPF/Silverlight code examples that help you learn MVVM.
I too class myself as a beginner in MVVM developing a large scale application for about a month now. I'm over most of the main hurdles, but keep getting confused up by a few things.
Be careful with the suggestions from Kent. They'll get you started, but the subtle differences in Silverlight and WPF will trip you up occasionally (triggers are one).
I don't know of any full sites, but I started with the Composite Application Guidance and PRISM libraries. These a little too cumbersome for a 'beginner' and just MVVM, but some of the concepts are very useful (event aggregator for example).
I suggest that you read blogs by Josh Twist, Josh Smith, Shaun Wildermuth and Nikhil Kothari. These guys are very knowledgeable. They are also very open to answering questions too.
What is your development background? Some of the concepts surrounding method calls, responses and delegation are a real break from "traditional sequential" coding techniques.
Given the question, you may be interested in the current effort going on to create a "Pet Shop" type reference implementation for M-V-VM. You can join the conversation or follow progress here.
I've been using MVVM for the last couple of months on a project and it's been fantastic. I've been doing UI work for over 12 years and it's the best thing I've come across.
I have been using MVVM for about 2 years now, and I can say that it is a resounding success. I have shipped one large-scale medical imaging solution using MVVM in Silverlight. I am also about to ship a complicated WPF application using Prism and MVVM extensively. In fact, I don't know how I'd achieve some of my problems elegantly without MVVM in this more recent application.
+1 on MVVM. It works. It is testable. It is extensible. It facilitates developer-designer workflows. It ALSO doesn't have to be messy and plumbing-heavy.
In addition, I created a medium-sized Silverlight application using MVVM for the CodeMash conference in January. You can see it and get the source code here.
Try this one. Also, Family.Show may be useful.
The WPF Disciples group has decided to create a real-world MVVM + Mediator reference application similar to the Pet Shop refence application for Web Apps. Your can follow the development on codeplex here

Resources