• Question: You are expected to work with a huge chunk of code and you have no idea how it works and there’s no documentation and no tests. What do you do?

    Asked by n3rdy to Angela, Gopal, Hannah, Becky, Vince on 25 Jun 2013.
    • Photo: Hannah Little

      Hannah Little answered on 25 Jun 2013:


      Start changing bits of the code to see what happens and make my own tests.

    • Photo: Gopal Ramchurn

      Gopal Ramchurn answered on 25 Jun 2013:


      Tough one – this is the typical story for a newly hired programmer ..(sometimes, you feel the same when you go back to code you haven’t seen for a few months!). The way to go about looking into the code is this:
      1. Try to run the code. If it doesn’t run, find out the errors it is throwing and try to correct them until they run.
      2. Generate some test input and run the code through a ‘debugger’ step by step to understand the logic. The debugger is a piece of software that allows you to stop your app in the middle of its execution.
      3. Identify the key functions of the code and start documenting their behaviour so you can slowly grow your understanding of the whole thing.

    • Photo: Vince Hall

      Vince Hall answered on 25 Jun 2013:


      Yeah, that sounds like some good advice.
      After taking a moment to breathe deeply and get a coffee I’d start changing things, and use a debugger. I’d probably search online (stack overflow etc.) for any commands I’ve not seen before.
      I’d comment as I go to make sure I don’t forget what I’ve just figured out.

Comments