When Installing Packages Took Longer than Coding
This week, I experimented with building a Convolutional Neural Network (CNN) image classification model. I wanted to give GitHub Copilot a try. GitHub Copilot is an AI pair programmer that helps with code completions. One can ask the tool to “explain” a segment of code, fix an error, or generate a Python docstring. Python docstring is a sentence documenting what the module, class, or method does.
Before I started coding, installing the required Python packages took me about forty minutes. The actual coding consisted of fifty lines of code and took less than ten minutes. A few things stood out.
Installing Python packages
I got comment-completion recommendations from the editor when I started typing. The recommendations were not without substance. For example, after the block of code that fits the CNN model, the suggestion was to evaluate and then save the model. This might be a simple suggestion for experienced data scientists. However, think about someone learning to build an ML model for the first time. This is non-trivial.
Immediately after I accepted the tool’s suggestion to complete the comment line, it suggested the content of the whole function. That was another nine lines of code. It intelligently picked up the function name, variable names, keywords, and parameters. Only the parameter values were out of place for obvious reasons. The tool did not have details of the input images, which were placed in my system’s local directory. However, it was easy to change the values given that I already had the syntactically correct function written by the tool.
It did well when I asked the Copilot to explain a selected part of the code. I was presented with conceptual details of keywords contained in the selected part. It was interesting to note that the text was not a static piece of content as opposed to what one may assume. The explanation was in context to my program. It highlighted details of what should come next because I had ended my selection abruptly in the middle of a line of code.
What made me feel that the tool “understands” Python code was its ability to generate a couple of lines of text (called a docstring in coding parlance) explaining the complete source code, a class, and a method. It was human-like, I would say.
GitHub Copilot in action
That was not all. I needed to do some documentation for the model I had built. Guess what? After having all the commented lines inside the program, the docstrings, and the conceptual explanation of the keywords, I finished the documentation in a jiffy.
While excited at this newfound superpower, I am mindful of its shortcomings. I am not talking about inaccurate suggestions from the tool. I am talking about the practice. What did I miss by spending less than ten minutes writing my code? I missed another twenty ways of not coding. I missed the red error highlights, the browsing and skimming through stacks of web pages, the Stack Overflow banter, the confidence that “I got you” this time, and the dashing of that confidence. And I missed repeating the above cycle multiple times. Is this not how I learned programming till now?
The increase in productivity comes at a price (other than the monthly subscription fees of GitHub Copilot). I am talking about GitHub Copilot here. However, it could be any of the plethora of AI programming tools available today. The increase in productivity leads organisations to contemplate reducing the size of their programming teams. If done hastily, the move might backfire. After all, only a good programmer recognises another good programmer. Changing the parameter values mentioned above while defining the CNN model is critical to meeting the program objectives. We got a “working” model swiftly and saved a ton of coding and documentation time. While we finalise whether the advantages of such a tool supersede the disadvantages, allow me to bask in the excitement of the future of programming (and content generation).
The future of programming