问题描述
在过去的5年左右的时间里,我一直在研究非常不同的项目和系统.这些项目的代码在质量,样式和大小方面存在很大差异.我看到了两个示例:清理以及令人反感的1000行函数以及if条件代码.
For the past 5 or so years, I've been working with vastly different projects and systems. Code for those projects differed significantly in terms of quality, style, size. I saw examples of both: clean as well as disgusting 1000 lines functions and if conditions code.
在阅读别人的代码,理解系统的内部结构等方面,我仍然感到不称职.
I still don't feel quite competent at reading other people's code, understanding systems' internals, etc.
我想了解一下您使用哪些技术来提高阅读和理解他人代码的技能,如何快速入门,常用的工具,方法等.
I would like to find out what techniques you use to improve your skill at reading and understanding other people's code, how to get up to speed quickly, what tools, methods, etc commonly employed.
让我给这个答案,很多人会为之:您可以通过阅读代码来提高阅读代码技能
Let me give this answer that many will just gun for it: you can improve reading code skills by reading code
有一篇相关的文章可以提高编程技能,该文章可能有用并且与该文章并驾齐驱:
There is a relevant post for improving programming skills that can be useful and goes on par with this post: What is the single most effective thing you did to improve your programming skills?
推荐答案
重构对我的帮助比什么都重要.
The thing that's helped me, more than anything else, has been refactoring.
接受一个项目(可以是工作项目,个人项目,开源项目等),然后开始重构.
Take a project (this can be a work project, personal project, open source project, whatever), and start refactoring.
随着时间的流逝,您重构他人代码的次数越多,您越能融入他们的头脑",并更好地理解他们的思维方式,不管是好是坏.
Over time, the more you refactor other people's code, the better you'll "get into their head" and understand their way of thinking, whether good or bad.
这篇关于如何提高您对代码的阅读和理解?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!