TE
TechEcho
Home24h TopNewestBestAskShowJobs
GitHubTwitter
Home

TechEcho

A tech news platform built with Next.js, providing global tech news and discussions.

GitHubTwitter

Home

HomeNewestBestAskShowJobs

Resources

HackerNews APIOriginal HackerNewsNext.js

© 2025 TechEcho. All rights reserved.

Ask HN: Reading another developers code

3 pointsby bjw181over 8 years ago
How do you go about becoming intimately familiar with someone else's previously written code in order to work with it or build upon it?

3 comments

zouhir37over 8 years ago
Here&#x27;s how I tackle it:<p>- if there&#x27;s good unit tests, I immediately feel more comfortable and confident as nothing can explain the code and behaviour more than the test suit.<p>- if there&#x27;s no Tests, but can allocate sometime to think and write tests. that&#x27;s the best documentation you&#x27;ll ever provide and benefit from.<p>- With better languages debuggers things are easier, logging to the console keeps to make me win quicker in some cases!<p>- Really long comments are confusing sometimes. and might make things more complicated than simple.<p>- Time will help you get everything. The more time you allocate to focus on the codebase you&#x27;ll find yourself more familiar. If you have time, make sure you don&#x27;t stress yourself and stare at it too long. take breaks do other things and come back to it once you brain is cleared.<p>- before you build on top: Once you understand most the ins and outs, try to burn down bugs before building on top.<p>finally - it is OK if you don&#x27;t know 100% of the code. no one can easily know a whole code base they didn&#x27;t write!
xjaover 8 years ago
I guess it really depends.<p>On projects where the level of commenting is low and theirs little to no documentation it can be tough.<p>For C projects as there&#x27;s usually a single point of entry I just start with main() and read through the code to get a conceptual overview of what&#x27;s happening. Often I find it useful to comment the code&#x2F;write basic documentation as I go.<p>Then I often attempt small changes&#x2F;refactoring to attempt to validate my understanding. Often I&#x27;ll add code to dump intermediate data to better understand what&#x27;s happening.<p>It can be quite a slow process in a large project to be honest, and it&#x27;s a lot easier if you have the original developer available to ask questions.
greenyodaover 8 years ago
You might be interested in this discussion from a few days ago: <a href="https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13282756" rel="nofollow">https:&#x2F;&#x2F;news.ycombinator.com&#x2F;item?id=13282756</a>
评论 #13371700 未加载