Sergio Tapia
Sergio Tapia

Reputation: 41178

How should I make a library (.dll) file for other devs to use in their projects using C#?

Sure, there's a type of project in Visual Studio that outputs a DLL that people can use. I know that. I'm just wondering what are some of the standards that devs will expect when using my DLL file.

I'll be providing a class that searches for movies in IMDB and returns results for a dev to consume.

Not a webservice, but a local DLL file. (I'm aware that IMDB frowns upon web scraping, but I'm also aware that they give permission to people if asked. My permission is already sent.)

How should I approach this?

Upvotes: 3

Views: 200

Answers (6)

MusiGenesis
MusiGenesis

Reputation: 75336

Check out Microsoft's Design Guidelines for Class Library Developers.

Or the newer version of same (thanks to paper1337).

Upvotes: 10

JBRWilkinson
JBRWilkinson

Reputation: 4865

  1. Easy-to-use API with appropriate class, method and property names.
  2. API has been tested (e.g. unit tests)
  3. Supporting documentation.

Upvotes: 0

user1228
user1228

Reputation:

If you, or anybody, is serious about creating a good framework for others to use, check out http://www.amazon.com/Framework-Design-Guidelines-Conventions-Libraries/dp/0321246756

Upvotes: 1

Ramesh
Ramesh

Reputation: 13266

What ever you make public, should remain public and their signatures cannot be changed in your next version and you must support it forever.

So, take care in establishing your contracts and document them with examples. Make public members only if it needs to be.

Upvotes: 0

Pete OHanlon
Pete OHanlon

Reputation: 9146

You need to provide a simple to use API, full documentation and worked examples as a minimum. If you can provide unit tests that would be a bonus.

Internally, you need to verify all inputs into your routines, as well as clearly document what configuration the user is expected to do. Solid exception handling is a given, and you should possibly consider some localisation support in there as well.

Upvotes: 2

user151323
user151323

Reputation:

You're then interested in best practices when designing a class library. There is much to say to this thema.

One of the first and foremost things you need to do is to publish all your dependencies. Avoid any hidden dependencies in your code.

For example, don't rely on some key to be set in a shared key-value collection, such as Session. There is no way a user of your library can find it out.

If some method requires some service to be preinitialized, require a valid reference to be passed as an argument.

Upvotes: 2

Related Questions