22
TIL my friend's 'simple' Python script had over 200 lines of code because he didn't know about functions.
He showed me his project, a basic number guesser, and the whole thing was just one massive block of repeated if/else statements. I told him to break it into functions and he said he 'didn't see the point' yet. How do you convince a beginner that organizing code early saves huge headaches later?
3 comments
Log in to join the discussion
Log In3 Comments
fionat5514d ago
Watch him try to fix a bug in that mess, @casey268. He'll get the point when he has to change the same thing in twenty places. The headache finds you eventually.
7
fionat5513d ago
That "learn the hard way" thing is so true, and it's everywhere. It's like refusing to label moving boxes because you'll "remember" what's inside. You always end up ripping them all open later. Code without functions is just a giant, unlabeled box of logic. The mess is already there, you just don't have to deal with it until you need to find one specific thing.
7