To improve as a programmer, many advise to read lots of code but few actually do.
In this old but still relevant essay Peter Seibel discussed why and explained what he does instead, summarizing his approach this way:
"Code is not literature and we are not readers. Rather, interesting pieces of code are specimens and we are naturalists."
Don't miss out on #SoCraTes UK #training day. 10 great trainers, 9 great sessions.
#BDD #TDD #TBD #Kotlin #MobProgramming #EnsembleProgramming #Observability #DateHandling #LegacyCode #CodeReading #Software
#socrates #training #bdd #tdd #tbd #kotlin #mobprogramming #ensembleprogramming #observability #datehandling #LegacyCode #codereading #software
Example 2: I stumbled over a very neat Config class in Flask (https://lnkd.in/eCygDMTu), which is basically a subtype of Dict with a lot of handy methods that fill the Dict from different sources like files, environment variables or objects.
This motivated and inspired me to do something similar in my own JavaScript tooling.
So after 2 weeks, deliberate code reading of unfamiliar code already had some significant impact on my code writing.
Example 1: Flask uses a lot of code comments to describe and clarify the use of classes and methods. This reminded me that I might do this too little in my own coding and I already adapted and started adding more meaningful code comments (especially about the things that you cannot express by code: high-level descriptions and "why"s)
In week 2 of my experiment to learn a new programming lang by only reading code 30 minutes a day I feel like I learned a ton of new stuff, for example:
- What PEP's are in Python
- Magic methods like __getattr__ and __repr__
- @property decorators
- What WSGI Gateway/Applications are and how they work
But the code reading didn't just provide the questions and confusion that guided me to learn new things, I also noticed that it sparked ideas on how I could improve my own coding.
Inspired by the book "The Programmers Brain" by @Felienne I started to have a daily 30-minute session of deliberate code reading. Codebase is Flask (python) and I have no clue about python.
After 3 days, I'm absolutely blown away by the amount of stuff I learned about the python language in only 3x30 minutes by "just" reading the code of a mature project done in that language.
I will definitely continue doing this and share my progress once in a while.
#continuouslearning #codereading
#CodeReading, week 1:
Started diving into the Flask codebase. Biggest thought so far is "Hold up, have I... EVER tried reading project code outside of work? Have I only ever seen project structures written by my own team? Am I a writer who's barely read any books???"