Today I remembered what I love about programming. It’s that feeling that you get when you know what you want to accomplish. You have an idea of how to start realizing your vision. You are comfortable with your tools, that is the language and the editor that you are using to write your opus. With these elements in place you are set to experience flow. Flow is a state of mind, studied and characterized by Mihály Csíkszentmihályi, where the task at hand is difficult enough to be engaging but not so difficult that you get stuck trying to accomplish it. As you finish one task, the next one becomes apparent to you. It is an exhilarating feeling.
What happened today is that I found a Python package called openpyxl that allows you to read and write Excel files from Python. This was the solution that I was looking for to my problem with analyzing large data sets stored in an Excel spreadsheet. I had been struggling to do it with VBA (Visual Basic for Applications) but I found it to be difficult to use. I found plenty written on it but nothing that spoke to my problem domain. If anything, there were too many mediocre books targeted at spreadsheet power users that were novice programmers. I am the opposite, a casual spreadsheet user that is an expert programmer.
I figured out after I thought about it for a while that experienced programmers just weren’t going to put up with a language as shabby as VBA. Not only was it a bad language but it had no standard definition and was proprietary to Microsoft. Consequently, it was subject to Microsoft’s favorite ploy of making radical changes to the behavior of the language from one version of the product to the next. It made no sense to me to invest any significant amount of effort into crafting a solution only to have to entirely redo it at the next release of Excel.
To summarize, I made more progress today than I would have in a week with VBA. And as a bonus benefit, my code is readable to the large and ever growing cadre of Python programmers. It was a brilliant idea and I’m still floating on air over having figured it out.
Basic was a good first cut at a first language but we have learned a lot about how computer languages should work since it was first released in 1964. Bill Gates and Paul Allen started Microsoft with Microsoft Basic in 1975 and it was a clever implementation that made the limited resources of the early personal computers more approachable by total computer novices. In the intervening 42 years, we have developed a number of languages that fill the niche that Basic originally targeted much better.
Python has become very popular for both casual scripting and implementation of large projects. It has the inertia associated with a large user community and a responsive team of implementors. There is a clear definition of the language and a carefully controlled process governing the evolution of the language. I can develop in it with confidence that my work won’t be rendered obsolete by the next release of the language.
Sweet dreams, don’t forget to tell the ones you love that you love them, and most important of all, be kind.