# 第 2 期 - 鸭子理论与第一性原理

### 介绍

我们每天都会接收到过载的信息，然而明月与砾同囊，其中的优质信息往往会被淹没，因此需要一个信息过滤服务来提升接收的信息质量。

思考的价值由此而来，分享内容的不限，偏向于 计算机技术 与 科技人文的方向。

* 内容存档可见：<https://thinking.tomotoes.com/>
* Newsletter 服务：<https://simon.zhubai.love/>

### 封面

![img](https://raw.githubusercontent.com/Tomotoes/image/master/img\(null\)-20221115235659587.\(null\))

生日惊喜🎂 *11-09 00:00 家*

### 话题

本周的话题是探讨 我非常感兴趣的两个理论：鸭子理论与 第一性原理。

* **鸭子理论**：如果它看起来像鸭子、游泳像鸭子、叫声像鸭子，那么它可能就是只鸭子。
* **第一性原理**：回归事物的本质，找到实现目标最优路径的方法。

我一直很信奉这两个理论，并喜欢将其结合。

我的理解是 每一件事物都等价于 ta 的外在表现，并且可将 表现的本质 拆分成为各要素，进行解构分析。

该理解可提炼成一种方法论：分析事物要点，再从要点的核心出发。

在早期学习、工程实践中 这已 潜移默化 成为我的行动准则之一。

举个例子：我前不久想实现一款截图软件，截图的核心能力 应该怎么实现呢？ 你会想到使用系统提供的截图能力 去在上层封装？对不起 系统没有“截图”能力。

正确的解决方案是：使用 `CGDisplayCreateImage` 方法（mac），该方法的作用：Returns an image containing the contents of the specified display，乍一看与 截图没有直接关联，但它却成为了各种截图软件的关键。

因为回归了表现本质，截图即是对屏幕图片进行区域选择（第一性原理）。

而当实现核心能力后，我们又可能再提供 截图时蒙版，标注工具栏功能，这样一款基本的截图软件就成型了（鸭子理论）。

下一期话题预告：信息技术 与人 的相似性。

### 文章

#### [Decoding the no-code / low-code startup universe and its players](https://pinver.medium.com/decoding-the-no-code-low-code-startup-universe-and-its-players-4b5e0221d58b)

近些年围绕 NCLC 踊跃出了不同形态的产品，如项目管理 Meego、低代码系统 Retool、在线文档 Notion 等，甚至本文中还将 NCLC 细分为了 12 个发展赛道。

其中业界内发展最为迅猛、最有代表性的产品形态莫过于 建站类。

![img](https://raw.githubusercontent.com/Tomotoes/image/master/img\(null\)-20221115235659819.\(null\))

#### [Is it still possible to live in a terminal?](https://news.ycombinator.com/item?id=33205970)

HN 上的一个问题，是否能一直在终端中生活？

高赞回答是：非研发相关的事情不建议。

原因也很明显，非研发相关的基础设施是很少有人关心，很难保障的。

#### [How Trying New Programming Languages Helped Me Grow as a Software Engineer](https://cichocinski.dev/blog/trying-new-programming-languages-helped-grow-software-engineer)

> When you use one programming language daily in your job as a Software Engineer, it's easy to fall into the trap of that language bubble. I want to show you how stepping outside your comfort zone and learning new languages and paradigms helped me grow as a Software Engineer.

学习时应追随自由，不设边界，不要在自己的领域故步自封，应逃离舒适区，多试错方能快速成长。

#### [How the clipboard works](https://whynothugo.nl/journal/2022/10/21/how-the-clipboard-works/)

从技术角度介绍 剪切板的工作流程，剪切板之于应用就像是共享的外部 IO。

#### [浅谈搭建平台-画布篇](https://tomotoes.com/blog/canvas/)

分享篇最近写的一篇关于 NCLC 的文章：

近些年搭建平台变得很是流行，它提供了一种全新的开发方式，同时大幅降低了使用者的门槛，解决了企业的两大痛点：开发效率与人员转型。

搭建平台由编辑器（画布+设置器）和生成器组成，本文将重点介绍画布，分为架构设计与画布设计两个章节来展开。

#### [Web Browser Engineering](https://browser.engineering/index.html)

浏览器工作原理的系列好文。

作者使用 python 、tk 框架，从 0 实现一个简易的浏览器。

从其中不难看出，鸭子理论的应用，文章对原理剖析得很透彻，推荐阅读。

#### [The future of rendering in React](https://prateeksurana.me/blog/future-of-rendering-in-react/)

一篇介绍 React 渲染方式的好文。

从 CSR 到 SSR，再到 流式 SSR 以及 React18 推出的 Server components，文章都有涵盖。

并且整体脉络清楚，原理也清晰易懂（配有视频），推荐阅读。

延伸阅读：<https://github.com/reactwg/react-18/discussions/37>

#### [Deduping 28 Million Strings Using JavaScript](https://stackoverflow.com/questions/74329830/deduping-28-million-strings-using-javascript)

Stackoverflow 上的一道问题，如何使用 JavaScript 在 2800w 的数据中去重。

下面的回答大部分围绕 chunk 解法来展开，也有人推荐使用 shell 命令（有很大程度的优化）。

我个人推荐是 布隆过滤器 负责是否命中 + 分块 chunk 循环处理数据。

#### [WHY WOULD ANYONE NEED JAVASCRIPT GENERATOR FUNCTIONS?](https://jrsinclair.com/articles/2022/why-would-anyone-need-javascript-generator-functions/)

一篇介绍 generator 的好文。

文章用 `Tim Tams` 作为引子，介绍 generator 对操控流式数据的便利，然后又通过 compose generator 实现素数筛的例子，进一步证明了 generator 在数据处理方面的强大。

并且作者也同步了 genetator 在 tc39 与 社区的一些发展，同时梳理了 generator 与 async、await 之间的差异，以及如何模拟实现。

文末给出了 使用 Either functor 处理 csv 文件的案例。

文章信息量大而精，推荐阅读。

延伸阅读：<https://www.proposals.es/proposals/Iterator%20helpers>

### 项目

#### [valtio](https://github.com/pmndrs/valtio)

> Valtio makes proxy-state simple for React and Vanilla

#### [Robot Framework](https://robotframework.org/)

> Robot Framework is a generic open source automation framework. It can be used for t[est automation ](https://robotframework.org/test-automation/)and r[obotic process automation (RPA).](https://robotframework.org/rpa/)

#### [Hey, GitHub!](https://githubnext.com/projects/hey-github/)

> Difficulty typing? Use your voice to code without spelling things out by talking with GitHub Copilot.

#### [half baked ideas](https://halfbakedideas.app/feed)

> Internet's best half-baked app ideas at one place.

#### [Rome](https://rome.tools/blog/2022/11/08/rome-10/)

> **Rome** is an ambitious project aiming to unify the dozens of frontend language tools into a single easy-to-use tool built from scratch.
>
> This release includes our *fast* **linter** **and formatter**; they require minimal configuration, come with beautiful and descriptive diagnostics, and have built-in support for JavaScript and TypeScript.

#### [GitHub Blocks](https://blocks.githubnext.com/)

> Extend your codebase with custom, interactive blocks.
>
> Build rich documentation, enhance your workflows, and bring your repository to life.

### 生活

超级超级超级忙碌的一周。

全新的工作内容 与 处于关键项目上线的窗口，工作压迫得人喘过不气。

几乎连续一周加班到凌晨，睡觉质量也下滑很多，睡不踏实，经常做梦都是工作...

周四又因上周六去了超市 判定成了时空接触，需要被封控在家 3 天，算是雪上加霜了。

在家工作等价于 让工作侵入生活，基本上毫无平衡可言了。

因为很累，所以我没办法习惯。

希望下周会轻松一些吧..

本周轮到我阳历生日，又一次感受到 Leann 准备的小惊喜，爱你。

### 历史回顾

#### [1](https://thinking.simonaking.com/weekly/1 "mention")

本周补充完善了第一期周刊，增加了完整的分享内容，使用了全新的排版方式，欢迎阅读与指正。
