Good Sites that are describing about MVVM Pattern - c#

i started the learning MVVM pattern. So could anybody help me to list Some Good Sites that are describing about MVVM Pattern.
thanks in advance.

This article by Josh Smith is what made MVVM clear for me.
Make sure you grab a copy of the source and look through that as well.

These two articles are both good introductions to MVVM:
http://johnpapa.net/silverlight/5-minute-overview-of-mvvm-in-silverlight/
http://csharperimage.jeremylikness.com/2010/04/model-view-viewmodel-mvvm-explained.html

Here´s a good video where Jason Dollinger builds a small WPF application based on MVVM. I found it very useful.

Here's one from MSDN Magazine about using MVVM in WPF. WPF is similar to Silverlight, so it should apply to what you're trying to do with minimal changes.

CodeProject: A Practical Quick-start Tutorial on MVVM in WPF

I like this demo from Jeff Procise. His focus when he was writing it was on commanding, but it's a good illustration of MVVM as well. Small, but it gets the layering right, and will help you start thinking about how your layers communicate and work together.
In any case, code is 100x as useful as reading. Once you've read a few articles you've read them all, and your time is better spent looking at lots of small applications to see how they do it.

Related

Silverlight MVVM example which does not use data grids?

I was wondering if anyone knew of a great example of using the MVVM pattern for a Silverlight application that does not utilise a data grid?
Most of the examples I have read see links below and books such as Pro WPF and Silverlight MVVM by Gary Hall use a silverlight application with a datagrid. Don't get me wrong, these are all great examples.
See also:
MVVM: Tutorial from start to finish?
http://www.silverlight.net/learn/tutorials/silverlight-4/using-the-mvvm-pattern-in-silverlight-applications/
However some recent demo projects I have been working are not necessarily dealing with data grids but I would still want to implement this pattern..
This Stack Overflow question contains a lot of examples in the answers you may find useful. Good Silverlight-MVVM Practice Example
If you download Prism which is a composite framework for building Silverlight based MVVM applications, you will notice that it comes with compilable/runnable examples which make use of the framework and are great examples of MVVM.
On a side note focus on understanding MVVM concepts with disregard to Silverlight as the methodology is applicable to other technologies and is not a Silverlight only methodology. This will broaden your results as you begin searching for an understanding of what MVVM is.
I have just been writing a serious of blog posts about Silverlight, RIA, POCO and Oracle. At our work we don't have the luxery of SQL Server or the Entity Framework, so we had to figure out how to make RIA work with Oracle.
In the process, I wrote a sample application to explain all that we learned. It uses MVVM. You can check it out here (there is a datagrid involved, but it's on a secondary tab - it's not the main focus of the application).
http://www.chrisholmesonline.com/2011/01/13/silverlight-ria-services-with-poco-oracle-part-i/

Learning WPF and MVVM

