Work Smarter, Not Harder, with scripting

This post is really preaching to the choir — in that, learning a scripting language is useful and something that all developers should do. And, not only that, they should be able to write a script in their favorite scripting language to help them accomplish a task. It doesn’t matter if that script will only be used by them — if it can make life easier, and/or you need to munge some data from one format or another, or you need to automate something, scripting is essential. I think most of the tech heads that read this blog will agree with that.

My current position is for Java development. That is the only language they cared about in the interview. There are other people that know much more about Java and J2EE here than I do — I freely admit that. Yet it fascinates them how much I can get done. It’s because I spend a little time writing a script that does the work to make my life easier. Here is a list of what I have written scripts for in my not-quite-two months in this position:

  • Since I’m the new guy, I have to put values into this spreadsheet from a report that is generated from one of our applications. I have to do this every morning. The report is emailed to me and I am supposed copy-and-paste values from that PDF into the spreadsheet. Of course, the values are not in the same order as they are in the spreadsheet, so you have to be careful. But, hey, I have ActivePerl installed. So I grabbed PDF::API2 and spent a few hours writing the script. Now I save the PDF to my hard drive, run the script, and I’m done.
  • OurStruts config files are a complete mess. I hate looking stuff up in them. Python, ElementTree and thirty minutes gave me a nice little command line tool in which I just give it a path, and it gives me the Action class.
  • I have to do some Oracle timing work — run a SQL script and write down the milliseconds it took to run it. This is for three databases, eight scripts each. I’m supposed to load each SQL script into PL/Developer, run it, and record the millis that it says. I’m supposed to this for all three databases every day for two weeks. Instead, I wrote a Jython script that makes a JDBC connection, times how long it takes for the script takes to return, and output the date, time to run, and result into a tab-delimited file. I then copy-and-paste that into Excel. It took me a hour to write it and it has saved me about eight hours of work.
  • Someone sent a mainframe dump of about 1000 pieces of equipment. We were supposed to use that as a reference. But the equipment ID and number were the only two things we cared about, and there were about 30 other fields. Again, I spent ten minutes working in Python and I had a CSV file created that just had the info we needed in a format that was a lot less bulky

None of these are hard scripting tasks — you could do them in any language. An hour of writing a script could save you hours and hours of repetitive tasks. Then that time can be moved to other things — like solving real problems.

Leave a Reply

You must be logged in to post a comment.