pumping python: how I solve problems with test driven development¶
My name is Jacob Itegboje and this is a collection of Test Driven Development exercises that have helped me use Python for more than a decade. I have tried different methods of learning from books, courses, videos and exercises to working on personal projects and I find that the most effective way to learn is to build something. Of all the things I tried, the thing that helped me build and learn most effectively was Test Driven Development
This is a way to write software with a focus on tests. I write tests for ideas to reach a goal or meet a requirement, and the results tell me if I am closer to the goal or not. I repeat the process until I get to the goal.
I also find that sometimes when I am working on a project and have an idea, I remember I have a test for that idea in another project and can go back to run it or write a new test.
I recommend Test Driven Development by Example by Kent Beck and Refactoring by Martin Fowler, they both influenced the way I write programs.
who is this for?¶
If you are interested in Python, this is for you
If you just started your journey, CONGRATULATIONS! You picked Python from the list of Programming Languages out there, Celebrate it, this is for you
If you are new to Test Driven Development in Python, this is for you
If you have been telling yourself, “I will learn Python some day”, today is the day, this is for you
If you already use Python but do not know any of the Exceptions below, this is for you
how can I use this?¶
Start with how to make a python test driven development environment because it is required by every other chapter, each chapter suggests the next chapter to do, or you can choose how you go through the chapters based on what you like. You can also go through the how tos section step by step, the other chapters cover errors, data structures, functions, and classes
Here are a few things I would do if I were in your shoes to make the process more fun
type out the code portions of a chapter without copying and pasting - this increases your typing speed and grow your ability to spot the difference between two things
at the end of a chapter, delete the tests and try to write them from memory or use the solution as a guide - this builds your memory skills
close the tests at the end of a chapter, delete the solution and try to write one with the terminal response as a guide - this helps you build a better relationship with the terminal (your best friend when programming)
try to write solutions using the tests from the catalog of tests as a guide
try adding tests for any ideas I get as I go through a chapter, the sooner you start writing tests the better, since it requires a different way of thinking
I would not quit until I get to the end of a chapter, especially when it gets hard, this is part of the experience when learning to solve problems, things get harder before they get easy because there is a lot of failure. I can always walk away to go do something different for a while, then come back and try again. If you take one small step at a time you eventually get where you want to go
There are videos for every chapter, check them out here https://www.youtube.com/@JacobItegboje
table of contents¶
- videos
- how tos
- conventions
- errors
- data structures
- truth table
- functions
- classes
- catalog of tests
- tests and solutions
- makePythonTdd.sh
- makePythonTdd.ps1
- AssertionError
- AttributeError
- booleans
- classes
- dictionaries
- how to test/handle exceptions
- functions
- list comprehensions
- lists
- ModuleNotFoundError
- None
- how to pass values
- how to make a calculator
- how to make a person
- how to measure sleep duration
- truth table
- TypeError
- can we measure learning?
- dot notation
- pumping python review
- how to make a python test driven development environment review
- how to make a python test driven development environment on Windows without Windows Subsystem Linux review
- reviews
music¶
Here is a playlist I like to listen to when programming