今日推荐英文原文：《Letter of Recommendation: Bug Fixes》
推荐理由：3RS，即 readable,reusable,refactorable 三个方面，通过调查软件架构的这三样属性来评价一个架构。一般来说架构这玩意应该是最开始设计的，改的越晚改起来就越花功夫，而这个项目通过一个常见的 JS+React+Redux 的项目作为例子，介绍了对这三方面进行提升的方法准则，在需要长久发展的项目上这三个属性会显得很重要，在一开始就设计好合适的架构可以避免更多麻烦——虽然重构可能会迟到，但是它一定不会缺席就是了。
今日推荐英文原文：《Letter of Recommendation: Bug Fixes》作者：New York Times Magazine
推荐理由：软件的 commit 记录上记载着它的发展历程
Letter of Recommendation: Bug FixesI work in the software business, which means that I live in a world ruled by computer code. A lot of that code is proprietary and secret. You can see what it does, but you can’t see how it works unless you work at the company that makes it.
We can, however, see some of it. A lot of the world now runs on “open source” code. That means it’s free and reusable, under the terms of its license. The Firefox web browser and the largest parts of Chrome and Safari are open source; whole operating systems, including essential parts of MacOS, are open source; the server software that powers our digital cloud, driving data to our phones, enveloping us in wonderful and terrible ways — much of that’s open source, too. If you’re reading this online, you’re almost certainly using open-source code right now.
The gates of the open-source palace are always open. You can enter by way of websites like GitHub (which is built on top of version-control software called Git, which was created by Linus Torvalds, the same person who created Linux). GitHub serves more than 100 million different code repositories. It’s owned by Microsoft, which is another sign of how things have changed: Microsoft used to write memos about how to ruin free software.
In 2019 you can track every change anyone makes to a codebase, whether they’re fixing one typo or changing 5,000 files. You can see who made the change, and read a description of the change. If something suddenly doesn’t work, you can backtrack to an earlier version and figure out why.
The secret history of the 21st century is written in code “commits” — which is what coders call changes like bug fixes and feature updates. I like to read commits like a newspaper, especially for software I use. I do this partly because I want to know what I can do today that I couldn’t yesterday. Little things add up; perhaps there’s a new way to use the cursor keys to add minutes back to my days, or a search function that could help me better organize my email.
I read the change logs, and I think: Humans can do things.In every commit, you can see how the code is growing, changing and reacting to the world: “Make image scaling work without ImageMagick support in eww” (from the Emacs text editor). “Disables autofill/ autocomplete/ spellcheck in the hex input field” (from a pixel editor that runs in the browser, called Make8BitArt.com). “Fix the bell sound when Alt+key is pressed. (#1006)” (from Microsoft’s command-line terminal app).
I wouldn’t expect a nonprogrammer to understand the above, but you can intuit some of what’s going on: that we don’t need ImageMagick to scale images anymore, because the text editor can scale images on its own; that it’s bad form to spell-check hex values, which specify colors; that the bell is doing something peculiar if someone holds down the alt key; and so forth.
But there’s also something larger, more gladdening, about reading bug fixes.
My text editor, Emacs, is a free software project with a history going back more than 40 years; the codebase itself starts in the 1980s, and as I write this there are 136,586 different commits that get you from then to now. More than 600 contributors have worked on it. I find those numbers magical: A huge, complex system that edits all kinds of files started from nothing and then, with nearly 140,000 documented human actions, arrived at its current state. It has leaders but no owner, and it will move along the path in which people take it. It’s the ship of Theseus in code form. I’ve probably used Emacs every day for more than two decades. It has changed me, too. It will outlive me.
Open source is a movement, and even the charitably inclined would call it an extreme brofest. So there’s drama. People fight it out in comments, over everything from semicolons to codes of conduct. But in the end, the software works or it doesn’t. Politics, our personal health, our careers or lives in general — these do not provide a narrative of unalloyed progress. But software, dammit, can and does. It’s a pleasure to watch the code change and improve, and it’s also fascinating to see big companies, paid programmers and volunteers learning to work together (the Defense Department is way into open source) to make those changes and improvements. I read the change logs, and I think: Humans can do things.
Technologists, being who they are, often suggest that we Git-ify everything: congressional legislation, newspaper articles and so forth. Sometimes I wish the “real” news worked like GitHub. But how could it? There’s no central code repository, no one source, for American culture. Most people aren’t living their lives thinking, If only this were more like software. When you love technology, this is a hard lesson to learn.
I like knowing how things are made. That’s the great lesson of software, to me: With open code and version control, the foundational document and the human process are one. We’re usually told to turn away from the sausage-making. With laws, TV shows, chicken nuggets or corporate mergers, it’s better not to know. Not in software, in which nothing is ever finished. Watching the commits, you can see the story taking shape. Or possibly shape the story yourself.