r/learnjava • • 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)?

60 Upvotes

25 comments sorted by

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.

5

u/doggoistlife Sep 25 '20

Thanks a lot. Can't wait to read

6

u/Prestigious-Shock-81 Sep 25 '20

Head First Design Pattern is getting a new fresh edition release this December 2020

9

u/[deleted] Sep 25 '20

https://refactoring.guru

All the famous design patterns in different languages.

1

u/[deleted] Sep 25 '20

Nice one!

0

u/doggoistlife Sep 25 '20

Thanks a lot

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

u/doggoistlife Sep 26 '20

Damn that's rough. Good luck

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

u/Turing85 Sep 25 '20 edited Sep 25 '20

And there is, of course, the GoF-Book.

4

u/desrtfx Sep 25 '20

2

u/samketa Sep 25 '20

Design Patterns by Gamma, Helm, Johnson, Vissides is what you are looking for.

1

u/SNIKROCKZ Sep 26 '20

I would like to join u guys

0

u/lamlonghau Sep 25 '20

You can read here. tutorialspoint.com

12

u/samketa Sep 25 '20

That's a sh!t resource.

1

u/lamlonghau Sep 27 '20

Any others suggestions

1

u/samketa Sep 27 '20

Check my main comment in this thread.

0

u/[deleted] 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

u/gatosnegroscorriendo Sep 25 '20

I'd like to join

1

u/cyanogen1912 Sep 25 '20

Hey, i want to participate. Can i join you guys?

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

u/izzymaque Sep 26 '20

This would be really cool to join. Let me know if possible

1

u/ksairam94 Sep 26 '20

I'd like to join. My mail id is [email protected].