Results 1 to 3 of 3

Thread: MVVM - Solution/Project organization

  1. #1

    Thread Starter
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687

    MVVM - Solution/Project organization

    I realize this is something of a personal preference kind of thing... but at the same time it is something of a concern.

    We're getting ready to start moving towards a MVVM (modified) paradigm here, and so I've been reading a lot of material on the pattern. I think I'm now at the point where I've got a decent handle on how it works.

    I know that part of the point is to reduce the coupling and dependency of the layers. That is the View should only know and care about the ViewModel. And the ViewModel only cares about the Model.

    To that end, I'm noticing that every example, tutorial, sample out there (that I've seen) dumps everything into the same project. They then organize it into Views, ViewModel, Model, Command, Services, etc folders. To me this just seems silly. To me, there should be some break up. I should be able to have a project that has a dozen Views in it, with references to (let's say for example) 4 VMProjects that have been previously built. Then my Views could be Silverlight, WPF, or what ever else I decide.

    Am I crazy for thinking this? How do others out there organize their M-V-XX patterned applications? Is it normal to dump everything into a single application? Or it is common to break it up? And if you do break things up in to different assemblies, what kind of structure have you used? What things have been grouped together?

    We're looking for a high amount of re-usability where we can, and one of the ideas is that we should be able to slap on different Views onto the same ViewModel. It's supposed to be one of the hallmarks of Presentation Models, and yet it seems to be overlooked a lot.

    I realize that they are patterns, guidelines in essence, I get the theoreticals... but sometimes putting those thoreticals is where things break down. Having everything tossed into the app like that seems to go against the pattern, while at the same time enforcing it.

    -tg
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  2. #2
    Frenzied Member
    Join Date
    Jul 2008
    Location
    Rep of Ireland
    Posts
    1,380

    Re: MVVM - Solution/Project organization

    Here's something that will really bake your noodle, what is to say I can't have 10 projects which are all combined into one View.

    Your on the right track though. One of the AHA moments with MV-X is realising that any of the 3 parts doesn't have to be a part per se, it just has to encompass the concept.

  3. #3
    Super Moderator jmcilhinney's Avatar
    Join Date
    May 2005
    Location
    Sydney, Australia
    Posts
    111,221

    Re: MVVM - Solution/Project organization

    What you're describing is pretty much the same as an ASP.NET MVC project. The layers are all in the same project. It's important to remember that these patterns are as much about maintainability as they are about re-usability.

    Breaking the layers out into separate projects makes each one re-usable, but if you never re-use them then you've added (a small amount of) complexity for no gain. By creating separate layers within the one project you do make that one project more maintainable, because it's far easier to see all the effects of any particular change.

    If you do happen to need to re-use one of the layers later, breaking it out into its own project is simple because of the logical separation you already have. Creating separate projects for the layers is certainly not a bad thing, but it's certainly not essential to benefit from such patterns.
    Why is my data not saved to my database? | MSDN Data Walkthroughs
    VBForums Database Development FAQ
    My CodeBank Submissions: VB | C#
    My Blog: Data Among Multiple Forms (3 parts)
    Beginner Tutorials: VB | C# | SQL

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width