Anyone know a list of design pattern only applicable to static typing language but not dynamic typing language?
E.g. strategy
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
There are two aspects to a design pattern: a partitioning of responsibilities in order to improve program structure, enable flexibility and ease maintenance. And a language-specific set of constructs to implement that pattern. In some cases we are supplementing the language’s natural capabilities with cunning design.
Strategy pattern is described here as
Now this design goal of decoupling clients from the specifics of implementation is surely applicable in dynamic languages as well as static languages.
The details vary because Static languages lead us to declare explicit Interfaces and code the clients to use interfaces while dynamic languages can use “Duck Typing” but coding to deal with receiving lions where ducks were expected. (animal->eat() … no no! not eat me!)
I’m expecting to see examples of most design patterns in dynamic code possibly represented rather differently – the same separations of concerns are still important.