1. 首页 > 科技资讯

redis redis,redis之父10倍程序员

但如果你仔细回顾 antriez 的风格,这就有了合理的解释。他认为对 Redis 来说,避免复杂度、保持稳定性是最重要的事,所以每天他面对众多的需求和 PR 时,大多数时候他都会说“No”,否则就会出现 Less stable code base, more problems 的恶性循环。

The bugs you write in the first implementation are extremely hard to fix later. They don’t go away easily. Basically there’s this process where you say, okay, I want to change something, but I want the software to remain stable. So you start to think about it for weeks, the way you want to do it, without writing any code.

每个新功能的引入必须要非常小心,Redis 的核心代码一直保持在万行的级别,并且在 4.0 版本之前都是单线程运行。

设计才是最重要的,而编码和实现是简单的,因为这只是水到渠成的事。

Instead, there’s this huge design process. But because of this design, sometimes we can write a new feature using half as many lines of code in a much more simple way, a much more stable way. You think and think and think and find that a couple of days ago, what sounded like the best design — it starts to sound pretty lame, actually, and you find another and another. At the end, you understand that probably that specific one was the best, and then you start doing the implementation.

This means, in turn, that people say, don’t worry, I can help you implement this. And you say, no. If you want to help me, you have to put more time into the design effort. Writing the code is the easy task. The hard task is understanding what to do and in what way to do it.

我想,这也是我们作为程序员想要提升到更高层次必须意识到的一个方面,不要过多花时间关注在编码上,而应该是花时间在思考需求和问题、找到好的设计这些事情上。

长久维护一个项目也会感觉到无聊,为了让自己保持兴趣,antriez 会尝试在不同的领域切换,比如一段时间做数据结构,过几周就切换到 cluster 之类的。并且除了 Redis 之外,他还在做更多 side project[6]:

1) Load81, children programming environment. 2) Dump1090, software defined radio ADS-B decoder. 3) A Javascript ray tracer. 4) lua-cmsgpack, C implementation of msgpack for Lua. 5) linenoise line editing library. Used in Redis, but well, was not our top priority. 6) lamernews, Redis-based HN clone. 7) Gitan, a small Git web interface. 8) shapeme, images evolver using simulated annealing. 9) Disque, a distributed queue (work in progress right now).

作为程序员 side project 是一种探索也是一种精神休息的方式,并且程序员通常会在 side project 中显得更有创造力:

Like a writer will do her best when writing that novel that, maybe, nobody will pay a single cent for, and not when doing copywriting work for a well known company, programmers are likely to spend more energies in their open source side projects than during office hours, while writing another piece of a project they feel stupid, boring, pointless.

我粗看了一下这些项目,都是 C 实现的并且风格统一,README 都会写些自己的思考和设计选择。

antriez 喜欢写小的程序,这不只是因为可以控制复杂度,而是因为短小的程序自有其美 Fascinating little programs[7],老一代程序员喜欢在严苛的限制下挑战自己的技艺,比如 Writing an editor in less than 1000 lines of code, just for fun[8]。

独立维护一个影响如此大的开源项目会有巨大的心理压力,虽然用户并没有直接付钱,但维护者有责任去修复出现的问题。这种压力不一定是技术上的,也有来自社会方面的压力,比如不断有人指责他不把代码和 API 里的 master/slaver 替换掉。

antriez 曾经在一篇采访中谈到想在家里组成一只小队伍来维护 Redis,后来又感叹到现在太难找靠谱的 C 程序员了,愿意做 system programming 的越来越少。

antriez 在这篇文章中 The struggles of an open source maintainer[9] 阐述了维护开源项目的难处,其中提到在 Redis 项目用户多了之后,自己需要一直处于在线状态。而他习惯的工作方式是工作一段时间然后彻底放空,他从来不习惯朝九晚五的定时工作制,甚至提到自己无法保持编程 40 分钟以上,他喜欢编码一会儿然后去带孩子或者运动一会儿再回来。

除了编程之外,antriez 对红酒和运动也很有兴趣,而他更有追求的是在写作这件事情上,可以为了写作放弃编程,这让我想到了王小波。

三年前,他发了一篇博文声明自己从 Redis 上退下来,因为他认为自己想做的是艺术家那样的创造性工作,编程也是自己表达方式的一种,而 Redis 发展到现在这个程度创意性事情更少,事务性的工作更多了,这不是自己所期望的:

