views:

108

answers:

6

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?

+2  A: 

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.

Developer Art
OK, thanks for the help. With dependancies, you mean what a dev will have to provide my DLL for it to function correctly?
Sergio Tapia
+9  A: 

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

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

MusiGenesis
+1. This is the definitive guide to class and class library design. These are the basic standards that every .Net developer should be familiar with. This is common ground so no matter what employer you go to, if they're a .Net development shop, then their standards are very likely to be very close to these guidelines.
David Stratton
The significantly revised version that "applies" (according to MS anyway) to .NET Framework v3.5 can be found at http://msdn.microsoft.com/en-us/library/ms229042.aspx
Chris Shouts
+2  A: 

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.

Pete OHanlon
A: 

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.

Ramesh
+1  A: 

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

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