Tuesday, February 15, 2011

Java to the rescue!

Greetings

Some time back, I decided to run for the position of secretary in the student council of my school. Being a secretary appealed to me; I did not want a position that was constantly in the limelight and I enjoyed tasks such as data handling and processing (student data and volunteer info). I was subsequently elected and while reviewing the duties of  a secretary, I realized that there was no real system in place to store, view and edit member data. I found out that previous secretaries had left this responsibility to the members themselves; that is the reporting of the hours volunteered and so on. It did not seem right to me to allow volunteers to self report theirs hours. However it was seemingly the only option considering there was no concrete system in place. One of my fellow student council members had the "bright" idea to use an excel document; At 300+ members and over 100 activities per year, the excel cells to be edited would exceed 30000. There had to be another method. Finally, it was Java that came to my rescue! I decided to create a Java GUI Swing App combined with a self written text file parser. Every time a new member is added, the app creates a new text file with name, grade, etc as well as a volunteer hours summary, edited to look like a table. Adding hours to members files involves using the text file parser. which searches for special indexes and edits the file accordingly. Since the data is stored as text files, it can be printed out and handed back to members to increase transparency. I set out to code the app and in about a week finished it. It was a mad rush of coding ~ 440 lines of Java. All the codes are in a single file, though looking back in retrospect, I should have used interfaces and abstract classes for more readable code. However, it was the best I could do in a week! In any case, it helped me tremendously in processing members and their hours. I also built upon this code to build a simple payroll program for a local dentist's office. Although I cannot release that code until they allow me, here is a screen shot below:
My more complex payroll app screenshot.

As you can see, it is a pretty complex app with over 1250 lines of code. I shall be however posting links for the source code and entire project of my Student Council Secretary App as well as the .jar file. I have annotated key parts of code, but if you have any questions, please post a comment question on this post. When using the app, he member files are created in the same directory as that of the app. Like always, you can use, modify and redistribute it without any license. If you do redistribute it, It would be nice if you could add my name somewhere in the file, but if you cannot, it is not really a problem. Here are the links:
Link to download zipped Netbeans project (source code in the Hours-src-hours folder.)
Link to download .jar executable file. (Not tested on Mac, but should work. Works in Ubuntu and Windows)

This is not the end...

Aravind Rao