Friday, November 30, 2007

Gedit, plugins and complete wastes of time

Gedit has a nice plugin interface and includes python bindings. I sat down tonight to learn this interface in the hopes that I might be able to build myself a plugin I had been wanting for awhile. This plugin would use Divmod's Combinator (a reasonable tool for projects in SVN) and list all my projects in the left hand side tool pane of Gedit. The plan was to give an easy way to edit code from the current branch of these projects. Starting a gedit plugin using the tutorial was dead easy, I was up and going in 10 minutes. At this point I felt confident enough to start on the real implementation of my plugin.

First, I need to be able to list directories and files on the side pane. Now, directory listings are part of every operating system I've ever used, and I figured that Gnome had solved this nicely by now. I first looked at the pygtk reference material, and nothing jumped out at me. So I figured I'd have a quick look at the filebrowser plugin that comes with gedit. First obstacle, it's written in C. Oh well, I have a good enough understanding of C so I grab the source. Wow, that's quite a few files. I start poking through them, and to my surprise, they were huge!

Running sloccount on the directory produces:
SLOC Directory SLOC-by-Language (Sorted)
7375 filebrowser ansic=7375

Totals grouped by language (dominant language first):
ansic: 7375 (100.00%)

Total Physical Source Lines of Code (SLOC) = 7,375
Development Effort Estimate, Person-Years (Person-Months) = 1.63 (19.56)
(Basic COCOMO model, Person-Months = 2.4 * (KSLOC**1.05))
Schedule Estimate, Years (Months) = 0.64 (7.74)
(Basic COCOMO model, Months = 2.5 * (person-months**0.38))
Estimated Average Number of Developers (Effort/Schedule) = 2.53
Total Estimated Cost to Develop = $ 220,187
(average salary = $56,286/year, overhead = 2.40).
SLOCCount, Copyright (C) 2001-2004 David A. Wheeler
SLOCCount is Open Source Software/Free Software, licensed under the GNU GPL.
SLOCCount comes with ABSOLUTELY NO WARRANTY, and you are welcome to
redistribute it under certain conditions as specified by the GNU GPL license;
see the documentation for details.
Please credit this data as "generated using David A. Wheeler's 'SLOCCount'."

7k lines of code!? To embed a filebrowser into an editor!? WTF!? It's not like this particular filebrowser implements any special features for the editor either. Besides, gnome already has a filebrowser. Nautilus. Surely nautilus provides an embeddable widget that can be re-used. And if it doesn't then why didn't this time get spent on making one for it! What is wrong with people that they figure re-implementing yet file management all over again is a reasonable use of their time?