How to learn design patterns (and pretty much anything else)30th January 2019
At one point in my programming career, I was pretty obsessed with design patterns. I wanted to be a great “software developer,” I wanted to write “perfect code.” And I thought, if only I knew design patterns, I would be able to write perfect code right from the get go.
If you are at the point where I was, I know how you feel. You are not alone.
Let me set you free.
What you are *not* supposed to do
When I thought I needed to learn design patterns, I decided to read all the books on design patterns I could find. A lot of people were recommending the “Gang of Four” book, so I put it to the top of my list. And I would love to say that I became a design pattern ninja and lived happily ever after, but the truth is… I didn’t finish any of them.
They felt extremely boring, and I didn’t appreciate them.
Do you know why I didn’t appreciate them? Because design patterns are solutions. They are not fundamentals that you can read and immediately put to use. To appreciate a solution, you need to first suffer from its problem.
The issue was that I never suffered from the problems that those design patterns were solutions to. I thought I could learn anything by just reading, I underestimated the importance of experience.
What you are supposed to do
Get your hands dirty, and make mistakes.
That is the only solution. Write a lot of code, don’t be afraid to make mistakes, try to find solutions on your own to your own problems.
Don’t try to find solutions to problems you don’t have.
I’m not telling you to never read books. Read them, for sure you will learn new things. The good thing about books is that even if you don’t understand it all, you might be able to have an understanding of what types of problems there are.
But don’t forget to create things, don’t let not being “perfect” stop you. Believe me, reading books after you create something on your own will give you lots of “a-ha” moments, and you will be able to go back to your code and use what you learned to make your code even better.
Create problems, and believe me, solutions will be fun.
If you like this article, follow me on Twitter or sign up to my newsletter to get notified when I write new articles. I write about software and startups.
If you are looking for a Rails developer, I’m currently available for remote work. Feel free to get in touch with me at “hi at evrim dot io.”
How to learn design patterns (and pretty much anything else) was originally published in Hacker Noon on Medium, where people are continuing the conversation by highlighting and responding to this story.