Need some Simple Code
-
Glosse wrote:
MVM seems to fly in the face of the KISS principle.
The MVVM principal is actually reasonably simple. The problem, I think, with peple's taking up of it is that it isn't something you can just become an expert in in a couple of days - you need to have the time to play with it and get to know your way around - and decide how YOU want to do it. It took me a few months from first reading about it to actually having something I felt comfortable enough to use in the real world. I still don't use it enough to make is second nature (because i can't use it in my current day job) but if I was starting a new project, and could, I would certainly use it.
Glosse wrote:
MVM seems to fly in the face of the KISS principle.
There are a lot of articles out there showing people how to overcome difficulties using MVVM, or how to achieve something using MVVM that, I think, make it look far more complex than it is in fact. many people misunderstand MVVM (the 'there must be not code behind' ers being a majority group!) Again, once you have been using it for a while, you start thinking about projects differently and it becomes 2nd nature.
Glosse wrote:
What are the benefits?
In my experience, especially as a consultant, the user is never, ever, happy with the project they receive. it can do all the clever things that they never even thought of, technically it can be doing something in milliseconds that other systems take many seconds to do, and can have a small memory footprint, be self updating and extensible - but the customer doesn't like that shade of green, would like the fonts bigger, hates check boxes and wants radio buttons, and so on. Designed with MVVM, the presentation can be changed, leaving the functionality alone. The application still does just what it used to , but now looks different. Indeed, with the right set up, you can display design time data, and sit with the user to show them as you develop, without writing code (or, at least, not much)
Glosse wrote:
In the middle ages wearing a hair shirt or self flagelation were thought to bring you closer to God.
I appreciate what you are saying - are the MVVM evangelists just that - evangelists who have faith and want to spread the word? Do they just 'believe'. I can't speak for others, but my exper
_Maxxx_ wrote:
many people misunderstand MVVM (the 'there must be not code behind' ers being a majority group!)
There really doesn't need to be in most cases. Most of the time I have seen code behind, its been that the developer was lazy and didn't have a strong enough framework. I just wrapped up an MVVM project and didn't have *ANY* code behind. I mean ZERO. All windows, dialogs, controls, etc. had the code behind .cs DELETED. Not even a call to InitializeComponent() :). I have a generic event -> command mapper in my framework, so I just use that in the XAML and I pretty much end up with as much code as I would if I would have done the code behind -- except I don't have code behind. I know its not a requirement of MVVM, but I just don't like it. It makes me feel like I'm splitting a class between 2 .cs files and I'm going to use up a lot of my time deciding if a method should go in the VM or in the code behind. Now, I realize that if you need code to manipulate the visuals, it shouldn't go in the VM... but thats just another case of the developer being lazy. If you *really* need code to manipulate visuals, you should make it a generic / reusable control, not part of the view.
-
Hi; I have been wrestling with microsoft's changing standards and technologies like many of us. with that I was really not prepaired when silverlight 3/4 came out and WPF. I'm a winforms guy. So I have been looking for an example of a project that will show me how to use an MVVM pattern with WPF with an Icommand in it. That may seem trivial to most here. but I just have allot of problems with the databinding concepts and the viewmodels. I would like to create a control that I can host in a window that is XAML and have that control connected to a viewmodel and use ICommand for the clicks and such. Everyone adds their own classes and it seems to clutter up the core concept for a rookie. I would like to use a WCF service to fill the UI with data and back and forth. Can someone furnish me with some info on this. this may need a couple of tutorials or just one good one to get me off to the races. I want to use the ICommand so that I will be able to use some of that MVVMness with Silverlight 4. I thank you in advance for your help. Blessings and regards -Peter ;)