Folder and Project Structure in MVVM for WPF Solution

  softwareengineering

0

I know there are already questions about file structure in MVVM but I haven’t found the pros and cons for the following two structures. What would be better for a large-scale project, and why choose one over the other?
For example: In the first example both modules are dependent on projects from ‘Core’ and it would be harder to move around.

Notice: ‘Application’, ‘Core’, and ‘Models’ are folders, the level below them are projects and the level below ‘ModuleA’ and ‘ModuleB’ are folders.

Application
    ApplicationName
    Views
    Viewmodels
    Resources

Core
    EventAggregator
    Utilities
    Enums
    Interfaces

Modules
    ModuleA
    ModuleB

Application
    ApplicationName
    Views
    Viewmodels
    Resources

Core
    EventAggregator
    SomeOtherStuff

Modules
    ModuleA
        Utilities
        Enums
        Interfaces
    ModuleB
        Utilities
        Enums
        Interfaces

0

None is “better”, you need to check what fits better to your requirements.

Are your Utilities, Enums and Interfaces specific to ModuleA and/or ModuleB? Then they belong there. Or are there parts which shall be reused from several modules? Then put them under Core. And if you have both, like module specific utilities as well as cross-module utilities, provide folders for each on both levels of your hierarchy.

LEAVE A COMMENT