r/learnjava • u/doggoistlife • Sep 25 '20
How and where do I learn design patterns?
I know what design patterns are (kinda) but what design patterns am I supposed to learn? I think there are a lot of them? Are they language specific? Industry specific? Paradigm specific I guess? Should I just learn them all? What are the most important ones and where can I learn them(book, website, anything)?
9
3
u/ryuzaki49 Sep 25 '20
Hey man, I'm also struggling with that, and I've been a poorly optimzed Java dev for more than 5 years.
This week I failed an interview that asked precisely that. They gave me an awful code and asked me to fix it. One of the questions was "what design pattern could help me clean the code" And I did not know what to answer.
So, my plan for the next weeks will be to read about design patterns, and try to write a small software with that pattern. Probably not all of them, but at least two or three of each pattern type.
I don't know if that's helpful, but I think it's way better than doing nothing.
2
2
u/Farpafraf Sep 26 '20
what pattern were u supposed to use just out of curiosity?
1
u/ryuzaki49 Sep 26 '20
The exercise was to fix a dummy base code with specific bugs.
The last question relevant to that exercise was if any pattern came to my mind that would help to make a clenaer code, or at least more maintainable.
I failed to give specifics.
Prior to that, they asked me a pattern that relied in abstraction. I had no answer. Then asked me to describe a situation where I had to use abstract classes. I answered and the interviewer said "That sounds like 'Template method pattern'"
Therefore, I need to get better at design patterns. I dont want to fail at those questions again in another interview
5
4
2
1
0
u/lamlonghau Sep 25 '20
You can read here. tutorialspoint.com
12
0
Sep 25 '20
[deleted]
1
u/doggoistlife Sep 25 '20
I would love to and this is very nice of you but I am kinda busy so I prefer self studying from books and web sites when I have the time. What a nice idea to do though
2
1
1
u/Prestigious-Shock-81 Sep 25 '20
I am interested in listening only. Maybe not all meetups but some of them.
Can I join ?
1
1
43
u/MyNameIsRichardCS54 Sep 25 '20
When you get right down to it, design patterns are just a way of giving a name to commonly used techniques. The interesting bit is what the techniques are, how and why they're used, and when they're not.
A good introduction can be found in Head First Design Patterns and then follow it up with Agile Software Development Principles, Patterns, and Practices by Robert Martin. While you're at it, do yourself a favour and grab a copy of The Clean Coder: A Code of Conduct for Professional Programmers also by Robert Martin.