Becoming a Confident Programmer
Practise, Practise, Practise!
- Programming is a practical skill, and like learning a language or a musical instrument you won't improve without practice.
- Research showed that "programmers who completed twenty programming challenges performed twice as well in tests".
- Research also shows that, with STEM subjects, independent practice (e.g. outside the lesson) is the most effect way to improve.
- Even practicing things you already know stops you from forgetting them and helps you to apply those skills in new ways.
Don't Use "AI" to Create Code
- LLMs, such as ChatGPT and Gemini, can create code, but they also promote cognitive offloading – i.e. you create things without thinking about them.
- Remember that memory is the residue of thought, so you won't learn how to do things if you don't think about them.
- CS50.ai is a tool that can give you suggestions on how to improve your program or to solve a problem without giving you the code.
- I prefer to use web-based resources such as Stack Overflow, if I'm stuck, because their forum format means that people suggest different ways to do things, and which one might be more efficient.
Review Your Old Programs
- Even though I've been programming for 200 years, sometimes I look back at programs that I created relatively recently and think Why did I do it like that?
- As you learn new skills and become more confident it's interesting to look back at old programs and think whether you could improve them.
- It's therefore a good idea to save (and give an appropriate name to) all of your programming task solutions.
- On a similar note, don't rush to code…
- If I have an idea for a program, I often leave off making it until the next day because I often have a better idea for how it should work before I start coding.
How Does That Work?
- Being a confident programmer means getting into the habit of looking at things and wondering how does that work?
- …in the same way as you need to get into the habit of looking at a calculation and thinking about BIDMAS.
- For example, I recently saw the game Nine Men's Morris at a Roman site, and my first thought was how you could store the board!
- You don't actually need to code everything - getting into the habit of thinking about it is the key.
Remember That Other Languages Exist
- Python isn't the only programming language… in fact I find Python a bit unusual.
- You might notice that I don't mention Python-specific techniques, such as f-strings and list comprehension, on these pages – I'm even in two minds about using randint()! *
- The reason for this is that we're trying to learn programming, we're not learning Python coding.
- Decomposition and abstraction are the key skills, not the Python syntax, so I try to show you techniques that will work in other languages too.
* some other programming languages only have a random function that generates a number from 0-1 that you have to scale yourself.
To develop your thoughts on efficiency, you might also want to try using a slow computer - see my blog In Praise of Slowness.