Chapter 5. Recap

master
Jason Zhu 2020-11-09 15:10:06 +11:00
parent a9bf5ed847
commit 3e3cb00013
1 changed files with 22 additions and 1 deletions

View File

@ -422,4 +422,25 @@ AssertionError: '2: Use peacock feathers to make a fly' not found in ['1: Buy pe
``` ```
rm db.sqlite3 rm db.sqlite3
python manage.py migrate --noinput python manage.py migrate --noinput
``` ```
## Recap
Learning outcome:
* Setup a form to add new items to the list using POST.
* Setup a simple model in the database to save list items.
* Creating database migrations, for both test database and real database
* 2 Django template tags `{% csrf_token %}` & `{$ for ... endfor $}` loop
Useful TDD Concepts:
* **Regression**: When new code breaks some aspect of application (which used to work).
* **Unexpected failure**: When a test fails unexpectedly. Reason:
* 1. mistake in our tests;
* 2. Tests have helped us find a regression, and we need to fix sth in our code.
* **Red/Green/Refactor**: TDD process in another language.
* Write a test and see it fail (Red)
* Write some code to get it pass (Green)
* Refactor to improve implementation
* **Triangulation**: Generalizing the implementation by adding new test case to cover new specific e.g.
* **Three strikes and refactor**: Rule to remove duplication from code.
* **Scratchpad to-do list**: to-do list to write during coding, and check what we're doing.