SitePoint Sponsor

User Tag List

Results 1 to 8 of 8

Hybrid View

  1. #1
    Chopped Liver bronze trophy imaginekitty's Avatar
    Join Date
    Aug 2007
    Location
    Pennsyltucky
    Posts
    1,494
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)

    Separating projects

    In the past I've separated my MVC solutions into separate projects. Domain, WebUI, Persistence, etc.

    Is there any reason for that if I'm just writing for myself and I'm the only programmer?

    Why not just contain everything in one project using the standard MVC folder layout?

  2. #2
    SitePoint Mentor NightStalker-DNS's Avatar
    Join Date
    Jul 2004
    Location
    Cape Town, South Africa
    Posts
    2,868
    Mentioned
    37 Post(s)
    Tagged
    0 Thread(s)
    Well, it comes down to preference. If you sure you do not need it, you do not have to do it. But I tend keep it in layers. So that in the future, if for some reason, I decide to to a mobile version of my site for example, I can just include my persistance and domain project references and would not have to copy paste all the code.

  3. #3
    SitePoint Author silver trophybronze trophy
    wwb_99's Avatar
    Join Date
    May 2003
    Location
    Washington, DC
    Posts
    10,576
    Mentioned
    4 Post(s)
    Tagged
    0 Thread(s)
    Only hard and fast rule is separating the core logic / peristance stuff from the UI layer. You never know when you need to make a command line interface to your web project's data.

  4. #4
    Chopped Liver bronze trophy imaginekitty's Avatar
    Join Date
    Aug 2007
    Location
    Pennsyltucky
    Posts
    1,494
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by wwb_99 View Post
    Only hard and fast rule is separating the core logic / peristance stuff from the UI layer. You never know when you need to make a command line interface to your web project's data.
    It is a good point. I'm making a mobile web app and I suppose I can eventually make a native app in the future. I probably never will but at least the option is there.

  5. #5
    Resident OCD goofball! bronze trophy Serenarules's Avatar
    Join Date
    Dec 2002
    Posts
    1,911
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    I find that separating the concerns into projects of their own an aide to my own thinking processes. It helps me conceptualize and visualize a layers actual responsibilities. In your case, there is a third option. Simply branch the Models namespace into Models/Domain, Models/Persistence, and Models/Presentation. Later, if you decide to pull these out into their own projects, name them MyProject.Models.Domain, MyProject.Models.Persistence and MyProject.Models.Presentation and they'll continue to work with their given namespaces, as long as you add cross project references.

    =)

    Sometimes people only see the black and white solutions, overlooking the grey, when grey is the color being sought.

  6. #6
    Chopped Liver bronze trophy imaginekitty's Avatar
    Join Date
    Aug 2007
    Location
    Pennsyltucky
    Posts
    1,494
    Mentioned
    3 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Serenarules View Post
    I find that separating the concerns into projects of their own an aide to my own thinking processes. It helps me conceptualize and visualize a layers actual responsibilities. In your case, there is a third option. Simply branch the Models namespace into Models/Domain, Models/Persistence, and Models/Presentation. Later, if you decide to pull these out into their own projects, name them MyProject.Models.Domain, MyProject.Models.Persistence and MyProject.Models.Presentation and they'll continue to work with their given namespaces, as long as you add cross project references.

    =)

    Sometimes people only see the black and white solutions, overlooking the grey, when grey is the color being sought.
    Sounds good!

    Gray is the new blackandwhite.

  7. #7
    SitePoint Member
    Join Date
    Oct 2011
    Posts
    10
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    If you are 100% sure that it will remain your internal project, and it will remain small, and there are not expected many changes in future, then it will be faster to develop all this in one project. But if you are not sure, then dividing into layers will take you some more time now, but save very much time in future, when you want to make some significant changes.

    By the way, you can divide your application into layers within one project too - just have different classes for Domain, UI, DataAccess etc, and put them to different folders so that to differ them easier.

  8. #8
    Resident OCD goofball! bronze trophy Serenarules's Avatar
    Join Date
    Dec 2002
    Posts
    1,911
    Mentioned
    26 Post(s)
    Tagged
    0 Thread(s)
    One thing I'd like to point out as a feather in the hat for separation is the ease of maintenance and deployability. It is far easier to deploy a smaller, single file named FooBarApp.Persistence.Impl.dll and have the user drop it in their bin folder than it is to redeploy an entire solution.


Bookmarks

Posting Permissions

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