From “Hello world” to complex applications – the learning-to-code path is not obvious to a self-taught coder like me. Some books teach you about algorithms, others about syntax, some about best practices, and so on. There is the theory, and there is the practice. It is a big puzzle with many different pieces and it can be intimidating to a beginner. It is very useful to find books and exercises that help you combine different forms of knowledge, and practice thinking like a programmer.
This word game exercise from one of the MIT courses is good for that.
It is a part of the Fall 2008 course “6.00 Introduction to Computer Science and Programming” taught by Prof. Eric Grimson and Prof. John Guttag. The materials are made available as part of the MIT OpenCourseWare initiative.
For the word game exercise, the student starts with a half written Python program accompanied by a series of unit tests. The task is to write the missing functions (using the unit tests to check if they work) and complete the game, and also, in the second part, to implement a basic ‘computer player’ to play your game with. It is deceptively simple and fun but very useful. For instance, it bridges the gap between the very basic exercises and complex applications. It catapults you right in the middle of something fun and already-almost-working, and helps you to easily get used to good programming practices like unit testing. And you also improve your understanding of the importance of the choice of data structures for the functioning of your code. Without being intimidated. And that’s not even all.
Online higher education courses are a wonderful thing, and I’ll certainly blog about it in the future some more. The “6.00 Introduction to Computer Science and Programming” MIT course (offering videos, transcripts, assignments, a reading list, etc.) is especially interesting, because it manages to communicate complex arguments in a simple and dynamic, brain friendly way. It covers the basics like data types, recursion, floating point precision, search algorithms, OOP and such, while adding touches of thought provoking arguments like random walk simulation, the knapsack problem and computer player implementation. And it does so seamlessly, while also throwing in some practical advice on topics like debugging.
These online lectures are also rather motivational – watching experts like that lecture in an encouraging, thought stimulating yet down-to-earth non-threatening, creative way, makes you feel like a real code apprentice and reminds you that we learners are all in the same boat and that you might make it after all.
For the word game exercise assignment, go to the assignments page of the course.
P.S. For lecture transcripts, click on the ‘Transcript’ tag below the video.