سؤال

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

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

Or should I stuff everything into a single class library.

What are the question that i should to self before going to build multiple class libraries.

هل كانت مفيدة؟

المحلول

Think about your consumers: If somebody might want to use the library for word files without the extra overhead of having all the other libraries, then separate them. If not, don't.

That said, keep in mind that separate assemblies is not necessarily the same as separate projects. You may want to use separate projects for each of these, even if you end up combining them into one big assembly in the end (see Single assembly from multiple projects). I've found it to be easier to manage version control on smaller projects.

نصائح أخرى

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

If you're going to be using portions of the functionality from multiple applications, and each application will only need to handle one of the files (or at least not all of them), then it makes sense to separate out libraries by file types.

However, if all of your applications will typically handle every type of file, keeping them together will reduce the maintenance overhead of your solution.

1) what (possible) other programs will reuse the same classes, and will they be deployed at the same location?

2)I have a small group of classes that have little or no dependency on the rest of the system; would it make logical sense to group them together in a class library?

Keep It Simple. If you have no technial reason to seperate, don't do it.

The answer to this is mostly personal opinions. There are many times technical reasons or "best practices" patterns and dictate how you should separate code.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top