Lesson 5
Writing Reusable and Self-explanatory Programs
Chapter 1: Introduction
This lesson
So far, you have been writing simple programs as a single big sequence of code blocks.
In this lesson, the main focus will be on writing self-explanatory and reusable code, by breaking your program into smaller, reusable chunks with semantic names. This style of writing code will allow you to design algorithms at a higher level, and also help produce code that is easier to read and maintain. This becomes more important as you start writing larger programs. We will start pushing you to write this kind of code from this lesson onwards.
We will also cover other topics as usual - some more Python features, good software engineering and programming practices, debugging, and a heavy duty git
topic (branching).
Finally, you will be restructuring your code for your robot project into reusable, self-explanatory chunks. This will probably be the biggest and most time-consuming and energy-consuming task you will be doing in this lesson! Stick with it, and hopefully by the end, you will be able to naturally write beautifully structured, organised, self-explanatory, and reusable code! And hopefully you will not want to go back to writing a single big chunk of ugly code!
Let us begin. As usual, engage actively in all activities, and take a break between chapters (or at any point) if needed.