Web Development – How to Keep Track of Large Projects

mind-mappingobject-orientedtechniqueweb-developmentzend-framework

When dealing with a project that has many different files, I always seem to loose track of how the parts interact with one another. I've never really had much of a problem understanding smaller components in isolation, but as the complexity of the project increases, I find myself unable to mentally construct an understanding of what is going on. I notice this especially with OOP projects, as the number of methods and source files increase.

My background:
I'm a self-taught web programmer. I've dealt mostly with python for quick and dirty scripts, but I've also done a few basic django projects. I like web frameworks such as flask, because in the simplicity of a single-file layout, I can easily keep track (mostly) of what is going on.

I now find myself in a situation where I need to interact with a large Zend Framework PHP project that someone else developed, and I'm overwhelmed with trying to understand the code spread out to numerous files.

What techniques and processes have you found useful to understand a large code base that someone else has developed? Is there any particular diagram that you find helps you grasp the larger picture?

Best Answer

The trick to understanding a large code base is to not try to understand all of it. After a certain size, you can't hold a mental model in your head of the entire thing. You start with an anchor point that makes sense for whatever task you need to work on first, then branch from there, learning only the parts you need and trusting that the rest of it works as advertised. It's just like understanding recursion. If you try to hold the entire stack in your head your brain explodes.

Grep, debuggers, and intellisense are your friends here. If you don't know how a function ends up getting called, set a breakpoint on it and work your way down the stack trace.

The other thing to note is that large code bases don't spring up out of nowhere. The larger it is, the more programmers there are with experience on it, so ask them where to start, but be specific. Ask questions like, "I need to add a new payment provider. Where in the code should I be looking?" Focus on just that task instead of trying to understand the entire code base, and piece by piece your familiarity will grow.

Related Topic