Should I use multiple assemblies for an isolated ASP.NET web application?
-
09-06-2019 - |
Question
Coming from a corporate IT environment, the standard was always creating a class library project for each layer, Business Logic, Data Access, and sometimes greater isolation of specific types.
Now that I am working on my own web application project, I don't see a real need to isolate my code in this fashion.
I don't have multiple applications that need to share this logic or service enable it. I also don't see any advantage to deployment scenarios.
I am leaning towards putting all artifacts in one web application, logically separated by project folders.
I wanted to know what the thoughts are of the community.
Let me add more information...
I am writing this application using MVC preview 5, so the unit testing piece will be supported by the separation of concerns inherit in the framework. I do like to have tests for everything!
Solution
Start with the simplest thing possible and add complexity if and when required. Sounds as though a single assembly would work just fine for your case. However, do take care not to violate the layers by having layer A access an internal member of layer B. That would make it harder to pull the layers into separate assemblies at a later date.
OTHER TIPS
I'd say it depends on how serious you are about testing and unit-testing.
If you plan to only do user/manual tests, or use basically, only test from the UI downward, then it doesn't really make a difference.
On the other hand, if you plan on doing sort of unit-testing, or business rules validation, it definitely makes sense to split up your work into different assemblies.
Even for smaller personal projects, I find this approach makes my life easier as the project goes on. I still run everything from the same solution, just with a web project for the UI, library for the business rules / application logic and another library for the DAL.
You should still separate logically layers into there proper projects.
That is a good engineering practice, whether you are just 1 developer or 100. The negative about the code all in one place is that it is going to make you refactor or duplicate code for expansion.