large old codebase

Associate
Joined
19 Jul 2006
Posts
1,847
Looking for some tips.
I normally work on my own projects on small websites and web apps.

I have recently got a job working for a company as a developer, there is a few of us and they are really nice.
However the codebase is large and its a bit over whelming.

Just wondered how you experienced devs deal with getting to know a larger system and any tips on how to pick it up quicker
 
What langauge/architecture is it? What's the documentation like? Any "old hands" still working for the company?
 
PHP with a really unkown framework. with a scattering of javascript in there to.
No real documentation or code comments. Even the fraimwork has little docs ( 1 page)

Theres a few seniors here that are happy to help me but dont want to be disturbing them all the time
 
If it was me I would get a pen and paper then try and draw it out to try to visualise what its going on. Start big and then go deeper as you get a grasp on the main concepts.
 
If it was me I would get a pen and paper then try and draw it out to try to visualise what its going on. Start big and then go deeper as you get a grasp on the main concepts.

Spoken like someone who has never worked an an actual big project before:p
 
Are you working on one particular area of the code base? Most senior developers will happily talk about code if you are asking the right questions and show understanding.
 
You poor thing. My heart goes out to you :(.

I was thinking kill it with fire, but that's probably not a good way to start a new job.

So a few basics:

1) Can you build it i.e. do the build instructions / scripts work ?
2) Can you deploy it i.e. build a test system you can fiddle with and break without killing your employer's business
3) Are there any design document, wikis, stone tablets. i.e. something to tell you what its supposed to do.
4) What does it really do ? Ask some of the users to show their daily activities on it.

Once you can get that lot sorted ... then:

5) Is there a bug tracking system. Take a look at the last 20 fixed bugs, find where they are in the system and then look at what code was changed to fix them.
6) Are there any active changes being worked on by the senior devs. Shadow them and ask the thought process of what they are doing.


It will be a divide-and-conquer sort of thing. I bet the senior devs don't know it all - but they will know where to look to find an answer.
 
Theres a few seniors here that are happy to help me but dont want to be disturbing them all the time

It's their job to be bothered - if they don't want to be bothered they'd have documented the system a bit better.

As part of understanding the system - start documenting what you find, preferably in wiki format, with as many diagrams as you can.

Does it have any automated tests in place? Does the DEV/UAT environment work? Can you build and deploy it automatically?
 
Someone should have given at least a structural overview of the code base, how different components work with each other etc. If they haven't, ask. It'll save you a lot of time.

Also it's good to know who the experts are on the different areas of the code base for when you have questions. As peterwalkley said, it's unlikely anyone knows it all well.

But my favourite advice for any coder is to read the source if you're not sure how something works. Not only will you end up knowing the code base a lot better than if you just asked but you'll likely learn other things too.
 
Thanks for the replys.
So week in and I'm going through phases of thinking I am getting it then feeling like I am back at square one.

From speaking to a few the system has grown massively over the past few years. There is no real standards no documentation and code comments are very sparse.

I do have a local dev environment and database with dummy data in so I develop safely. However there is no tests other then user testing and to be honest I think even trying to impliment tests at this stage of the code would be lots more work then it would save.

There is massive functions with if statements in which I would have broke out into separate functions but its all like that so I will just have to suck it up and get used to it.

I have done a few error fixes and small additions which has helped. I think a big part of my problem what trying to understand it all to start with rather then just easing in.

Think also as I dont really understand the business workflow its making things more dificult
 
Thanks for the replys.
So week in and I'm going through phases of thinking I am getting it then feeling like I am back at square one.

From speaking to a few the system has grown massively over the past few years. There is no real standards no documentation and code comments are very sparse.

I do have a local dev environment and database with dummy data in so I develop safely. However there is no tests other then user testing and to be honest I think even trying to impliment tests at this stage of the code would be lots more work then it would save.

There is massive functions with if statements in which I would have broke out into separate functions but its all like that so I will just have to suck it up and get used to it.

I have done a few error fixes and small additions which has helped. I think a big part of my problem what trying to understand it all to start with rather then just easing in.

Think also as I dont really understand the business workflow its making things more dificult

The situation you're in is not unfamiliar to me. I'll skip some of the programming stuff and make a few more general job comments:

1. Asking questions makes you seem smart and eager, not an idiot. Get as much context as you possibly can for the project. Especially business logic. You don't want to second-guess how things are supposed to work from someone's idea of it (the code), you want to get it right from the people who know.
2. Don't be afraid to take the pen and paper approach. It's actually a good way of abstracting at a high level that we learn to use as children. When it helps, use it.
3. When you have a good handle on the business logic behind everything, don't be afraid to have a go at refactoring things. Sometimes it's possible to dual-track development so that as well as putting in the latest urgent fix, you're working on a better solution long-term as well.
4. Identify some sort of metrics by which you can demonstrate your progress and your value. Good version control is vital for this. Use code quality tools, line counts, number of functions with comments, whatever so that you can show improvements. Nobody will care right now, but six months down the line it will help you show the value of re-writing the codebase.
5. Double-check everything and work up a really solid testing methodology. People hate it and it takes time but trust me on this - half a year from now being able to show no bugs in your code is way more valuable than having overrun a few times or told them "no, it'll be tomorrow". You don't want to enter death-spiral where you're so busy working on the bugs or misunderstandings from your last piece of work that the new piece of work starts to suffer.
6. Ask for protected time, maybe a morning a week, set aside for re-factoring and improving the code base. Tell them it will reduce bugs, improve on-boarding of new developers and probably improve performance. Alternately, ask them for the same but so that you can build out test processes. These could be unit tests using something like Codeception, or from the sounds of the project, you might be better off with front-end testing with something like Selenium. That can demonstrate an immediate value to the stakeholders and get you a good chance of buy-in.

Just some general suggestions for when you're thrown into the deep-end on a large, unstructured project. I particularly recommend the front-end testing which can be automated. There's huge value in that if they don't already have formal testing as part of their release process.
 
Back
Top Bottom