Monday, June 13, 2016

How to build a client-library in a programming language of your choice.

Recently I've finished the alpha version of a library-client in Rust for IMAP protocol. It's available at github at

If you wanted to create the same kind of client library for another protocol, say, FTP, how would you go about it? Here's the steps.

1) Pick a programming language.

2) Find the libraries that have already been implemented for FTP in this language. Examine them. Are they big? How much time will need to build your library? Can you beat them?

3) Do the same thing but for the libraries in other programming languages.

4) Grab the specification of FTP. Usually most of the network specifications can be found at After you've gotten it, read it.

5) You try to come up with the API interface of your library which consists of the methods and entities.  Creating the API interface has more to do with your experience as there're no strict rules of how to build decent them and it's all subjective.

For example, in IMAP there's a command called "select". It returns a vector of strings which are flags or labels in the terminology of IMAP.  This implies that your interface might also have a method "select" as well and, probably, you should create a specific data-entity for its return That being said, you can also decide to keep it more simple and make your function "select" return a vector of strings. Both are correct, but in my eyes the 1st approach is better and that's how it's done in my Rust IMAP library.

6) Get a test account to test your library along the way. For my library I've registered 2 ones on different email servers.
7) Start building the library. Don't try to make it perfect right off the bat in the 1st version and instead address the functionality and pace of the development process. There's no finish line and you can always fix what's not perfect in the future releases.

8) Test it as you work on it. Push to github.

9) Publish it to the central repository. For instance, for Rust it's, for Ruby it's

10) Make the announcements on the forums.

11) Get the feedback from your users, fix the bugs, change the library accordingly if you think you need to or the users asks you to do so.

12) Keep improving it and publishing new releases. 

No comments :

Post a Comment