André Miranda
André Miranda

Reputation: 6588

One DLL for each project or for each module?

I'm used to work on solutions with 3-layer projects (some solutions have more than 3 projects). Most of them are ASP.Net MVC solutions, so many of them have theses projects: Site, Business and Data. So, 3 DLLs will be created, right?

These days I was wondering if my Business layer should be just one DLL or should I create a DLL for each module in this Business layer, e.g., Product.DLL, Order.DLL, Customer.DLL and so on.

I was thinking that if the App has an error in the Business layer related to, for instance, product, I could only deploy a Product.DLL, instead of deploying the whole Business.DLL.

What are your opinions about that?

Thanks!

Upvotes: 1

Views: 347

Answers (2)

Damien_The_Unbeliever
Damien_The_Unbeliever

Reputation: 239724

You can write 3-layer code within a single project, if it's a small system. You can spread a system across many DLLs, for large systems.

For smaller systems, it may be sufficient to use namespaces to distinguish the layers. There's no one-size-fits-all recommendation.

If you buy into this mindset, then the DLLs will usually be a physical artifact rather than a logical one - which components version together and should deploy together and/or which components require physical separation.

Upvotes: 5

oleksii
oleksii

Reputation: 35905

Unless you have extra large business layer, I would refrain from splitting it into multiple dlls. This can bring unnecessary complexity into your project.

However, if you are doing an enterprise system say for a bank, and each project contains independent logic, then you may need to split it.

Upvotes: 1

Related Questions