当前位置:网站首页>对libco的一点看法
对libco的一点看法
2022-07-01 00:35:00 【51CTO】
不知从什么时候开始,我经常会思考一个问题,即什么才算是一个好的代码?我们来看看这一段描述:
‘Good code’ is code that works, is bug free, and is readable and maintainable. Some organizations have coding ‘standards’ that all developers are supposed to adhere to, but everyone has different ideas about what’s best, or what is too many or too few rules. There are also various theories and metrics, such as McCabe Complexity metrics. It should be kept in mind that excessive use of standards and rules can stifle productivity and creativity. ‘Peer reviews’, ‘buddy checks’ code analysis tools, etc. can be used to check for problems and enforce standards.
好的代码是代码运行正常、bug很少、并且具有可读性和可维护性。一些企业自己有所有开发人员都必需遵守的编码规范,但是对于什么样的代码是最好的每个人的都有自己的标准、或者有太多的或太少的编码规则。这有多种原则和标准,例如,McCable 的复杂度度量。的确使用过多的编码标准和规则可能降低生产率和创造性。“同行评审”或“同事检查”代码分析工具等,都能用来检查问题或坚持标准。
是的,这一段话算是回答了我的疑问,但在我看来这还是片面的。对于这个问题我的看法就是:解决了实际问题的代码算是好代码。不论是redis,nginx都是这方面的标杆,它们都是作者对现况不满而被创造出来用以解决实际问题的,而且确实解决了问题。不是说这两个项目在难度上有多大,找一个有意愿的大学生,在肯钻研的情况下,我相信他一定能看懂那两个神作的代码。在这个方面来说,我认为libco是一个好项目,因为它确实完美的承接了微信后台从半同步半异步到异步的转化,并且代码的实现也可圈可点,很多地方的精巧设计确实不是常人所能完成的。
但是我觉得从一个开源项目的角度来说libco不能算是一个好的项目。因为它的官方文档几乎可以理解为0,也就是啥都没有。我甚至怀疑在libco被开源的前一天晚上TX的工程师们在一行一行的删注释。可能整个libco的注释加起来也没有一百行吧。其次其实libco的社区至少在github上来说并不是特别活跃,提了几个issue,交了几个patch,issue的回复是答非所问,patch这么久过去了也没有收到回复。可以看到最早的更新也在半年以前。
当然这些都是可以理解的,毕竟干这事可能公司也不会多发工资。
参考:
- 博文《 究竟怎样写代码才算是好代码》
边栏推荐
- Inventory the six second level capabilities of Huawei cloud gaussdb (for redis)
- VR panorama adds contrast function to make the display of differentiation effect more intuitive!
- 2022-2028 global plant peptone industry research and trend analysis report
- 2022-2028 global encrypted external hard disk industry research and trend analysis report
- 2022-2028 global ultra high purity electrolytic iron powder industry research and trend analysis report
- Random ball size, random motion collision
- [designmode] factory pattern
- Yboj mesh sequence [Lagrange interpolation]
- 合适的工作就是好工作
- The programmer's girlfriend gave me a fatigue driving test
猜你喜欢
What should I do without 50W bride price
The full technology stack, full scene and full role cloud native series training was launched to help enterprises build a hard core cloud native technology team
2022-2028 global ICT test probe industry research and trend analysis report
【日常记录】——对BigDecimal除法运算时遇到的Bug
20220216 misc buuctf another world WinHex, ASCII conversion flag zip file extraction and repair if you give me three days of brightness zip to rar, Morse code waveform conversion mysterious tornado br
The college entrance examination in 2022 is over. Does anyone really think programmers don't need to study after work?
2022-2028 global carbon fiber room scraper system industry research and trend analysis report
CentOS install MySQL
CMU15445 (Fall 2019) 之 Project#1 - Buffer Pool 详解
Manage edge browser settings (ie mode, homepage binding, etc.) through group policy in the enterprise
随机推荐
双链表:初始化 插入 删除 遍历
Solutions to errors in installing OpenSSL for CentOS 6.3 x64 PHP 5.2.6 extensions
Deployment of mini version message queue based on redis6.0
Random ball size, random motion collision
连表查询 select 生成
[untitled]
2022-2028 global 3D printing ASA consumables industry research and trend analysis report
Redis - sentinel mode
P4学习——Basic Tunneling
Thoughts on the future of data analysis in "miscellaneous talk"
The difference between union and union all in MySQL
ABAQUS 2022 software installation package and installation tutorial
20220216 misc buuctf backdoor killing (d shield scanning) - clues in the packet (Base64 to image)
Manage edge browser settings (ie mode, homepage binding, etc.) through group policy in the enterprise
Two-stage RO: part 1
A single element in an ordered array
Don't worry about whether you can be a coder if you don't learn English well. Learn it first
Host FL Studio fruit music production daw20.9
[UML] UML class diagram
Excuse me, does Flink support synchronizing data to sqlserver