W08 - How to Write Good Code
Last week our team discussed how to write good code; here are some extended reflections.I want to propose a general rule: continuously improve the quality of your information sources. Writing good code is a process of learning plus practice, and seeking high-quality sources is a powerful driver of growth.
When I first started working, I often browsed public WeChat accounts. Opening an article would frequently make me exclaim, “Wow, this is great—so true—better save this.” Gradually I found that some developer communities offered more systematic content, much of it originating abroad—from media outlets and Google Developers, for example—so I spent time translating material. Later I followed reading lists and listened as senior practitioners strongly recommended certain classic titles. After reading several, I realized much of what I had consumed before was fragmented: excerpts, amplifications, or practical takes on particular chapters from books. Those books are generally not brand new and are often reprinted, but they remain perennially useful—works like The Pragmatic Programmer, Refactoring, The Principles of OOP/Design, and the Yoshihiro Matsumoto series, for instance.
My experience was first like assembling a jigsaw puzzle: collecting fragments, self-exploring, and forming theory, only to find I was reinventing the wheel. Later it felt more like planting a tree: first build your own knowledge tree—establish the trunk—then hang various fragments on it. The benefit is that once you can discern information quality and convert it into practice, everyday inputs yield the greatest potential. You’ll know what is mere trickery or flashy gimmickry to be dismissed, and what is profound simplicity worth quietly studying.
I’ve explained why you should raise the quality of your sources; now what constitutes a high-quality source? New media such as public accounts aren’t inherently inferior to books in content quality. Different channels have different strengths—quality is only one dimension—and ranking channels solely by quality is unfair. It’s more appropriate to judge by brand. Whether an individual or corporate IP, a strong brand’s output is rarely poor, because brand quality correlates with the effort invested in selection, editing, and proofreading. Examples of solid brands include community outlets like Aotu and Qiwutuan, and publishers such as Turing, O’Reilly, Huazhang, and Zhanlu.
There’s no hierarchy of channels as high or low, and no single channel is omnipotent. Overvaluing a channel beyond its nature leads you astray, because no channel can do everything. Like the era critiqued in Amusing Ourselves to Death, when television was dominant people even hoped to rebuild education around it—but most attempts to educate through TV failed. Television’s strength is entertainment and ease; don’t expect it to shoulder broader social responsibilities. After the TV era we experienced the portal era and then mobile new media. Each era simply added another option for obtaining information; there’s no logic of one replacing another, only the logic of which is best suited for a particular task.
I once read Professor Wan Weigang’s view that we should read many top conferences and academic papers — those are the highest-quality sources. I agree, but that stance is somewhat doctrinaire. His perspective leans toward scientific elitism. I recently read his popular introduction to quantum mechanics; one passage stuck with me: he argued that disciplines whose names include the word “science” are often not truly scientific, reflecting a lack of confidence in the field—he cited computer science as an example.
Last updated