What method do you use to read or understand someone else code ?

  • 14
    @rutee07 I just spend time reading the shit and hope that my head wont explode.
  • 13
    Read it forward. Then read it backwards (literally). That shows you what is written and reading backwards breaks your brain out of baseline syntax recognition. This also helps when debugging your own code.

    If they didn’t comment it, branch and comment it while you’re parsing it for understanding. If the comments are accurate. Commit them and merge.
  • 4
    Mainly just work out what I'd do, work out what they did differently, work out what is wrong.

    Usually something...
  • 7
    I select a task that the code was made for and trace how it's doing that.
    I repeat that to understand other parts.
  • 6
    Reverse engineer the shit out of it. Pick something you'd like to do and go backwards from there. If it's an API endpoint, find the router and follow it to the controller and so on.
  • 5
    @ScriptCoded I like that idea.
  • 3
    I put it in a debugger. Usually you need to understand a feature or a routine the code follows on certain action. I find where it is first handled and follow the functions that makes sense.
  • 1
    I open almost every called methods in the code and end up having about 40 Notepad++ tabs.
  • 4
    1. Read it
    2. Run it
    3. Debug the piece of shit
    4. Ask them or someone else why it won't start
  • 1
    Keeps on ranting and complain until I figured it out
  • 2
    Read it. Run it. Step through it. Pry it open when needed.
  • 1
    when I'm supposed to make changes to a system i cmd-shift-f the project and look for possible method names that I need to work on and after i've found one I go through its implementation and make changes to it. This has never failed me so far 😄
  • 1
    @nixed even though it's pretty time consuming, I like this strategy of branching and commenting. Hopefully shows the original creator just how important readable code and documentation is. Plus you have a fallback when some function is not making sense.

    "But I am agile, I don't need no documentation!"
  • 1
    Start at the end of the code and keep dumping variables until you hit variable you inputed. Or remove code you dont unserstand and see what breaks... error messages are sometimes better than shitty documentation
  • 2
    If it's a clean code, I just read methods names,classes names and I get the idea of what the code does.

    If it is NOT a clean code -- I don't bother reading it and just test it. Assuming it has a nice tests' suite..

    If there are no tests and the code is messy I do not trust that code. I'll do some manual testing and if it passes I'll assume it works for now, but will always keep in mind that if any problems occur - that particular code might have something to do with it.
  • 0
    @Haxk20 same, using my limited RAM in my small brain.
Your Job Suck?
Get a Better Job
Add Comment