I have recently joined a new developing project building a thick client application using WPF and MVVM. I have developed applications in various .NET frameworks from 1.1 through to 3.5 and all major technologies; WebForms, MVC and WinForms. On all of my projects I have enjoyed every minute of it but on this project I feel that I am struggling and as such not enjoying it as much. When .NET 3.5 came out in 2008 I really enjoyed learning the new language features (LINQ, MVC, Lambda Expressions, etc) and dabbled in WPF so please don't assume I'm against learning something new.
But the learning curve on this project seems really steep and I feel that learning MVVM on top of WPF + the application is a little daunting. Although I have only been on the project for a short time (2 weeks) I really like WPF but have taken a disliking to the MVVM pattern. My disliking to the MVVM pattern may because I don’t really understand it and I feel that I have to write a lot of “non best practice” code in order to do what was relatively simple in my WinForms days.
So my question is has anyone else faced a similar situation and did you stick with MVVM or go in another architectural direction?
I have been working with WPF since the beta versions and I would never go back to winforms. To me MVVM is a philosophy and it takes a lot of work and discipline to implement it faithfully. It encourages complete decoupling between UI and interaction logic which means no code behind whatsoever which means testable interaction logic which is very difficult to do with winforms.
In contrast to gius I would recommend you stick with plain WPF and MVVM especially if you are just starting out with WPF. There is a lot to grasp with MVVM and WPF, adding to that will just slow down your progress. But that's just my opinion. I always prefer to layer my learning rather than try to learn everything at once that way you are in control and you have more knowledge about how your application works.
If you have not already done so I strongly recommend you read the MS article on MVVM :
http://msdn.microsoft.com/en-us/magazine/dd419663.aspx
Its fantastic and it is compulsory reading for my team members who write any WPF code.
I am not sure how you and your team work but you need to ask yourselves whether or not MVVM is for you. If unit testing / test driven and decoupled UI is something you are already doing or is important to you then MVVM is definitely a good path to take. If your team is happy with writing code behind and you don't see why you should bother decoupling then don't bother with MVVM as you will find that it will slow you down. Personally the latter is never an option for me.
Please feel free to contact me if you have any specific questions about WPF or MVVM.
I have faced a similar situation, and the route I decided to go was:
Use ViewModels for my views, but avoid some MVVM pureness, like Attached Behaviors (which I find dumb and clunky)
Use Magellan MVC framework, which fit best my mental model about how an applications should behave.
I started learning WPF and quickly came across MVVM - it seemed like such a good fit that I've stuck with it. It's probably worth pointing out that there do seem to be some differences in the ways people implement MVVM, a key one being View-first or ViewModel-first. Some seem to see this as a point of gospel - I don't have enough experience to decide if it should be. I tend towards View-first (so View has a reference to ViewModel and ViewModel has a reference to Model and none in the other direction) but I have come across a scenario where the other way was easier.
Why not post some questions around the specific points you see as non-best-practice. It might help others wrestling with this subject as well.
One other question: are you using a specific framework for MVVM?
Well, before using MVVM, I used MVC in ASP.NET MVC framework. The Model-view-controller architecture is pretty obvious there so it helped me to change my attitude from standard ASP.NET and WinForms.
MVVM is a little bit "harder" to understand, but once you realise that WPF differs from web (you as a user respond back to the view, not to the controller), it makes sense to move from MVC to MVVM.
I suggest reading articles about MVVM on homepage of Caliburn project (left column, part 3. Study in MVVM) - this helped me a lot.
Regarding WPF (Silverlight) applications, I would strongly recommend to start building applications right on top of PRISM (Composite WPF) and/or Caliburn - although it might be confusing from the beginning, still it is a much better choice than with vanilla WPF (speaking about practices they force you to use). But take it for sure that once you have finished your first WPF application, you will want to rewrite it from scratch. But that's how it works when you learn a new technology.
MVVM is just a design pattern. You do not need it unless you are comfortable with WPF. If you are learning WPF, I suggest you first complete the book, then learn about MVVM. If you try learning both, you would try to implement MVVM in every simple WPF app or do not understand some feature of WPF that MVVM uses.
P.S: I came to this conclusion when I faced the problem myself. I still do not understand how the ViewModel can create a new View if it knows nothing about it.
WPF has a steep learning curve. So does MVVM. Which explains the feelings you have: getting to grips with both XAML and MVVM and trying to produce a real-world application at the same time is a daunting task.
I've trained .NET developers like you and helped them go over that learning curve quickly. Then packed that training into a quick-read book that you can get here:
Learn WPF MVVM ebook
Learn WPF MVVM paperback
It's also available on Amazon and major book sites.
Sorry if that sounds like self-advertising, but I really believe this books is 100% appropriate for your profile.

How did you learn/Best Way to learn Silverlight

