Chugging along with my coding practice. A few observations:
It is amazingly rewarding to tackle something hard (like identifying prime numbers) and figuring it out, even when you need a little help towards the end. This is such a different approach than giving up after trying for 5 or 10 minutes. When you put in a solid hour or more of thinking through a problem, rethinking it, trying something, having it not work, trying again, getting closer, and then going to bed, waking up and trying again the next day? You remember exactly how to solve that problem when you see it again, as well as variations thereof.
Sitting down to "code for a few minutes just to keep the streak going" invariably leads to at least an hour of wrestling with whatever you're working on. You get sucked in and want to see what happens when you try a new idea that just popped into your head. It's really cool. It takes a while to warm up for sure, but again, so rewarding.
Today I tackled a gnarly little challenge to sum all prime numbers up to a given number. I wanted to use higher-order functions, because I knew it would be much more elegant and performant. But figuring out what was a prime number stumped me. So I broke it out into two pieces. First I got the higher-order functions working with a check for even-ness (something I know how to do cold) and then once I got that working I tackled the prime number checker.
I recently read that noob developers tend to sit and stare at a blank screen when a problem stumps them. Conversely, competent developers are either writing out pseudocode or talking through the problem and their ideas for how to approach it. I'm doing my best to develop that habit and I get lots of practice since I'm stumped pretty much every time I sit down to code :-)
No comments:
Post a Comment