Programming question: First large codebase
#1
Brick 
Hello, I am planning to do some contributions to MCServer. I have questions about programming in general, mainly about approaching large codebases.

I am good at tackling specific, narrow algorithms. This is why I am planning to implement an A* algorithm for MC-server (Sorry for the delay!). I am interested in learning the MC-server codebase, However, I have never worked on a codebase as large as this and to be honest I don't know how to approach it.

Don't get me wrong, I can definitely implement the algorithm while being blissfully ignorant of the bigger picture, provided I learn the few parts of the interface I need. E.g. (roughly) Give me a getBlockAtPos function and I can implement the A* it without knowing the rest of the code base.

But that's what I always do, whenever I want to contribute to some large project, I always ask someone to tell me the where the small bits of the interface that I need are found, and I end up with a collection of several functions from the codebase that I deal with, and then do my own little narrow work, completely ignorant of what the rest of the codebase does. While this approach works, it has many disadvantages. So this time, I want it to be different. I want to properly learn the codebase.


But how? I have never dealt with gigantic code mass before. What are the best approaches for digesting a big project? How does one approach this in general? Do you only study the headers first? Do you just read the files over and over till you get it? Are there any techniques? Any reading material that can help me? Is it even practical for a single human being to know every corner of such codebase?

Please share your thoughts,
Thanks!

I should add that I don't have any problems at all with large codebases that *I* wrote by myself. My questions are about diving into a codebase that others wrote.
Reply
Thanks given by:
#2
A workable, though time-consuming method could be to simply follow changes to the server and the issues that they fix, and also work out solutions to the many issues reports open. That would give a good familiarity to the code.

You could also try following the execution path from start to finish as a computer would. Look at what happens and what is run each tick.

Alternatively, look through header files and use VS to examine which functions are called by whom, and what do they themselves call/do. Look at some important files such as the block handlers, World.cpp, Chunk.cpp and perhaps how the simulators control the world.

An inheritance map, generated by Doxygen or VS Community Edition (like Professional but free), may also aid you in understanding how things link together.



Of course, I'm sure xoft could bypass that work and just explain it all to you :P
Reply
Thanks given by:




Users browsing this thread: 1 Guest(s)