0

Many programming languages embed design patterns right into the language. I'm looking for the most obvious examples, like Python decorators (Decorator?) or C# events (Observer). Can you give me some more?

Dmitri Nesteruk
  • 23,067
  • 22
  • 97
  • 166
  • Java core libs: check this [link](http://stackoverflow.com/questions/1673841/examples-of-gof-design-patterns-in-javas-core-libraries/2707195#2707195). – dstar55 Apr 12 '17 at 10:19
  • Related: http://stackoverflow.com/questions/4029287/design-pattern-as-missing-language-feature – ewernli Apr 20 '17 at 19:31

1 Answers1

1

I've also beein intrigued by this very question and even asked a similar quesiton once: Design pattern as (missing) language feature

Sure, there are some more patterns that simply vanish in other languages.

  • Singleton: in Scala, you can define singleton with the object keyword.
  • Factory: in Smalltalk, classes are first-class and serve de facto as factories for their instances, no need of additional boilerplate.
  • Visitor: in Clojure, you have multimethods to help with this problem.
  • etc.

Most information about this topic is annectodical. You can check the links in my question. That would be nice to have a more complete coverage of this topic, sadly I've never found one.

Community
  • 1
  • 1
ewernli
  • 38,045
  • 5
  • 92
  • 123