When to use multiple class libraries?

When should I use multiple class libraries in .NET. I have a situation where I need to use the functionality of the Microsoft Office Object Model to validate certain attributes of Microsoft Office files. Should I use different class libraries to handle different types of files.

eg:- 1 library for word files, 1 library for ppt, so on. 

Or should I put everything in one class library.

What is the question that I have to do myself before building several class libraries.

+4
source share
4 answers

Think about your customers: if someone might want to use the library for text files without the extra overhead of having all the other libraries, separate them. If not, do not do this.

However, keep in mind that individual assemblies do not necessarily coincide with individual projects. You can use separate projects for each of them, even if in the end you combine them into one large assembly (see the Single assembly of several projects ). I found it easier to manage versions on small projects.

+5
source

It depends a little on how and where you plan to use this functionality.

If you intend to use part of the functionality from several applications, and each application will need to process only one of the files (or, at least, not all of them), then it makes sense to divide the libraries into file types.

However, if all of your applications tend to process all types of files, sharing them will reduce the cost of maintaining your solution.

+2
source

1) what (possible) other programs will reuse the same classes and will they be deployed in one place?

2) I have a small group of classes that are little or not dependent on the rest of the system; would it be logical to group them together in a class library?

+1
source

Itโ€™s easy to save . If you do not have technical reasons for separation, do not do this.

The answer to this is mainly personal opinions. There are many times the technical reasons or patterns of โ€œbest practiceโ€ and dictates how you should separate the code.

+1
source

Source: https://habr.com/ru/post/1344158/


All Articles