User ident on the XVBT forums asked for some comments and suggestions about his project. I took a look at it and decided the number of comments sans explanation of fixes would exceed the size of a post, so I asked if I could join the project and make some lessons out of refactoring it.
The project itself is a neat little tool for automating ImageShack uploads. On the outside, it looks pretty slick. After inspecting the code, I have a bad feeling that it doesn’t work anywhere near as slick as it looks, but that’s why I’m here. The application is an almost perfect example of what WinForms development does to suppress good software design practices. In this ~3,000 line application, 2,600 of the lines are in ClientForm
, the main form of the application. This form is responsible not only for UI interaction, but all of the application logic. There’s many other errors that are more related to what happens when a novice writes a large application than what WinForms inflicts upon you: dozens of unused methods, huge areas of commented-out code, no consistent naming conventions, etc. There’s at least a wrapper for the ImageShack API, but I haven’t peeked inside of that yet to see if it needs some work as well. It looks like it was lifted from a blog by a man named Bryce Thomas, then converted from C# to VB. I’m not sure if any attribution is currently given; if not I’m going to fix that.
The code for the client itself is not under any particular license, but does happen to have this notice at the top of each file:
'************************************************************* ' ' DX Coders ' Copyright 2001-2009 Simple Coders ' All Rights Reserved ' Created: 09/06/09 * ' Author: Johnson ' NOTICE: DX permits you to use, modify, and ' distribute this file in any way. ' DX takes no responsibility on how you use ' this code. It is strictly for learning purposes ' and is not designed to cause harm. If you decide ' to reuse this code please give credit where credit is due. '*************************************************************
I have entertained the notion that the developer(s) (there is a mysterious second developer involved that I’ve never met) are planning to have me clean up their application for free, then cut off my access to the project and sell it. I would be disappointed if this happens, but I decided that the experience of reworking an application from a mess into something polished is something I need more than defense against my hobby work benefiting someone else. The comments above mean that, should they excommunicate me from the project I have no qualms about releasing the source code and promoting the project as a fork under a very permissive copyleft license.
I have one concern at this point. The code looks like it’s either a mishmash of examples gathered from various forums or the result of running a C# to VB .NET converter on a pre-existing project. Indeed, one of the more questionable bits of code is admitted to be the result of running a converter on some C# example code. If you have written an ImageShack upload client and this one looks familiar, please contact me with proof. I will not work on a project that was ripped off.
As I work on refactoring, I’m going to make posts that detail why I did what I did. I’m going to cross-post these onto the blog. I’d normally do them *only* on the blog, but I don’t want to undermine XVBT’s policies by taking discussion of a user problem offsite. I’m already skirting the edge by taking on a full project.