Sunday, August 29, 2010

Tag Cloud Maker

I came across the article "JavaOne 2010: 97 Things Every Programmer Should Know" on JavaWorld the other day and there were a number of interesting topics covered in the video that goes along with the article.

One of these topics that stood out for me was "Code in the Language of the Domain". This is a valuable paradigm that allows those in the future who read your code to easily understand what the purpose of it is by writing it in such a way as to be as close to domain language as possible (see article for a full description).

In the video, two tag clouds where used to illustrate this concept. These clouds were generated from the source code of two separate programs. In the first tag cloud, the dominant words were low level programming concepts, such as "public", "integer" and "string"; not very indicative of the purpose of the program. The second tag cloud contained more domain specific terms such as "paper", "printer" and "person". This second program is much closer to the domain in which it operates (I could have a guess that it is for a printing company that fulfil print requests for clients).

This got me thinking about my own code; how obvious is it to others what my code does? Do they need to rely on the documentation all the time, or do they get the concepts based purely on my code?

I set out to create a program that would create a tag cloud from a source code base and the result is a small program called (imaginatively) Tag Cloud Maker. It is hosted on SourceForge.



This small program will create a tag cloud from an arbitrary set of source code files and I am looking forward to seeing the results on my own code soon!

I'd be very interested to hear if anyone also finds this tool useful, after all, it does not necessarily need to be used on source code; it could just as easily produce a tag cloud from a set of Word documents or text files (such as log files) to help identify the most frequent terms and topics.

0 Comments:

Post a Comment

<< Home