Search code examples
design-patternssmalltalk

Design Patterns in Smalltalk


It is often said that design patterns are mostly used in statically typed languages like C++ and Java, which I also agree. But in this article Robert Martin wrote

What a strange thing to say. Smalltalk, a dynamic language, played a significant role.

Since I don't have experience in Smalltalk I would like to ask if patterns like Strategy or Visitor are much used in Smalltalk? I don't think you need them in a "dynamic language"


Solution

  • The Visitor pattern (as well as many others) is broadly used in Smalltalk. For instance the parsing and compilation of Smalltalk methods uses visitors. Code coloring and formatting are also typical examples. There are many other cases and the reason I mention these is because method compilation happens dynamically inside the development environment (for instance, the compiler is able to modify itself while running and acquire the changes immediately).