4 ms·
Simple Programs to Learn JavaScript Design Patterns
- adpirz 10y agoDoes this exist for other programming languages (personally looking for Python and Java)? I love this cheat-sheet style reference.
- deaddodo 10y agoThe problem is that few design patterns are designed to be platform agnostic. They're designed to solve problems or leverage features from a specific language/language-set. Agnostic patterns tend to be heavily abstract and require specific implementation to be idiomatic. Ask a Rust developer about implementing a Factory pattern in Rust and they'll look at you like "Why?". You can even see this in his examples, per the Command Pattern: //Remarks: Taken from feedback on Reddit. //The only reason to have the Command Pattern is if your language doesn't have functions/lambdas as a first-class construct. //A Command object is a poor-mans function. //This is/was true of Java (depending on which version you're running), //but is not true of Javascript, making the Command Pattern in Javascript completely pointless. That all being said, you can find a good set of design patterns in Python here: https://github.com/faif/python-patterns https://github.com/faif/python-patterns Java's design is hugely influenced by the Gang of Four book: https://en.wikipedia.org/wiki/Design_Patterns https://en.wikipedia.org/wiki/Design_Patterns and so any of those will apply.
- Hilloh 10y agoHere are design patterns for Java: https://github.com/iluwatar/java-design-patterns https://github.com/iluwatar/java-design-patterns