Hacker News new | ask | show | jobs
by bongodongobob 668 days ago
Honestly the way I learned not to use a ton of global variables was because I used so many and would forget what they'd do. But that was back in the days of Apple // BASIC so when I was introduced to C I rejoiced. People need to learn from mistakes.
1 comments

For me, I learned when I wanted all my function calls to do the same thing no matter how many times, or order, I called them.

I often wonder how much "pain" is required to really learn something. I would claim that 90% of how I write code is the result of pain, not patterns, even though they often end up being similar.