Live data from Hacker News

What is the best way to learn Design patterns and start applying them?

news.ycombinator.com

1–8 of 8 posts

Re: What is the best way to learn Design patterns and start applying them?

#2
not sure about "the best way", but besides the obvious cases ( factory, singleton ) i apply the Kerievsky's Refactoring To Patterns method.

    “Instead of thinking about a design that would work for every nuance of a system, 
    test-first programming enabled me to make a primitive piece of behavior work correctly 
    before evolving it to the next necessary level of sophistication.” 
    Kerievsky (2002)
https://www.amazon.com/Refactoring-Patterns-Joshua-Kerievsky...

If a piece of code survives long enough to deserve some refactoring, then i take a closer look at the patterns.

Re: What is the best way to learn Design patterns and start applying them?

#4
I've been working with design patterns for about a year, I'd say the best way for me is to actually build something with a goal in mind.

For example, if I'm trying to design a screen that has an interactive inventory list, what kind of components do I need? A search bar? What would a search bar look like? What would it look like before it's typed? What would it look like after it's typed?

Then I usually like to go to https://material.io/design/ and go look at their components for guidance

Re: What is the best way to learn Design patterns and start applying them?

#5
post #4

I've been working with design patterns for about a year, I'd say the best way for me is to actually build something with a goal in mind. For example, if I'm trying to design a screen that has an interactive inventory list, what kind of components do I need? A search bar? What would a search bar look like? What would it look like before it's typed? What would it look like after it's typed? Then I usually like to go to…

Not OP, but I think they mean in the context of software design patterns[0].

[0]: https://en.wikipedia.org/wiki/Software_design_pattern

Re: What is the best way to learn Design patterns and start applying them?

#6
post #5
post #4

I've been working with design patterns for about a year, I'd say the best way for me is to actually build something with a goal in mind. For example, if I'm trying to design a screen that has an interactive inventory list, what kind of components do I need? A search bar? What would a search bar look like? What would it look like before it's typed? What would it look like after it's typed? Then I usually like to go to…

Not OP, but I think they mean in the context of software design patterns[0]. [0]: https://en.wikipedia.org/wiki/Software_design_pattern

thanks for clarifying

Re: What is the best way to learn Design patterns and start applying them?

#7
Having switched from .NET to Ruby/Rails, I've noticed that different stacks tend to favour different design patterns, based on how much heavy-lifting the language and framework does for you.

For that reason, I'd suggest picking a set of languages/frameworks, and taking a list of the more popular design patterns on each stack. Once you've implemented these, start to cross them over. You'll not only expand your knowledge of other languages, but you'll learn where certain frameworks have developed abstractions that cover these patterns for you.

Re: What is the best way to learn Design patterns and start applying them?

#8
For me the best way to learn design patterns were: 1) Do small changes in big codebase (you can do contributions in github) 2) Get code reviewed by more experienced people

In that case you will start to realize that having some specific design patterns make not only your life but all other developer's easier.