Approaches to Teaching Programming: Engineering vs. Computer Science

Hackathons;

The seed for this post was initially planted during the 2018 CIBC Machine Intelligence Hackathon. Ever since learning about hackathons, I’ve been interested in participating in one as I have a tendency to attempt too many long-term projects at once. I enjoy the focus and clarity that hackathons give.Web

In the hackathon, we were asked to develop a program to identify fraudulent medical insurance claims in an unlabeled dataset (effectively an outlier detection problem). I was lucky enough to find myself in a team with two other people, including a fantastically knowledgeable 3rd-year computer science student. Along the way, I learned a lot about collaboration, unsupervised learning, mathematics, and computer science. During our time working together on the problem, the difference in approach taken in engineering and computer science education on the subject of computer programming became apparent. Here is my account of those differences, based on my experience so far as a first-year engineering student with some programming experience:

Differences in Mindset;

When learning computer programming from an engineering perspective, the most important things are reliability and readability. Elegance is explicitly stated to be a useless artifact from the past, the argument being that the vast majority of our code would go through compilers that would have built-in optimizers, so our elegance wouldn’t even count for anything in the end. To further these ideals, we are required to use a relatively small set of the tools available in a programming language because esoteric functions decrease readability. Those who deviate from this methodology are considered “incompetent coders”. One should not even consider consulting the internet for solutions to issues because the internet is full of these incompetent coders!

At the hackathon, I found out that computer science students learned things in a different way. They were not, in fact, penalized or discouraged from using somewhat less-known functions that could get the job done more quickly. They are apparently even encouraged to make their code efficient!

Which approach is Superior?

I am clearly no expert on this subject, and I am open to changing my mind. However, the engineering approach I have been taught seems illogical. Here’s my argument for why:

The “incompetent coders” who break the conventions/lessons taught in the introductory engineering appear to make up a sizable chunk of all coders. If the definition of “good code” is to use an extremely small set of tools, then many built-in functions in high-level programming languages should not exist. Why have a zip() function in Python when you could just use some loops? Why have a map() function? The answer is that it is more efficient to use these tools, both to physically type out and for the computer to run. The functions exist for a reason – their performance is likely optimized for some intended use, and it is by using these tools judiciously that one can make better progress in solving a problem. I observed this first-hand when I saw that my scripts (coded using the style I had learned in class) were going to take several hours to run, compared to my teammate’s scripts that took only a few minutes.

Clearly, it makes sense to introduce programming by teaching the small, potent set of skills that we are required to use in the engineering approach. However, it is nonsensical to suggest that this is the only correct way to code and that people who deviate from this are somehow wrong. These more esoteric tools exist for a reason, and it is necessary to understand which tool to use when, or at least to understand that tools have their place in solving problems.

This is my experience so far with the differences between the engineering and computer science approaches for teaching programming. I hope you have found this thought-provoking! Let me know your thoughts on this in the comments.