Lesson 5
Writing Reusable and Self-explanatory Programs
Chapter 1: Introduction
Recap
Welcome back to our programming lessons!
Now, let’s recap what you have learnt so far.
You have learnt that programming is not just about coding. You should also spend time understanding and thinking about the problem, and devising an algorithm to solve the problem, before implementing your algorithm in code form. You should also always test your program as you implement it to make sure that it works, and that it works correctly for different use cases.
Programs are made up of basic ‘building blocks’ that can be composed to form larger constructs. These include variables, identifiers, operators, objects, expressions, simple statements, selection statements (if-else
), repetition statements (while
).
You have learnt about the concept of abstraction, and how named constructs like variables and functions can make it easier to write and read your programs at different levels of abstraction.
You have applied what you have learnt so far to solve even more challenging programming problems, like computing the square root of a number. You have also had a dab at implementing existing algorithms. You have learnt of exhaustive search as a first strategy for solving a programming problem, although you can always come up with more efficient and clever ways.
Hopefully you have also been exposed to good coding style, using PEP 8 as a guideline.
You have practised debugging someone else’s code, and you have hopefully learnt the importance of designing your algorithm well before you code.
You have also practised Git commands further while updating your robot project (we introduced you to git log
in the previous lesson, along with the others you have previously learnt: git init
, git status
, git add
, git commit
).