Skip to main content

Languages as a means to an end

·465 words·3 mins

I teach an introductory programming class to first year students. The audience is a mixed crowd with respect to programming proficiency. A part gained experience in C# at a trade school, some took computer science courses at high school, while others never wrote a single line of code. We use Python, but as a means to an end. The objective is to teach students how to program.

There is no rush. Concepts are introduced gradually. I treat if-statements in the fifth week, loops in the sixth. Do not let that slow start fool you; the learning curve gradually steepens. By the end of the semester students will be writing object-oriented programs. At the end of each week, I offer them extra challenges. These can be solved in a few lines of code. That’s okay. It’s not about writing large programs yet. It is about developing a mind set for problem solving.

It was the end of the second week. We had covered variables, expressions and the print function. That is not much, but sometimes it is all that is needed. I told my students the following story.

In The Netherlands, companies can issue lease cars to their employees. If used for personal transportation, the car is seen as a form of remuneration and subject to taxation. A percentage of the car’s purchase price is added to the employee’s annual income. The price is determined by the year of purchase and carbon emissions. The table below shows the percentage for electric cars.

2016 2017 2018 2019 2020 2021 2022
4% 4% 4% 4% 8% 12% 16%

I gave my students this table and asked them to calculate the amount taxed given the car’s value and year of purchase. They should restrict their programs to the years 2019 and later. Furthermore, I gave them the following outline

year = 2019
purchased_for = 40000

# calculate added income

# print amount

Listing: Code outline for the exercise

A few minutes later, the first answers came in. Students with prior exposure to programming had finished the exercise quickly. That wasn’t a surprise. The fact that all solutions contained if-statements was.

I told them we had not seen branches yet and they were not supposed to use them.


‘We can’t use if-statements?’



What did I learn? Firstly, I am doubly convinced that the challenge is not to teach them how to write code, that a treatise of the syntax and semantics is too limited, that Python is but a means to an end, and that the real challenge is to teach what to write. Secondly, it is possible to offer exercises that challenge all students and invite them to cooperate. Again, this requires a shift from teaching syntax and semantics to abstraction mechanisms based on meaningful scenarios.