Design patterns with real time example

Viewed 30406

I want to learn Design patterns with real time example. So can any one suggest where I can start.

4 Answers

Now here is an answer which would attract a lot of downvotes. But I'll tell it any way.

My suggestion is, "Don't learn design patterns!!!"

By sticking into design patterns, you restrict your creativity. Also, some design patterns have bad sides, which they don't tell you. For example, the Singleton pattern can cause issues if not used with care.

Also, IMO, some famous design patterns were created with one language in mind, to solve a particular issue with that language. However, evolved languages like Python and Javascript can be used pretty amazingly without sticking into design patterns.

Instead of learning design patterns, learn programming paradigms, and the internal concepts. I'll copy paste the following list from Wikipedia,

  • imperative which allows side effects,
  • functional which disallows side effects,
  • declarative which does not state the order in which operations execute,
  • object-oriented which groups code together with the state the code modifies,
  • procedural which groups code into functions,
  • logic which has a particular style of execution model coupled to a particular style of syntax and grammar, and
  • symbolic programming which has a particular style of syntax and grammar

Of course you can read through the standards design patterns to get some basic idea. But don't learn them from A to Z. It can destroy your creativity.

Related