What's the best way to read and understand someone else's code?
Find one thing you know the code does, and trace those actions backward, starting at the end
Say, for example, you know that the code you're viewing ultimately creates a file with a list of movie titles. Figure out where in the code - the specific, few lines - it generates that file.
Then, move one step backward and figure out how it places the info in the file.
Them, move another step backward and figure out where the info came from
how the body of code is organized(where variables are defined, where different types of functions are located, etc)
the person's style of coding
how the person who wrote the code thinks and problem solves
[ a big file of code that doesn't really mean much at all to you ]
you'll now be looking at:
[ still a big file of code, but where you now understank a few specific sections ]
using "chains of actions" to gradually understand a never-before-seen piece of code
Rinse and repeat
Repeat that process multiple times, and you'll rapidly increase your understanding of more and more pieces of the overall codebase
The reason that works well is that, in all cases, a body of code is designed to tackle one or more complex problems. So you'll always have those "chains of actions" throughout
And the more you can gain an understanding of how different parts of the code are connected, the more you'll develop an understanding of the entire codebase
The more good code you see, the easier it becomes to read and understand all code, and the faster you cando so
The more you watch to expert examples, the better you can become. The less exposure you have to experts or result of expert workm the less likely you are to develope expert skills
What's the best way to read and understand someone else's code?的更多相关文章
- .net点选验证码实现思路分享
哈哈好久没冒泡了,最进看见点选验证码有点意思,所以想自己写一个. 先上效果图 如果你被这个效果吸引了就请继续看下去. 贴代码前先说点思路: 1.要有一个汉字库,并按字形分类.(我在数据库里是安部首分类 ...
- C# 在腾讯的发展
本文首发我的微信公众号"dotnet跨平台", 内容得到大家热烈的欢迎,全文重新发布在博客,欢迎转载,请注明出处. .NET 主要的开发语言是 C# , .NET 平台泛指遵循EC ...
- 你必须知道的EF知识和经验
注意:以下内容如果没有特别申明,默认使用的EF6.0版本,code first模式. 推荐MiniProfiler插件 工欲善其事,必先利其器. 我们使用EF和在很大程度提高了开发速度,不过随之带来的 ...
- 关于CryptoJS中md5加密以及aes加密的随笔
最近项目中用到了各种加密,其中就包括从没有接触过得aes加密,因此从网上各种查,官方的一种说法: 高级加密标准(英语:Advanced Encryption Standard,缩写:AES),在密码学 ...
- 试试SQLSERVER2014的内存优化表
试试SQLSERVER2014的内存优化表 SQL Server 2014中的内存引擎(代号为Hekaton)将OLTP提升到了新的高度. 现在,存储引擎已整合进当前的数据库管理系统,而使用先进内存技 ...
- CoreCLR源码探索(一) Object是什么
.Net程序员们每天都在和Object在打交道 如果你问一个.Net程序员什么是Object,他可能会信誓旦旦的告诉你"Object还不简单吗,就是所有类型的基类" 这个答案是对的 ...
- 【.net 深呼吸】细说CodeDom(3):命名空间
在上一篇文章中,老周介绍了表达式和语句,尽管老周没有把所有的内容都讲一遍,但相信大伙至少已经掌握基本用法.在本文中,咱们继续探讨 CodeDom 方面的奥秘,这一次咱们聊聊命名空间. 在开始之前,老周 ...
- 【.net 深呼吸】细说CodeDom(1):结构大观
CodeDom 是啥东东?Html Dom听过吧,XML Dom听过吧.DOM一般可翻译为 文档对象模型,那 Code + DOM呢,自然是指代码文档模型了.如果你从来没接触过 CodeDom,你大概 ...
- Asp.Net Mvc 使用WebUploader 多图片上传
来博客园有一个月了,哈哈.在这里学到了很多东西.今天也来试着分享一下学到的东西.希望能和大家做朋友共同进步. 最近由于项目需要上传多张图片,对于我这只菜鸟来说,以前上传图片都是直接拖得控件啊,而且还是 ...
- 十分钟介绍mobx与react
原文地址:https://mobxjs.github.io/mobx/getting-started.html 写在前面:本人英语水平有限,主要是写给自己看的,若有哪位同学看到了有问题的地方,请为我指 ...
随机推荐
- 算法题:消除字符串中全部的b和连续的ac
最近碰到了一道面试题,虽然不难但是临试没想出好的解法,记录下来以作分享. 题目:消除字符串中全部的b和连续的ac 用例: 'aabbc' -> 'a' 'aaabbbccc' -> '' ...
- nuxt中asyncData和fetch的区别
asyncData作用于页面pages,在组件中不能使用,并且asyncData中没有this,如果想要给data中的数据赋值,要在asyncData函数中return出去 fetch 作用于组件中c ...
- 4组-Beta冲刺-1/5
一.基本情况 队名:摸鲨鱼小队 组长博客:https://www.cnblogs.com/smallgrape/p/15590583.html github链接:https://github.com/ ...
- PVE联网及更换国内源
一.PVE联网 第一次安装PVE,正常情况下PVE的IP是在我们上网的网段的.没有网络有可能是没有配置DNS服务器地址或DNS地址是软路由网关地址.解决方法有3种: 1:设置DHCP自动获取网络地址和 ...
- 面向对象ooDay9
精华笔记: 多态:多种形态 同一个对象被造型为不同的类型时,有不同的功能-------所有对象都是多态的(明天总结详细讲) 对象的多态:水.我.你...... 同一类型的引用在指向不同的对象时,有不同 ...
- vue3 技术浏览 收藏
Vue3教程:Vue3.0 + Vant3.0 搭建种子项目 链接:https://www.cnblogs.com/han-1034683568/p/13875663.html
- 容器数据库(CDB)和传统的非容器数据库的区别
传统的非容器数据库在系统元数据和实例资源没有进行任何共享.容器数据库把 Oracle 提供的元数据.后台进程以及内存结构进行共享,把每个部门数据库的存储结构以 PDB 的形式独立出来,从而实现了系统资 ...
- spring java枚举转json 方便前端取值
未处理前: "gender":"GenderEnum.FEMALE(code=2, gender=女)" 解决方法:使用jackson提供的注解 @JsonFo ...
- 精通Spring 4.x 企业应用开发实战 文档链接总结
Spring在线文档 http://docs.spring.io/spring/docs/current/spring-framework-reference/htmlsingle
- 这几年专注于流程管理与RPA落地
这些年专注于流程管理与RPA落地,乙方有些辛苦,但,也得到了客户的认可,开心. 做过多个流程管理咨询,发现信息化落地后孤岛很多,RPA 刚好可以作为各个系统的有效补充,把系统有机的结合在一起. 企业信 ...