How do you become better at programming? I first read the idea of learning programming, say like you would learn to play the piano, back in the heyday of blogging platforms. The post was about a book Etudes for Programmers. At the time, used copies of the book were selling for a price outside my budget, but I was able to get it through an interlibrary loan. The idea of the book is similar to Etudes for piano, once you're past the beginner lessons you need a longer piece to really sink your teeth in.
One of the classic problems presented is the Game of Life on an infinite grid. Of course once you start on the problem you realize there is more to it. Taking a step back and researching it pointed to the Michael Abrash classic where he covers the problem. That is the way this normally happens, you start one place, possibly get stuck, then thinking through solutions or doing research you end up in a totally different place than originally anticipated. But without starting on the problem and working through them you might never noticed the blind spots and areas that could be improved.
I try to practice things that are just out of reach, unless practicing for retention. Also avoiding practice that is specific to a certain technology. Working on programs and thinking about the general rules are beneficial in the long run. It might seem frivolous at the time but when you are at work and that idea from your practice shows up on a real world problem it is a good feeling.
When you get stuck on a problem
It is super easy to just google solutions. That is a bad habit. I use a form of rubber duck debugging or the Socrates method whichever sounds less intimidating. It is a simple process, with an empty document write down questions for yourself. Then, start filling in the answers. I have used this method to help with practice programs and also when debugging production issues. For debugging, it serves an additional purpose, not only are you actively investigating the problem, you are also keeping a record of the things you have tried. This is super handy for bugs that take multiple sessions to track down.
Another thing that comes up is dealing with distractions. I'm not talking about a noisy house or your dog wanting to go outside but more of the random thoughts that pop-up. On one of my previous jobs this was an issue for me. I found that keeping a blank piece of scratch paper next to me and writing a single letter for whatever I was thinking helped.
Sources for programming practice problems
The Etudes book that I mentioned is a little dated. It is worth a read if your local library has a copy but I don't know if I'd spend money on a used copy since a lot of modern resources are available.
I really like Codewars because a number of the problems have runtime constraints. This normally rules out the naive implementations. Math is usually the thing my brain likes to send to the recycling bin when it needs more space. They have some good math problems that tend to frustrate me but usually payoff since I learn something new. It will also start to suggest harder problems as you progress.
The University of Texas has a list of High School level problems: UIL practice problems
I know they have a lot of whiteboard job interview stuff out there. When I feel like I'm studying to get a job I get some type of anxiety or mental block. Probably a personal issue. Anyway, if you are like me skip the stuff about dress codes and résumé and just work the problems given: Gayle McDowell
International Collegiate Programming Contest: ICPC
Good programmers on practice
Don't take my word for it. Great programmers talking about deliberate programming practice:
- Read this Peter Norvig Teach Yourself Programming in Ten Years
- Mike Acton
- Pat Wyatt
- Imposter Syndrome
Additional methods and resources
Other helpful methods to keep you practicing: