Thursday, September 10, 2009

Writing Your Own Twitter Client



These are screen shots of a Twitter client that I wrote for my own use. This application allows me to log in to Twitter and post tweets without having to log in from my browser.

This application was written in C#. I put all the calls to the Twitter API in a reusable class (this application is referencing that class), and I put all the URLs to Twitter in the configuration file in case.

I also have logic for the program to reference the configuration file to determine what image should appear in the application.


Overview


A great way to get more practical experience with computer programming and software design is to design and write your own substantial application. By substantial, I mean something beyond the standard "hello world" or "add two numbers" program. One fun idea is writing your own Twitter client. Thanks to the Twitter API, you can make your own custom Twitter client.

The Twitter API


Twitter has APIs that aspiring programmers can use to create their own custom Twitter applications. In a nutshell, the APIs are accessed using HTTP, and the methods/functions return an XML response. The documentation to the Twitter APIs can be accessed here.


If you are learning a programming language, you should acquaint yourself with using the Twitter APIs. However, the libraries and wrapper classes are very handy if you are already experienced with a particular programming language and you are on a tight deadline to create an application.

Please note that if you are creating an application using one of the libraries, you will need to be aware of the usage license for those libraries. For example, if you are making a commercial application, you may not be allowed to use a particular library.

Libraries/Wrapper Classes using the Twitter API


If you want to save a little time with writing your application, numerous developers have written custom libraries or wrapper classes (based on a variety of languages) to make calling the Twitter API a little simpler. These libraries can be found here.

A C# Lab: Making a Simple Twitter Client That Sends Tweets



Custom Twitter API Libraries (based on language) - http://apiwiki.twitter.com/Libraries

Twitter API Documentation - http://apiwiki.twitter.com/Twitter-API-Documentation

I created a C# lab that will allow the C# student create a very basic, simple Twitter client using the Twitter APIs that will give the student practice with how to use the Twitter APIs. If you want a copy of that lab, you can access it here.