locked
Should multiple project be used for UI, BLL, and DAL? RRS feed

  • Question

  • User-1833980242 posted

    I have been creating my BLL and DAL with in the same project as my UI.  These have been logical tiers in their own folder with in the same project, that's with in the same solution.  I want to try to create a solution that is more like a truly multi tiered app. 

    I've heard people talk about using a separate projects for their DAL and BLL.  My understanding is that these would be separate dlls that would contain the appropriate code for each of the these tiers.  I have a few questions regarding this.  

    Is this a good way to do this?  It seems like a logical approach.  It also seems like the next step in me moving towards an architecture that's truly tiered.  Should I do this differently?

    Should the projects for the BLL and the DAL use the same namespace?  I think I read that some people use a namespace for each of these that indicates what they are, such as BLL and DAL.  Does anyone have any suggestions on this?

    Thanks in advance.

     

    Friday, February 12, 2010 6:07 AM

Answers

  • User2130758966 posted

    Hey,

    Split it up if you need to. Its good enough that you take the time to separate the layers. A lot of developers dont.

    If you have a need to put it in a separate class library in the future then you can do easily.


    One of the main reasons you would do this is to be able to use the dal in more than one website, or project. For example I have recently split a dal out into its own project so I can use it in the website and in a windows service.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 12, 2010 6:37 AM
  • User2130758966 posted

    Yeah well if you have already split your project up inside the one project you can easily split it out.

    If you are ready to make the leap then I dont see any drawbacks to splitting it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 12, 2010 8:46 AM
  • User2130758966 posted

    If I create a class library, can I make changes to it after it's been made?  Do I have to recompile it after changes and then access that new version?

    If you have created the class library and your website under the same solution (ie you can see all of your source files from both projects in the solution explorer) then you just need to click Add Reference in the Website Project and choose Projects tab then select your class library.

    That way every time you run the main website it will auto compile the class library and copy the assembly (dll) over to your main project.


    If you are wanting to use the Class Library in several solutions and you dont have the class library project linked directly in, but just have it added in via add reference then you will have to recompile it separatly for the consumin project (website) to see updated code. However when you add in the reference to the dll it will get a .refresh file with it so the latest compile will always be pulled in automatically...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, February 27, 2010 1:27 PM
  • User2130758966 posted

    Forgot to answer the second question...

    Do you have any recommendations for Namespaces with the BLL and DAL in separate projects?  I was thinking about using a namespace that represents each of the projects to make it more readable and easier to understand.  They would probably include the BLL or DAL in them

    It doesn't really matter that much, whatever feels right at the time really.

    I have used DataLibrary, DAL, Entities and probably others in various projects.

    In the DataLibrary project I also broke this down into sub namespaces like DataLibrary.Gateway.Paypal, DataLibrary.Entities, DataLibrary.RemotePost, etc.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, February 27, 2010 1:29 PM

All replies

  • User2130758966 posted

    Hey,

    Split it up if you need to. Its good enough that you take the time to separate the layers. A lot of developers dont.

    If you have a need to put it in a separate class library in the future then you can do easily.


    One of the main reasons you would do this is to be able to use the dal in more than one website, or project. For example I have recently split a dal out into its own project so I can use it in the website and in a windows service.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 12, 2010 6:37 AM
  • User-1833980242 posted

    I want to learn WCF eventually.  This seemed like a good step in that direction.  When I start using WCF my tiers will need to be in seperate dlls so they can be accessed by WCF, won't they?

    Friday, February 12, 2010 7:02 AM
  • User2130758966 posted

    Yeah well if you have already split your project up inside the one project you can easily split it out.

    If you are ready to make the leap then I dont see any drawbacks to splitting it.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, February 12, 2010 8:46 AM
  • User-1833980242 posted

    If I create a class library, can I make changes to it after it's been made?  Do I have to recompile it after changes and then access that new version?

    Do you have any recommendations for Namespaces with the BLL and DAL in separate projects?  I was thinking about using a namespace that represents each of the projects to make it more readable and easier to understand.  They would probably include the BLL or DAL in them.  

    Friday, February 12, 2010 3:14 PM
  • User2130758966 posted

    If I create a class library, can I make changes to it after it's been made?  Do I have to recompile it after changes and then access that new version?

    If you have created the class library and your website under the same solution (ie you can see all of your source files from both projects in the solution explorer) then you just need to click Add Reference in the Website Project and choose Projects tab then select your class library.

    That way every time you run the main website it will auto compile the class library and copy the assembly (dll) over to your main project.


    If you are wanting to use the Class Library in several solutions and you dont have the class library project linked directly in, but just have it added in via add reference then you will have to recompile it separatly for the consumin project (website) to see updated code. However when you add in the reference to the dll it will get a .refresh file with it so the latest compile will always be pulled in automatically...

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, February 27, 2010 1:27 PM
  • User2130758966 posted

    Forgot to answer the second question...

    Do you have any recommendations for Namespaces with the BLL and DAL in separate projects?  I was thinking about using a namespace that represents each of the projects to make it more readable and easier to understand.  They would probably include the BLL or DAL in them

    It doesn't really matter that much, whatever feels right at the time really.

    I have used DataLibrary, DAL, Entities and probably others in various projects.

    In the DataLibrary project I also broke this down into sub namespaces like DataLibrary.Gateway.Paypal, DataLibrary.Entities, DataLibrary.RemotePost, etc.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Saturday, February 27, 2010 1:29 PM