I just finished re-reading The Passionate Programmer, by Chad Fowler. I posted about this book, the first time I read it back in September of 2009. One of the topics I focused on this time was the idea of practicing your art.
Programming is a lot like painting and music. While there is arguably more science to programming, there is a strong art component to it as well. You can look at two pieces of code that do the same thing, but chances are you will better appreciate the one that is more aesthetically pleasing, easier to understand, and as a result easier to maintain. Writing maintainable code takes experience and structure. Often times, when you look at a piece of ugly code, it was ugly because the developer was learning something new. Essentially, they were practicing on the job. Like in music, practice isn’t meant to always be beautiful, but a performance is. As developers, we should look at the time we spend at work as performance, not practice. We get paid to perform, as scientist and artist. Practicing is something great developers do on their own time. This may be learning a new language to broaden our understanding of the technologies available (adding more tools to our toolbox) or learning a new framework or portion of the language we already work in. Maybe it means learning how to better automate our workflow and builds, so we don’t spend so much time doing the same task over and over. Whatever it is we want to learn, thinking of ourselves as artist and practicing our skills away from the day job is critical to developing as a great programmer.
In keeping with the idea of programming as art, thinking about practicing as an art can help us to better apply learning to technology. As a musician, sitting down behind your instrument with no plan is a waste of time. You end up playing a few scales or some beats on the kit, maybe playing along with your favorite song, and walk away at the end of your session no better than you were when you sat down. While your skills didn’t atrophy, you didn’t really learn anything either. It wasn’t time well spent. I’m certainly guilty of this both behind the keyboard and behind the drums. It is said that it takes about 10 years and/or 10,000 hours of deliberate practice to become an expert at something. So how do you practice deliberately?
* Determine your goals. Maybe it is reading a specific book, or working on a learning a new framework. Set your goals before you sit down at the computer. Determine the minimum amount of time you want to spend practicing and don’t let yourself get sidetracked until you have at least that amount of time in. Not setting goals is a sure way of walking away from the keyboard with nothing accomplished.
* Realize that deliberate practice is often slow and error prone. While learning something new, give yourself the freedom to make mistakes and go slow. Don’t move ahead if you don’t understand what you working on and why the code you are writing works. This is really common when working from a programming book. It is too easy to copy and paste code samples and push through the material too quickly. If you don’t understand what you are working on, how do you expect to be able to efficiently use it in the future.
*Stay focused. Don’t turn on the TV. If you can, avoid interruptions like children and email. Leave your phone in another room so you aren’t tempted to check the latest Facebook post.
* Write down your achievements and insights. You learn by doing and in the process often have insights that can help you in your job. Write them down. Don’t trust yourself to remember everything the next day, especially since it will be unlikely you will have the chance to implement your ideas right away.
* Look for ways to continue practicing the skills you learned. If learning a technology that is different than you use at work, find a small program you want to write for yourself, whether you will use that program or not. The act of doing is far more educational than the act of observing (reading for instance). If you really enjoy the technology you are learning, look for an open source project you can contribute to. There has never been a time when it was easier to find and participate in new technology. This is also a great way to find a person or group who can help mentor you. Don’t have a project but you want to try solving specific problems with the language you are learning? Check out Project Euler or the Ubuntu Programming Forums for specific challenges. There are many sites like this that can give you ideas of short programs you can write to depend your understanding of the language.