> 一份2021年03月26日的信息流提炼 #### 软件设计的哲学 | John Ousterhout 在Google的谈话 [Youtube | A Philosophy of Software Design | John Ousterhout | Talks at Google](https://www.youtube.com/watch?v=bmSAYlu0NcY) - Q: 在CS中最重要的事|most important thing in CS - 分解(**Decomposition**) - 其他:abstraction, testing, composition, complexity ##### 一些整体概念 | A frew overall concepts - 仅仅有工作代码是不够的:必须将复杂性降到最低 - > Working code isn't enough: **must minimize complexity** - 复杂性来自于依赖性和模糊性 - > **Complexity** comes from dependencies and obescurity - 战略与战术编程 - > Strategic vs. tactical programming - 好的抽象: **类要深入** - > Good abstractions: **Classes should be deep** > > Simple inferface & Large amount of functionality underneath it. - 通用类更深入 - > General-purpose classes are deeper - 新的层次,新的抽象 - > New layer, new abstraction - 注释应该描述那些从代码中看不出来的东西。 - > Comments should describe things that are not obvious from the code - 定义不存在的错误 - > Define errors out of existence - 在代码review时最具建设性 - > Most constructive in the context of code reviews ##### 一个优美的深度接口|A Deep Interface - Unix file I/O - `int open(const char* path, int flags, odet permissions);` - `int close(int fd)` - `ssize_t read(int fd, void* buffer, size_t count);` - `ssize_t write(int fd, const void* buffer, size_t count);` - `off_t Iseek(int fd, off_t offset, int referencePosition)` - 在接口之下隐藏着|Hidden below the interface: - 盘表示,磁盘块分配|On-disk representation, disk block allocation - 目录管理,路径查询|Directory management, path lookup - 许可管理|Permission management - 磁盘调度|Disk scheduling - 块缓存|Block caching - 设备独立性|Device independence ##### 战略与战术编程|Tactical vs. Strategic Programming - 战术编程|Tactical programming - 目标:尽快完成下一个功能/缺陷修复工作|Goal: get next feature/bug fix working ASAP - 一些捷径和脏代码就OK?|A few shortcuts and kludges are OK? - 结果:设计缺陷,复杂度高|Result: bad design, high complexity - 复杂度是递增的|Complexity is incremental - 战略编程|Strategic programming - 目标:产生一个伟大的设计|Goal: produce a great design - 简化未来发展|Simlify future development - 尽量减少复杂性|Minimize complexity - 一定要注意细节|Must sweat the small stuff - 投资心态:今天多花点时间,长线回报|Investment mindset:Take extra time today, pays back in the long run 一些印象深刻的话 - 10% slower to make design better. - I can't imagine doing software without unit tests. - I think one of the biggest obstacles to good design is mindset.If you don't have a mindset, you will just never produce a good design. 发现这些讲师在答疑时都会用自己的表达再复述一次问题,学生问的时候,整个语句的表达都比较破碎,但是他们复述的时候问题就显得清晰明了。 ### 其他值得阅读 #### Chip Huyen谈她的事业、写作和机器学习 原文:[medium | Chip Huyen on Her Career, Writing, and Machine Learning](https://towardsdatascience.com/informal-mentors-chip-huyen-4d81ee3add98) 最近,我和计算机科学家兼作家Chip Huyen聊了聊。她是我非常钦佩的人。我读过她的生活和事业,很好奇她是怎么做到的。 没想到她的故事比我想象的还要励志。她从自学英语,到就读斯坦福大学,再到加入英伟达和现在的SnorkelAI(中间经历了很多挫折)。我们还聊到了她对写作的热爱,以及写作如何改变了她的生活,以及她对机器学习在生产中的想法。 ### 一点收获 - [SimpleLogin](https://github.com/simple-login/app) 邮箱别名服务,可以隐藏自己真实的邮箱(好用...) - trove.to 收集和分享链接 - **如果目标动力是一种社会内化的规范 "我需要取得好成绩 "或 "我真的应该每天锻炼",而不是自发产生的,那么它往往只能提供不一致的动力。**本质上,我们会为了满足自己在别人眼中的外表而努力,但往往没有足够的力度去追求它,无法真正取得真正的进步。拖延症研究者皮尔斯-斯蒂尔(Piers Steel)在他的文献综述中指出的那样,任务不愉快是与拖延症相关的最大因素之一。 - 解决方案:(1)重新设计目标使它们不那么令人不愉快( 2)做一些更喜欢的事来替代(3)恐惧症心理学:暴露疗法,即随着时间的推移,你将自己轻轻地暴露在恐惧的刺激下,对减少恐惧有很高的效果。 > If the impetus for a goal is a socially internalized norm “I need to get good grades” or “I should really exercise daily”, but doesn’t feel entirely self-generated, it can often provide only inconsistent motivation. Essentially, we’ll work at it enough to meet our appearance in the eyes of others, but often fail to pursue it vigorously enough to actually make real progress. -- Scott Young