I write code in order to express myself, and I consider what I code an artifact, rather than just something useful to get things done. I would say that what I write is useful just as a side effect, but my first goal is to make something that is, in some way, beautiful. In essence, I would rather be remembered as a bad artist than a good programmer.

Redis 交给了几个核心维护者,这些人已经和他在开源社区有多年的配合,所以对社区来说这是个很自然的选择。

在停下编程的这几年,他默默地完成了名为 Wohpe[10] 的科幻小说,这本小说是关于人工智能和气候变化等,原文用意大利语写成,但现在也有英文翻译版本。

I now know for sure: it is no coincidence that for hundreds of years writing has been considered the highest art in which to try one's hand. By writing you look for things, and if you insist enough you end up really finding them.

写完小说后 antriez 还有些犹豫到底是回到编程还是继续从事其他写作,或者是边写作一边做些技术。直到前段时间,暂别了两年之后 antriez 终于通过 Advent of Code[11] 找回了编程的乐趣,他解决了 18 道题目,并且在过程中又折腾出来一门 stack-based 的编程语言。从 Twitter 上看,最近他在做一些 LoRa 设备上的小项目,也折腾 Flipper Zero 这样的极客设备。

总之,antriez 的博客非常值得一读,其中有一篇 英语是我 15 的伤痛[12] 让我很有共鸣,作为英语非母语的开发者,要融入到英语的环境中需要很多额外努力,而这是技术圈里大多数英文母语者根本不会在乎和谈论到的事。

他的博客里还有些好文章:

编程中保持心流,编程中如果有新的想法和问题发现,你可以先记录下来以后再回顾,这叫作 Log driven programming[13]。

For me other people making money out of something I wrote is not something that I lost, it is something that I gained. Redis 使用 BSD[14]。

Arts are one of the few things worth life's best efforts. Programming is art, if done in certain ways.

Life is too short to work like crazy for most of its part.

The mythical 10x programmer[15]

Programming and Writing[16]

看了这么多 antriez 相关的文章后,最让我印象深刻的也是好奇心,并且在好奇心的驱使下不断去做有乐趣的事。

保持兴趣,不只是技术上,生活上的兴趣也很重要,红酒、CrossFit、写作,以及冰激凌,antriez 和 Redis 的第一位用户 (老同事) 一直合开着一个冰激凌店!

>>>>参考资料

[1] idle scanhttps://en.wikipedia.org/wiki/Idle_scan[2] LLOOGG Memory DB: https://gist.github.com/antirez/6ca04dd191bdb82aad9fb241013e88a8[3] 读过 memcached 的源码https://catcoding.me/p/memcached/[4] EDA 开发https://catcoding.me/p/3-years-in-eda/[5] Redis 设计与实现http://redisbook.com/index.html[6] side projecthttp://antirez.com/news/86[7] Fascinating little programshttp://antirez.com/news/74[8] Writing an editor in less than 1000 lines of code, just for funhttp://antirez.com/news/108[9] The struggles of an open source maintainerhttp://antirez.com/news/129[10] Wohpehttp://antirez.com/news/136[11] Advent of Codehttps://github.com/antirez/adventofcode2022[12] 英语是我 15 的伤痛http://antirez.com/news/61[13] Log driven programminghttp://antirez.com/news/51[14] Redis 使用 BSDhttp://antirez.com/news/48[15] The mythical 10x programmerhttp://antirez.com/news/112[16] Programming and Writinghttp://antirez.com/news/135

作者丨yukang

来源丨公众号:程序员的喵(ID:coderscat)

dbaplus社群欢迎广大技术人员投稿,投稿邮箱:editor@dbaplus.cn

关于我们

dbaplus社群是围绕Database、BigData、AIOps的企业级专业社群。资深大咖、技术干货,每天精品原创文章推送,每周线上技术分享,每月线下技术沙龙,每季度Gdevops&DAMS行业大会。

关注公众号【dbaplus社群】,获取更多原创技术文章和精选工具下载

本文采摘于网络,不代表本站立场,转载联系作者并注明出处:https://www.miyuegong.com/kejizixun/70712.html

联系我们

在线咨询:点击这里给我发消息

微信号:666666