Office LifeNov 14, 2019
AdobeNowIN

left to babysit a huge codebase

just switched jobs and the owner of the code had just left. the code is hardly commented and there is no proper documentation in a language i am not fully familiar with. i spoke to my manager abt this and I was told to hang in there for a few weeks until some resolution. they also added to treat it as a good first project and as an opportunity to dazzle everyone 😉. how would you go about understanding the code? ps: i saw dinesh and gilfoyle understanding Richard’s code after he left in Silicon valley — looking for some tips like that. pps : language is in objective C

Add a comment
Snapchat Romantico Nov 14, 2019

Recommended reading: "Working Effectively with Legacy Code".

Juniper sixpack Nov 14, 2019

You start with tests. If you are able to understand what tests test, you will get a bird’s eye of codebase.

Autodesk fomo! Nov 14, 2019

What if youre expected to write the tests for a code you have no understanding of?

Google zMbf28 Jul 10, 2020

Then you try your best to write some tests that capture the current behavior of your system. Starts from there as the invariants of the system.

HPE techpmg Nov 14, 2019

Single step debugging is the best way to learn the code. Example: going thru end to end flow of getconfig.

OpenTable Meliodas Nov 14, 2019

Objective-C is pretty verbose, it would be unusual to see it heavily commented. Set breakpoints and use the view debugger to find the relevant classes.

Activision Blizzard battat7 Nov 14, 2019

Write UTs and you're on your way. Writing tests for legacy code can a living nightmare but you end up understand wtf is going on and have living documentation of it

Pandora joystick Nov 15, 2019

Start rewriting the codebase or parts of it in Swift.

Adobe NowIN OP Nov 15, 2019

Thats not an option

Snapchat Romantico Nov 15, 2019

Maybe obvious, but use an IDE to navigate the code and jump to definitions, callers, etc. Some decent tooling can alleviate significant pain.

Facebook TioAzul Nov 15, 2019

Print it and read it.