dev/coding/ TheCatApproach


When writing small scripts in e.g. Python, I often take the 'cat approach' (with a command line like bash). What I do is to type

$ cat > my_script.py

and the proceed to type in my script. Now usually I am able to use backspace to delete letters I typed in error but, kind of like fillout out a Sudoku in pen, once I press Enter, what I have written is committed. If I want to fix that error, either I edit the resulting file in e.g. vim or code or, if I'm being strict, I rm my_script.py and start again. This way I train myself to ThinkBeforeYouType and to avoid making errors in the first place. This is inspired by the MechanicalTypewriter were, if you press a single key in error, that keypress is immediately committed to paper and, if you make more than a small handful of errors on a page, you need to restart the entire page! In days long past, professional secretarial schools trained many people, such as my late Mum, to type both at speed, and with accuracy. That latter quality: accuracy, or simple NotMakingErrors, is lost on modern generations.