Skip to content

Code it to Learn it: Using Programming as a Study Tool

Published: at 12:00 AM

Info

This article was originally published on LinkedIn in 2021, and is being republished here to centralize previous writings in one place. Links and information may be broken or out of date.

University is back in full swing, and while those in the education sector are doing their best to work with what they have given the current state of the COVID-19 pandemic in order to teach their students, I am sure that there are still a lot of others like me that are still having a hard time taking things in on occasion despite what we have been provided.

In my own particular case, I am currently working towards a degree in Computer Games Programming, and am in my first year after being out of education and in the workforce for a few years – One of these classes in my first year is a Digital Technologies class, and as one might expect from a programming-focused degree, maths does play a part in its curriculum, especially now that we have moved away from prioritizing the hardware side of things in the first semester.

To say I am not a maths person is being generous, and when we began to be introduced to these concepts, I was very worried that the resources we were given, while plentiful, would not be enough for me to keep concepts down for when the time came for the dreaded exams, and I started looking for anything I could do to better understand what I was being taught for myself. Explaining why this was the case a bit later on, it was what made me decide to start working on BaseTrainer.

A screenshot of a GNOME terminal window running Base Trainer. The program is displaying a matrix of random numbers to be transposed by the user. The answer is displayed directly below the original question, along with a timer that reads 'You have spent 0 minutes 57 seconds on this question' and a prompt that reads 'You have practiced 17 questions this session.'. The program is waiting for the user to press the enter key on their keyboard to display the next random question.

BaseTrainer is a terminal program written in Python that generates questions at random related to the curriculum of our Digital Technologies classes. This only initially covered the conversion of numbers between varying base systems (for example, converting from a hexadecimal representation of a number to a binary one), but as the semester went on, the need to cover other areas was apparent, and the range of questions that the program could ask went from converting between number bases to other computer mathematics concepts such as 2’s Complement binary, Dot Frequency and Frame Buffer memory requirements, and in the case of this ongoing semester at the time of writing, matrices and data set values, with calculus set to be taught further down the line.

A screenshot of a GNOME terminal window running Base Trainer. The program is displaying two different numbers using the base eight number system and asking the user to add them directly. The answer is displayed directly below the original question using base eight respectively, along with a timer that reads 'You have spent 1 minute 1 seconds on this question' and a prompt that reads 'You have practiced 26 questions this session.'. The program is waiting for the user to press the enter key on their keyboard to display the next random question.

Questions are presented one at a time, with the user being able to reveal the answer when they are ready. The amount of time being spent on a question, as well as how many have been run through in a session are also recorded, which I used in my own case as a baseline for measuring the effort I had to put in to solve that type of question. If I was getting faster at doing it over time, then it was becoming more effortless to do.

BaseTrainer was written with the additional intent of helping out my peers, and while the code is available on GitHub, ease of distribution was still a priority, especially when it came to platforms that were likely to be used by students such as Microsoft Teams or Discord. Because of this, everything is deliberately contained within a single Python script, and does not depend on any external packages to run - Simply pull it down and run it in your terminal of choice. Because of the demands of my other classes, adding onto it as quickly as possible was a must, and this shows if you go to look at the source code; there are countless ways it can be improved upon when talking about the quality of the code, but at the end of the day, it works and does what it needs to do.

A screenshot of the editor window for Visual Studio Code, which is displaying a snippet of repeated python code found within base trainer.

Yeah, there is definitely a more graceful way to be doing this…

While BaseTrainer effectively works as digital flashcards, the true value I find in it is through the process of adding to it, opportunities where I am able to do so is where I feel I am most learning effectively, and realising that this was even an approach I could try taking was the reason I started working on it in the first place – Determinism in programming means that when something such as an algorithm is given the same input, it will produce the same output each time. In a similar manner it turns out, the same applies to various mathematical concepts and formulae. Any given calculation will have rules and steps that govern the final result, and in turn the answer to the input or question given; if I could implement any particular concept in code correctly, then I’ll have successfully broken down the exact steps that need to be carried out by necessity, and if it still failed to stick with me after the fact, then I’d at least still be left with a way to practice it as much as I wanted until it did.

Because of the fact that I also chose to share this with other students, working on BaseTrainer has forced me to ensure that what I am writing is also correct in regards to what my course’s curriculum covers, and has been a good practical lesson in the need to take responsibility for the code I write now and into the future, either by a direct consequence of the nature of what I have programmed, or by how it is used as a result.

This is an area that I have always seen discussion about, but have never really been put in a situation to consider it for myself. Now, I am not in the business of technologies such as facial recognition or self-driving vehicles, or missile-guidance software, but what I have created in this scenario still exists to help others learn and become familiar with a new concept, or series of concepts. If I fail to properly implement that concept properly, and that ends up being incorrectly taught to someone, then I have ended up harming another’s performance, or in a truly worst-case scenario, ruined their academic prospects completely.

While I do not recommend that this same approach be taken when talking about distribution, I do think that attempting to program something that you don’t understand is still a powerful tool to have on your belt when it is applicable to whatever new thing it is you are trying to learn. Better methods will most likely exist for the rest, but when it is possible I have found it to be invaluable, if not for the fact that I can break it down into steps, but because it better motivates you to study for the topic at hand by coding it and getting to make something, which I feel might be a step up from sitting down and forcing yourself to cram non-stop instead.