Its a little bit embarrassing to admit, but if you were to ask me what my favourite guitar solo of all time was, I’d probably opt for the two solos in the Carpenters’ 1972 hit Goodbye To Love. Certainly it was one of the ones I most wanted to master as a teenager learning the guitar.
So I set about seeing if I could transcribe it. I listened again and again and although I worked out most of the notes, there were two phrases in the solo that I simply couldn’t figure out. Whatever notes Tony Peluso was playing, didn’t seem to exist on my guitar.
Fast forward 20 years, and I stumbled across this video on youtube of someone playing along with the solo with a close-up of the fretboard. Suddenly everything fell into place. The mysterious techniques that eluded me all these years turned out to be relatively simple, and within the hour I was finally living my childhood dream and playing the solo the way it was meant to be played.
Now what’s this got to do with programming…? Well, one of the best ways to learn how to do something is to watch someone else doing it.
And the great news is, that just like musicians can type in the name of almost any song to YouTube and find a tutorial on how to play it, programmers have an unprecedented opportunity to be nosey and find out exactly what tricks and techniques our fellow developers are using to produce their own coding works of art.
In fact, I think if you want to improve as a programmer you should actively seek opportunities to read other people’s code and explore how their programs work.
Now admittedly when you do this, sometimes what you discover will barely make any sense to you at all, and other times what you discover will be disillusioning – it’s all just a horrible hack! But it’s worth doing it for those times that you pick up a real gem of an idea that stays with you for the rest of your career and finds its way into all your programs.
But how can you be nosey and find out what magical techniques your fellow programmers know about that you don’t? Well, there’s loads of ways.
Second, inspect the network traffic. Browser developer tools can help you out here too, as can tools like Fiddler and Wireshark. For example, I’ve had to learn how to secure web APIs with OAuth in the last year, and one of the things that helped the most was actually looking at the HTTP traffic and seeing for myself how the bearer tokens were being passed in the web requests.
Third, open source is a treasure trove of fresh ideas. Often if you are learning a new technology you can find a simple project that shows it being used in a real world scenario. For example, Shawn Wildermuth recently open sourced his new blog written in ASP.NET Core RC1.
Fourth, if you work with others, volunteer to code review. The benefits of code reviewing are well known in terms of finding bugs, but an important side benefit is that they expose the reviewer to new programming techniques or patterns they might not be familiar with.
And finally, of course, the thing I love most about Pluralsight courses and other similar software training video resources is that you get to see the code. I’ll quite often have Visual Studio open while I watch a course and pause the video so I can try it myself. Pretty much the same thing as I do when I’m learning to play a guitar solo from YouTube.
So why not decide to be a bit more nosey? Whose code have you learned the most from? Let me know in the comments.