As a developer, we like to write code, but it's amazing how much code we actually end up reading. It's an essential way to improve web development skills.
We've heard it before and seen various stats: day-to-day we spend more time reading code than writing it. This was always a fun-fact that I’d see and just nod my head at until I attended a talk by Joe Morgan (@joesmorgan). Joe likes things that are difficult. He took on ES6 by diving into complex real world code instead of oversimplified code snippets.
Using his background in philosophy and literature, Joe shared how he grows as a developer by reading others code critically. As developers, we are all authors, so as with literature, we need to find other developers we like and read them often.
Start Following Your Favorite Authors
Reading other developers is easy today. Authors like Scott Hanselman and Steve Smith are extremely active on their social media and blogs. They provide easy to follow and great material to check-in on during breaks. Be sure to bookmark a few for a later dive. Reading these materials provides us as developers with insight into the patterns they use and the decisions they make. Good authors will convey the why in a manner that connects with you. I find myself coming back to Steve Smith's Unit Test Naming Convention when starting new projects.
At Aztek, many of us shared a common favorite author, Jimmy Bogard (@jbogard). We've had tremendous success implementing his feature-oriented configuration and moving away from layers. We could only understand and execute when we dove into his sample project. We were able to take it a step further and created some files and project templates to build a starter kit for creating these style of applications.
Read Critically & Ask Questions
We need to challenge ourselves to grow, and critically reading code can be a tremendous form of learning. Often blogs will just include simple scenarios or pseudo code to get you familiar, but this isn't the whole story and no one's applications are that easy. The open-source, open-sharing community around us is a phenomenal thing, but it's our own responsibility to use it, not copy from it.
When we read complex code critically we can learn a wide range of things. We can see what methods, functions, data structures, and patterns the author tends to use. We are able to identify trends. Those are the ones we should use in our work to see the benefit. Inversely, we can see what isn't used and save ourselves from trying to shoehorn into something that is new and shiny.
In reading code, we can also pick up on the author's style. We can get awareness on how code is formatted and how it's called. GitHub is a great place to set some time aside to dig in, just make sure you are digging in and not just glancing over. You are only going to learn if you question what is going on and why.
Guide Your Own Learning
Gone are the days of solely relying on your architect/lead to be the one to guide your learning. We all have the means to find, follow and read code from some truly knowledgeable, talented and respected developers.
And if you are someone who works with developers, encourage them to find their own favorite authors and dedicate time to critically reading code every day.
Any authors you recommend? Let us know on Twitter @aztekweb.