What does a DesignNavigationService do? (related to MVVM Light toolkit) - mvvm

In the special Window 8 edition of MSDN Magazine (http://msdn.microsoft.com/en-us/magazine//jj651572.aspx), Laurent describes initialize his SimpleIoc container, and also describes how to implement navigation from the ViewModels using a NavigationService, which implements INavigationService.
However, in Figure 6, (which he says illustrates how to register the service), his code snippet clearly refers to a design-time NavigationService, named DesignNavigationService, which I presume is to support "Blendability" (Laurent is very big on supporting Blend, and I appreciate that).
Does anyone know what is different about a design-time navigation service? There's no other mention of it in the article, and a few Bing searches turned up nothing useful.

Found the answer in the sample code that was published in conjunction with the article.
In the DesignNavigationService class, there's this explanatory comment:
// This class doesn't perform navigation, in order
// to avoid issues in the designer at design time.
Which, given that the ViewModel classes may be running a little bit at design time, makes sense, now that I think about it.

Related

Can a framework be considered a class of classes?

I have seen this question What is the difference between a class library and a framework
and throughout all the provided answers, the framework is always referenced as a framework. I am looking to get more technical. What exactly is a framework? A class of classes that control all functionality and provide ultimate abstraction and the ability to customize it? I am just looking to understand what exactly a framework is, as far as initializing it, not just what it accomplishes, but how exactly it is implemented. How I believe it's used/implemented is listed below.
variable = Framework() -> Reference the variable
Framework is an infrastructure, ready-made and predefined, with some particular rules of the game on the "development field", according to which, you can build your application, on top of it, by "playing with framework rules" (you can, at some extent, customize those rules).
Spring MVC is a good example of Framework. You don't control how the View Resolving, Dispatching or Template Rendering happen and achieve a goal together.
Think of this as a big machine, where you can plug in and integrate your components which are applicable to that machine.
Library, on the other hand, is just a set of classes, which provide already implemented functionality out of the box, in order to not start inventing the bicycle again and again.
Apache Commons is a good example of the Library. It has a lot of ready tools and functionality to facilitate your work with String objects.
Think of this as a set of instruments and tools, using which, you can build your own machine.
With respect to how it is implemented question. This is like asking how the Boeing A220 is built?. I'm not sure anyone can describe here how the Framework is implemented in the details. But if I understood uour point about whether the Framework is used via classes, then:
Framework might provide some classes as an abstraction, yes, but it's not about them, it's more about mechanics of the entire system. The main thing it provides is the mechanism and mechanics of how the system is designed to work.

Should GUI classes be included in class diagram in UML

I need to develop a system for a library system from Java & Netbeans. I am wondering do I have to include classes made from Netbeans for user interfaces in the class diagram. In addition to that suppose we have a class "Librarian". I assume that I can create two classes one for UI and one that including details in the class diagram and use it in the UI class. Or I can implement, what class diagram says directly in the UI class for "Librarian". Please tell me which is the correct way that software engineers are supposed do.
Whether or not to show something in a class diagram depends on the intention of the editor and what he wants to show to his audience. Often it's a good idea to create overview diagrams where you omit details. The overview is then accompanied by a couple of detail diagrams which are logically oriented at sub-domains which in turn help to understand the systems as a whole.
Also it's not uncommon to just leave out "obvious" things. If you work with known scaffolds in certain domains you must not describe that again and agin but just can assume that it's known. In your case that would be the GUI part which will be known implicitly. You might consider to create a sketch of the scaffold somewhere in a more general class diagram. This could be helpful for people coming from other worlds (and not knowing NetBeans like me).
Beware of drawing wall-papers that contain each and every detail in a single class diagram. Looks impressive but is absolutely useless (an anti-pattern if you like to call it that way).

Get rid of proxy properties in the VM?

I am learning MVVM now and I understand few things (more than but few are here..):
Does every model potentially exposed (thru a VM) to the View is having a VM?
For example, if I have a Contact and Address entity and each contact has an Addresses (many) property, does it mean I have to create a ContactViewModel and an AddressViewModel etc.?
Do I have to redeclare all the properties of the Model again in the ViewModel (i.e. FirstName, LastName blah blah)? why not have a ViewModelBase and the ContactViewMode will be a subclass of ViewModelBase accessing the Entity's properties itself? and if this is a bad idea that the View has access to the entity (please explain why), then why not have the ViewModelBase be a DynamicObject (view the Dictionary example # the link page), so I don't have to redeclare all the properties and validation over and over in the two tiers (M & VM) - because really, the View is anyway accessing the ViewModel's fields via reflection anyway.
I think MVVM was the hardest technology I've ever learned. it doesn't have out-the-box support and there are to many frameworks and methods to achieve it, and in the other hand there is no arranged way to learn it (as MVC for instance), learning MVVM means browsing and surfing around trying to figure out what's better. Bottom line, what I mean by this section is please go and vote to MSFT to add MVVM support in the BCL and generators for VMs and Vs according to the Ms.
Thanks
What a telepathy!
I enjoyed so much reading this great article of Robert McCarter's, he talked just about what I felt painful with! especially about the proxy-properties (now I even know it's name...).
I would warmly recommend this article to every MVVM confusee (like me - I am sure there are a lot!)
1/2) Like with most programming problems... It all depends.
It depends upon how you've linked together the ideas. You can re-expose the needed model properties in the view model if it fits your needs. Hide model proporties that you don't want the user to interact with like a DB key. You can put the model validation logic in the model or the view model. It all depends on what works for you and your situation, which is why it is hard to directly answer the question.
I am using the ViewModelBase for functionality shared by ALL of the ViewModels. I've been using the base object to handle INotifyPropertyChanged code and little else.
3) Take a look at Karl Shifflett’s web site. Karl has a bunch of code you can look at. Stuff and BBQ Shack are working MVVM projects. He also has a complete MVVM training module here.
I'd post some links, but I'm limited to 2 links per post.

