Update on my programming resolutions – fighting lazyness

6 Nov

A few weeks ago I started a project of “being a better scientist.” I made general resolutions, which I plan to keep for a long time, and resolutions related to programming, on which I wanted focus for a month. I am pretty happy with how I stick to the general ones, but the programming-related resolutions turn out to be challenging.

1. Learn python by finishing Udacity‘s python course.
I planned to finish my Udactity CS101 course and this is almost done. I already started working on the exam questions. The last units  with technical content (5 and 6) were great fun, and I learned about hash tables, the page-rank algorithm and recursive functions.

2. Look it up, write it down.
I decided to make an effort to look things up and write them down. For example, I often get Excel files from collaborators and I used to open such files in OpenOffice and save them as .csv files before importing the contents in R. But this is somewhat time-consuming (OpenOffice takes forever to start) and generally annoying to do. Plus, there is a risk that, one day, I may get a new version of the Excel file and forget to convert it to .csv. So this month I made an effort to find out how to read Excel files directly into R. It was not very hard, and it will save time in the future. I also added two lines of annotation to my R script.

#load library to be able to read xls excel files
library(xlsx);
#usage: to read first sheet of xls file: DataFromExcel <- read.xlsx(“test.xlsx”, 1)

So, all seems fine. But why I didn’t do this years ago? It’s not as if I just started using R or reading Excel files.

I am not sure, but I fear it is just lazyness. I need to remind myself all the time to keep learning new things – even if they are small and uninteresting like how to read an Excel file (and how to type a dash in stead of a hyphen – I learned that too this week!). To help myself, I started using Joe’s Goals. This website helps you stick to your resolutions. For me, the site helps, at least for now. I am not yet convinced that it will still work in two months’ time, but I will give it a try!

3. Annotate, annotate, annotate.
My third resolution was to do a better job annotating my code. But, wow, this is hard. I haven’t even started looking into things like Doxygen to do serious annotation. I first wanted to think about what I need to record to be able to understand what I coded two months or two years ago. This turns out to be harder than I thought. But this blog entry is already getting long. Later this week I will write about lines and lines of unannotated code, variable names that have no meaning, filenames that have no meaning, or twenty files in a folder and I don’t remember how they are related. Any tips on how to avoid these things are very welcome!

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: