Refactoring: An Example

A recent project that I am rather proud of (mainly because it _is_ so simple) is the Sysnews Twitter bot. This simple program (under 300 lines of code) pulls in the Sysnews RDF and pushes it out through a Twitter account using two APIs: Twitter and Snipr. It is something I have been wanting to (and have gotten permission to) cron at work, but first I want to take some time to make the code really solid. Since is it so small I figured that it would be a great project.

Step one of the refactor is going to involve analyzing where the potential for improvement is. Technicaly speaking it is only 300 lines of code, but that is for one instance, and currently there are two running: one for current and one for future announcements. The code for each instance is hacked slightly so that they work in tandem.

Step two is to try and follow Agile practices as much as possible to build the new version (to an extent from scratch), though the algorithms of the original code will probably be used when/if appropriate.

Step three will be to post the results and fire up the new and improved croned version.

My goal is to come up with a new program that is more robust (the current script had to be taken down due to a temporary bug in Twitter), configurable, administratable remotely, cronable (i.e. part of it runs from command line), and be built of reusable code while remaining under 600 lines of code (which is both current instances combined). The reason I'm basicly doubling the allowance is because I don't want to have to calculate non-statement lines (i.e. lines that have only one or two non-white space character on them to follow coding standards ane required comment lines for class/method declarations).

Comments [0]

Trackback URL: http://blogs.lib.ncsu.edu/fabulousit/entry/refactoring_an_example
Comments:

Post a Comment:

Name:
E-Mail:
URL:

Your Comment:

HTML Syntax: Allowed