4 ms·
Ask HN: How to get started with a very large code base?
I recently got started with a very large code base for a project, and I can't find my way through it, the documentation is very bad, do you have any specific advice for getting started with such code base ? Any tips will be helpful.
- jerf 11y agoDebuggers are great for this. Nothing will teach you like stepping through the code. Do whatever it takes to get one working. I recommend replying to your question with at least a bit more detail, particularly the language or languages in question and what the general environment is. I could be more detailed for a few environments but I don't want to just blindly guess.
- dev1n 11y agoI found this [1] in a comment where someone asked a similar question. This really helps only if you are using a git repo though. There are some good gems in this [2] thread too. [1]: https://github.com/gilesbokett/rewind https://github.com/gilesbokett/rewind [2]: https://news.ycombinator.com/item?id=9784008 https://news.ycombinator.com/item?id=9784008
- DrScump 11y agoI get -404 with [1]
- stray 11y agoWrite tests for every behavior the system currently exhibits. Then systematically comment out everything -- one function/block/class/whatever at a time -- making note of which tests break. That should give you a better idea of how everything hangs together -- and uncover the parts that aren't even used anymore. Almost any software that you inherit, that has been around for a while, will be a complete mess. If you have time for a book, Michael Feathers' Working Effectively with Legacy Code will likely help a lot.
- jerf 11y ago"Write tests for every behavior the system currently exhibits." That's often harder than just bashing your head against the problem. Retrofitting code bases with any sort of unit testing is almost always a challenge on its own terms... one much easier when one has at least an idea of how it's working already. And that's after I apply the principle of charity and downgrade "every behavior" to "many behaviors of interest". It'd be great if it works, but I suspect it would only work when it's unnecessary anyhow because any code base amenable to that treatment wasn't that hard of a problem in the first place.
- stray 11y agoI am of course, making the assumption that OP knows what the software does -- but not how it goes about doing it.
- deleted 11y ago[deleted]
- DrScump 11y agoTake notes (external to the code) on everything you learn about a given module, whether code/flow analysis, insights on input / output / objects, visible interactions, and what it reveals about how project-specific libraries are used. Otherwise, it's so easy to have an "oh, that's what that does" insight and lose it later because you assumed you'd remember it.