SO i have searched on stackoverflow and there does not seem to be any answers for this. So if you can, What is the best way to actually fully learn silverlight? I have books on it but it seems by the time you get to Chapter 15 out of 30 chapters you already sort of forgot what you learned and have to start again. Trying to jump right in seems more frustrating since you don't have any idea what the tools at your disposal is or how to construct things.
Visit the silverlight website it has a lot of tutorials and samples.
http://silverlight.net/
Find or make up a small project where you can use it. Try and find a friend or someone you know to help you learn.
The only issue with the books is that some of the content gets out of date quickly because of the quick releases!! :)
If you have played with WPF that will help. But if not the best way is to just get your hands dirty with silverlight as quick as possible..
Silverlight rocks!!
PS. Have a look at Pete Browns Silverlight 4 in Action book published by Manning.
http://www.manning.com/pbrown/
I learned by diving in and building an application, along with a book (Matthew MacDonald, "Pro Silverlight 2 in C# 2008", ISBN 9781590599495) and lots of googling, watching videos, www.silverlight.net, and some help from Stack Overflow.
But I guess it really depends on how you learn best, and what you want to do with it.
The basics of it come down to knowing XAML, Blend (maybe), and how to build services.
I found it a steep learning curve, but now have a fairly major line of business app in production. I find that it's certainly a lot more productive than trying to build a similar app using browser technologies (HTML/Ajax/jquery, etc.)
Hope that helps...
http://silverlight.net has a bunch of short "how do I" videos. Watch them with VS2008 open and play along. A book is OK, but Silverlight 4 is just around the corner.
Start by coding a small silverlight application - this would be the best way to learn, hands on.
I jumped right in with a big LOB project. There were books that were suggested to get the team started, but I never read more than the first couple of chapters of any of them. I don't learn as well that way as I do just writing lots and lots of code. It was a little challenging in the beginning but ultimately I've found Silverlight to be easy to use.
If you learn by doing, maybe try some of the tutorials or video demos, but then just write lots of code. Pick a small application and build it.
Got dropped into Silverlight project with short deadline :) Then with "trials and errors" mostly.
But my first step after joining project was this page (already mentioned by others):
http://silverlight.net/getstarted/ . Good stuff there for starters.
It took me three full reads of my first PHP book before I understood it.
Is this the first time you have come accross the likes of silverlight? If you have experience in other languages you will find it a lot easier.
But, my point is that you should not give up. Keep reading and re-read it all again.
I would recommend that you try and follow a book front to back and then try and follow all of the examples. Then code a simple application and when you have finished it, code another. I have coded something, then realised my implementation was awful and then did it again.. you really do learn a lot this way.
I would find a couple of Silverlight Demo apps, and go through the source. Then I would define a very simple project, and as was suggested by others, and code a complete little app. Then I would read the best silverlight book available, that you then would have a much better basis for understanding and remembering. Then I would throw the app away, and do it again with the experience and knowledge you got from the first iteration.

Any guildelines for coding Winforms applications, especially UI in C#/.net?

I wonder whether there are some guidelines that I can use for coding Winform applications in .net, preferably in C#?
For example, when I initialize data bindings for a form, shall I put the initialization code in the loading event of the form or in the constructor of the form? What is the correct way of adding controls/components from code rather than from designer? (Improper way may lead to undisposed controls/components). This sort of things.
Thanks for the help in advance.
I know you're asking specifically for WinForms, but the classic first stop resource for design guidelines should be the Design Guidelines for Class Library Developers.
Once you have a good handle on that, you should be in a better place to answer questions specific to WinForms development like the ones you're asking based on these guidelines.
I would suggest you study someones (a skilled programmer) code. If you can find someone whom you personally know it would be even better. There are often small things that are not covered in guidelines but they does make a difference.
It's bit old, but if you are doing WinForm development, I highly recommend the following book, 'Windows Forms 2.0 Programming' by Chris Sells and Michael Weinhardt. I used the previous edition when I first learned how to do WinForm programming and it helped me a lot.

MVVM WPF Application Developer skill set

What kind of skills should a WPF developer know to create MVVM applications?
Things like Attached Dependency Properties and DelegateCommands.
Thanks!
There's a good intro video/screencast on WPF and MVVM on Ch9; http://channel9.msdn.com/shows/Continuum/MVVM/
DataTemplate for sure.
Binding. Followed closely by general WPF concepts.
Knowing a bit about similar patterns like MVP and MVC would also help.

Categories

Resources