Examples, revisions, and extensions
to the DK book Help Your Kids with Computer
Coding
related to the Python
turtle
and tkinter
modules.
DK's book is one of the better ones but the Python examples use some bad practices and can be confusing to follow:
- No code documentation at all
- Unnecessary use of
from tkinter import *
(or any*
at all) - Unnecessary use of
from turtle import *
- Failing to consolidate
import
statements at top - Extensive use of globals even from within functions
- Poor use of structured data
- Absence of any traditional Object-Oriented introduction
- Unnecessary abbreviation and obfuscation of variable and function names
- Use of
\
for line continuation - Failure to mention the
ttk
upgrades - Use of
<Key>
events instead of<KeyPress>
and<KeyRelease>
If unchecked these could instill bad habits into new programmers taking them at face value. This repo is to help parents and students make the best of this otherwise good book and learn to avoid the bad parts.
To understand why these are bad practices we suggest the following official Python documentation:
- PEP 8
- Idioms and Anti-Idioms in Python
- Google Python Style Guide
- Yahoo Python Coding Standards
- CKAN Python Coding Standards
It's worth noting as well that this book uses Scratch, which is suffers from the following inadequacies compared to Blockly as used by learn.code.org:
- No functions at all (Snap! created to address)
- Not open source
- Requires 'Flash' instead of just JavaScript
- Cannot be used to output other code (Blockly outputs JavaScript, Python and more).
The book does provide some structure to the otherwise unstructured Scratch web site. By following along in the book this could be used to provide the same sort of progressive challenges that learn.code.org does but in an arguably less effective way.
While these examples fall under copyright with the book, fair use allows us to expand and comment on them here. We assume you have already purchased a copy of the book and are seeking clarification and what it contains or want to expand on what you have learned in it. Any additional contributions (not in the book) are public domain.