How to: Multi screen/regions Silverlight application?

I have to create now a multi-screen Silverlight 4 RIA application with MVVM.
Each of these screens has to be devided in multiple regions (for example master-detail scenario whereas each of them is a different section and one has control on the other).
Can you give me some ideas what should be the right way to implement such an application?
Is Prism the right choice? I started reading the Prism manual and liked very much the idea of having regions and screens switched and controls in a very flexible manner, but, as said above, I find it too overkill to split it all over many assemblies.
If Prism IS the right choice, then I would appreciate any kind of guidance or reference to guidance on this particular scenario (multiple screens & regions and OTOH not getting my solution spotted with a gazillion projects.
I believe that PRISM is the correct choice for building an application with multiple regions and views. You could argue that that is almost the definition of a composite application.
But I would also remember that you don't have to use all the components PRISM has, you can pick and choose. I would recommend that you consider each aspect of PRISM and test/prototype to ensure you are happy with the facilties offered. In a large application I have built I use PRISM but after some prototype investigations I only used EventAggregator and the Modularity capabilities.
I chose not to use the region support as I found working with ItemControl and ContentControl components in Silverlight gave me the ability to inject views and partial views into my interface.
I found experience from ASP.NET MVC proved useful in considering how to coordinate/break up my UI into partial views.
Hope that helps. The Stocktrader application is a great example to learn from (included with the PRISM distributable).

How can I avoid having to write boilerplate code?

Well, I've been following the NerdDinner tutorial online and I've completed it to a T.
Now I've implemented a project of my own using pretty much the same architecture.
I notice my process is:
Create database.
Create DBML.
Create |TableName|Repository.cs class with data access methods.
Create partial |TableName| class to handle validation.
Rinse and repeat for all tables.
By the time I'm done I'm exhausted and I haven't really done anything except drag and copypaste code and change variable names.
What am I missing here. Where can I improve this boilerplate haze I'm in?
Edit: Sans creating my own T4 template, is there a tool that will help me?
See Visual Studio Templates.
I haven't used them, but I assume if you take the time to customize them, you'll be able to make Visual Studio generate a lot of what you already do instantly specifically using the T4 template language/interpreter thats embedded in Visual Studio.
I haven't used it much but perhaps you could create a codesmith template to handle this. http://www.codesmithtools.com/
I have seen it used to good effect with Nettiers and in some other scenarios.
Have a look at this for ideas. It uses a generic repository and the unit of work pattern.
http://elegantcode.com/2009/12/15/entity-framework-ef4-generic-repository-and-unit-of-work-prototype/
Also here.
Advantage of creating a generic repository vs. specific repository for each object?
I've implemented something based on these ideas. You may also want to look at using a service layer more interfaces etc than the nerd dinner example shows.
As good as the tutorial is, it isn't IMO really fit for use in an enterprise application as it is still quite tightly coupled.
Hope this helps.
I use my own tool for that: http://github.com/Necroskillz/NecroNetToolkit
It basically bypasses all the steps that u mentioned (except validation, because I have validation on my view models).
While its not directly MVC focused, I've enjoyed using NetTiers http://nettiers.com for this kind of foundation. We start with the Db tables and indexing and then generate the stored procedures and their related data and service layer code. After that we add our own custom stored procedures, creating a rich (and easily understood) foundation. Future changes are easily accommodated through this mechanism.
We also bolt the code generation into our Nant build procedures, providing a very quick way of updating all of the mundane 'plumbing' code, allowing us to concentrate on the interesting stuff.
We've just started working with MVC and have found the netTiers service layer works nicely with it - time will tell as our MVC experience grows. I hope that helps!
Create a framework!