当前位置:网站首页>对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这么久过去了也没有收到回复。可以看到最早的更新也在半年以前。
当然这些都是可以理解的,毕竟干这事可能公司也不会多发工资。
参考:
- 博文《 究竟怎样写代码才算是好代码》
边栏推荐
- When is it appropriate to replace a virtual machine with a virtual machine?
- Self examination before school starts
- 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
- 20220215-ctf-misc-buuctf-einstein-binwalk analyze picture-dd command separate zip file -- look for password in picture attribute
- SAP ui5 beginner tutorial 19 - SAP ui5 data types and complex data binding
- Which is better, server rental or hosting services in the United States?
- 2022-2028 global encrypted external hard disk industry research and trend analysis report
- 解决 error MSB8031: Building an MFC project for a non-Unicode character set is deprecated.
- The college entrance examination in 2022 is over. Does anyone really think programmers don't need to study after work?
- "Experience" my understanding of user growth "new users"
猜你喜欢

Member management applet actual development 07 page Jump

Random ball size, random motion collision

2022-2028 global ultra high purity electrolytic iron sheet industry research and trend analysis report

Host FL Studio fruit music production daw20.9

2022-2028 global public address fire alarm system industry research and trend analysis report

Oracle-表的创建与管理

Multi graph explanation of resource preemption in yarn capacity scheduling

New trend of embedded software development: Devops

What should I do without 50W bride price

Stack frame
随机推荐
LVM snapshot: preparation of backup based on LVM snapshot
Two-stage RO: part 1
Which is better, server rental or hosting services in the United States?
From January 11, 2007 to January 11, 2022, I have been in SAP Chengdu Research Institute for 15 years
什么是产品思维
Explain kubernetes backup and recovery tools velero | learn more about carina series phase III
SAP ui5 beginner tutorial 19 - SAP ui5 data types and complex data binding
Unit test concept and purpose
[UML] UML class diagram
2022-2028 global public address fire alarm system industry research and trend analysis report
CentOS install MySQL
Stack frame
2022-2028 global encrypted external hard disk industry research and trend analysis report
Can SQL execution be written in tidb dashboard
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
Ditto set global paste only text shortcuts
Interface documentation system - Yapi
[untitled]
Deployment of mini version message queue based on redis6.0
2022-2028 global retro glass industry research and trend analysis report