Writing API in C# for My Application

api, c#

Solution

- Expose as little as you can. Every bit you publish, will return to you x100 in next version. Keeping compatibility is very hard.

- Create abstractions for everything you publish. You will definitely change your internals, but your existing users should stay compatible.

- Mark everything as internal. Even the main method of your application. Every single method that could be used, will be used.

- Test your public API the same way you would for interfaces. Integration tests and so on. Note that your API will be used in unpredictable ways.

- Maximize convention over configuration. This is required. Even if your API is a single method you will still need to support this. Just makes your life easier.

- Sign, and strong name your assemblies, this is good practice.

- Resolve as many FxCop and StyleCop errors as possible.

- Check your API is compatible with the Naming Guidelines of your platform.

- Provide as many examples as you can, and remember that most of the usage of your API will be Ctrl+C and Ctrl+V from these examples.

- Try to provide documentation. Check that you do not have GhostDoc-style auto-generated documentation. Everybody hates this.

- Include information on how to find you.

- Do not bother with obfuscation. This will help you and your users.

ADDED

- API should have as less dependencies as you can. For example, dependecies on the IoC containers should be prohibited. If your code uses it internally. Just ilmerge them into your assemblies.

Problem

I'll write a application but I've never experienced to allow people to use my application programming interface before.I mean how kinda design I should make to let people use my methods from outside world like API. Please some one show me a way.I am kinda new to this.

Original source