This is the story of how I learned how to code. In short, how I learned was by (no lie) reading through the entire source code of jQuery. I did this about 10 years ago.
10 years ago, I was starting my career of being a professional graphic designer. By professional, I mean that I got paid to do computer graphics stuff - not that I was spectacularly amazing at it (at the time anyway). Growing up, I wasn't like the many developers you hear about these days. You know, the ones that coded their first program when they were 5 years old on the shared family computer in the living room. Nope. I was a kid who loved to doodle and dreamed to one day work for The Walt Disney company as an animator - perhaps on the next Lion King, Aladdin, or Mulan.
During my early design days... I distinctly remember the feeling of handing off my work for a developer to build. It's this interesting and unique feeling of powerlessness. Afterwards, we'd have the usual back and forth between Designer and Developer. And in the end, it wasn't ever really build quite right.
(In hindsight, there were many things I could have done to improve the communication aspect of these exchanges that were independent to the craft of visual design.)
Code was something that I didn't really "get" - regardless of how hard I tried. It was like for years. That is, until the day I discovered jQuery. jQuery took something dauntingly complex and inaccessible and somehow made it I approachable for me. With it, I could actually make things, interesting things, beyond the bare bone basics of HTML and CSS. jQuery made me feel powerful. It was a computer language that I, as a designer who was terrified of code and command lines, could actually understand. It wasn't before long that I was able to make the typical things that people did with jQuery back in the day - scroll triggered interactions, image sliders and carousels, lightbox models, etc...
I tried books. I tried tutorials. I tried (free) online courses. But none of those stuck with me. The basics of if/else conditions and for loops made my eyes glaze. To be fair, structured learning like this always did - regardless of the topic.
The next step was, as a (massive) challenge for myself, I wanted to see if I could rebuild jQuery from-scratch. Not only that... I wanted to make it better - specifically with some performance things and adding some nicities to it's APIs. And I did! It was this 2000+ line library I created called Zest. I made a custom logo for it any everything. I was so proud of it and I was excited to share it to the world. I naively thought, "Who knows, maybe it could be the next jQuery!". Spoiler alert... It didn't. No one used it. And that was okay with me! I was and am still immensely proud of that project.
It has been a decade since I deconstructed jQuery. And I can say that, without a doubt, it was the most transformative and important decision and event in my web design x development career. I was not only able to understand the fundamentals and patterns of programming, but in deconstructing jQuery, I was also able to better understand why code was written the way it was, and how you could make code understandable and therefore accessible to other people. The art and science of simplification is something that I've carried with me for my entire career, and still continue to work on.
As I progressed through my career, I transitioned to from doing purely UX/Design work to doing progressively more front-end things. And just like jQuery, I repeated this process of studying source code for Backbone/Underscores to better understand how front-end MVC (model/view/controller) worked. I studied the source code of various jQuery libraries like Masonry, Isotope, and basically a lot of things by David Desandro to understand how complex interactions and performance considerations worked. I studied Foundations then Bootstrap to better understand how to put together CSS frameworks that could power a great many websites and applications. I studied React (and Preact) to better understand how more modern declarative UI programming worked. And most recently, as it relates to my Design System/component library work, I studied the many open source component libraries from Shopify's Polaris to the widely renowned Chakra to understand UI component construction and adaptation to accommodate real-world business needs and real-world several year-old codebases.
It's worth nothing that what works for me may not work for you. In fact, I'd say for most folks, my preferred style of learning is probably the most challenging, unwieldy, and difficult way to learn something. It is literally diving into the deep end of a pool with limited knowledge of how to swim and just... figuring it out by watching how others swim as you flail around.
Anyhow. That is the story of how I learned how to code. Unconventional. Just like many other things I do I suppose.