13
Debate: Should beginners focus on code readability first or just get the code working?
I spent weeks making my Python scripts neat and commented, but when I ditched that approach and just wrote messy code that ran, I learned three times faster and finished my first project last month.
2 comments
Log in to join the discussion
Log In2 Comments
allen.ruby13d ago
Have you ever tried to fix a bug in code you wrote last week that already looked neat and clean? I think that's the real issue here. Starting with messy code might feel faster at first, but it creates a lot of problems down the road. You end up wasting time trying to figure out what your own code does, which defeats the purpose of moving fast. Focus on readability from the start, because it forces you to think clearly and write simpler solutions. A messy codebase that works now will break later, and you will have no idea where to even start fixing it.
1
christopher6713d ago
Last week I spent 45 minutes trying to figure out why a function was returning nil. Turns out I'd named a variable `data` inside a loop and it was stepping on the outer `data` from the API call. Took me forever because the code looked clean but had that one stupid trap buried in it. So yeah @allen.ruby you're totally right. Nothing like hunting your own ghost for an hour to remind you that "fast" code is just slow code in disguise.
9