Know Your Source

Back in 2012, before front-end framework dominance, jQuery ruled the world and I was reading “Secrets of the JavaScript Ninja” by John Resig, the creator of jQuery.

This book teaches you how to create your own jQuery from scratch, giving you a unique insight into the thought processes behind the creation of this library. Although jQuery has faded into the background over the past years, I highly recommend reading this book.

What struck me the most about the book, was the constant feeling that I could have thought of this myself. The steps as described were so logical and straightforward that I really got the feeling that I could have built jQuery if I had set myself to it.

Of course, in reality, I would never be able to do that — I would consider it to be far too complicated. I would believe my solutions to be too simple and naive to work and I would just give up. I would just take jQuery for granted and trust it to work. After that I would probably not take the time to figure out how it works. I would just use it as a black box.

But reading this book changed me. I started reading source code and found out that many implementations of solutions were pretty straightforward, even obvious.

Now, coming up with these solutions yourself is of course an entirely different thing. But reading source code and reimplementing existing solutions yourself is exactly what helps you come up with your own.

The inspiration you get and patterns you discover will change you as a developer. You will find that this great library you use and think of as magic is really not magical, but just a simple and smart solution.

You may take time understanding code, step by step, but it will also make you go through the same small, incremental steps the authors took to create it. This gives you more insight into the process of coding and more confidence to code your own solutions.

When I started using JavaScript Promises I thought they were magic. Then I learned they’re just based on callbacks and my vision of programming was changed forever.

This pattern that was meant to get rid of callbacks was implemented using… callbacks?

This changed me. It made me realize that these are not incredibly complex pieces of code that were far too complicated for me to understand. They are patterns that I could easily understand if I had the curiosity and will to dive into them.

That’s how you really learn how to program. That’s how you become a better developer.