Wednesday, August 20, 2014

Hacking Away at Little Problems

We have a fairly nice system for student information and the like. It is not perfect but then what system is? For example, our student management system will output class rosters as PDF, Word or Excel files. The problem with the excel output is that there is way too much information in it to be easily used for many of the things teachers want to use it for.

If it were just a matter of extra columns it wouldn't be too bad but there are also extra rows. It is tedious to strip things out. I’ve done it before but it’s just not fun. Writing code on the other hand is fun. Well for me anyway.

So of course I wrote some code. I saved the Excel file as a CSV, ran it through my program which output a new CSV file with just the information I want. That CSV was opened in Excel, nicely formatted and saved for future use.

Honestly I think it took less time to write than it would have to manually clean the data. It was something under 30 lines of code and a bunch of that was just variable definitions and other setup.

As a bonus, now I have the code for next semester. It's not fancy and it is not bulletproof - I'd really worry about supporting it for use by others - but it works for me. Just one edge programmers have over people who are not comfortable writing code. I did this in Visual Basic. Others would use other languages or tools and I am sure some UNIX/Linux person will jump in without how they would do it as a shell script using utilities. But the point doesn’t change that knowing these things can be useful.

I think lots of people run into simple problems that can be solved with what we like to call “a small matter of programming.” One doesn’t have to be an expert or a professional to write many simple programs to solve simple problems. Nothing is my code is beyond what I teach my beginning students for example. In fact my honors programming students will have a similar, but involving more complicated string manipulation project, later this semester.

In today’s world should basic coding be part of more people’s skill set? I think so.

No comments: