问题描述
不同的编程语言具有不同的特征或缺乏某些特征。设计模式是解决这些缺点的一种方法。我已经看到有关静态,面向对象语言(Java,C ++)中的设计模式的书籍和列表,还有关于Python中设计模式的视频。有兴趣在其他语言(如Forth,Icon,Lisp等)中看到一些常见的设计模式。一个简短的描述如何看起来和为什么需要一种语言会很好。可能与另一种语言的短暂比较,无需设计模式就可以解决这个问题。
设计模式有时被称为成语。在非OO语言(C,Forth,COBOL等)中,他们只是通常的做事方式。有时,它们被称为算法。每种语言(确实,每一个学科)都有设计解决方案的模式。
如果你看到了两三次,你已经看到了一个模式。如果您能描述上下文,问题,解决方案和后果,则将模式从某种模糊性提升到具体和具体的模式。
在非OO语言中,模式不经常被命名和编目。不知道为什么会这样,似乎是这样的。
different programming languages have different features or lack certain features. Design patterns are a way to work around those shortcomings. I have seen the books and lists about design patterns in static, object oriented languages (Java, C++), but also the Videos about design patterns in Python.
I'm interested in to see some common design patterns in other languages like Forth, Icon, Lisp etc. A short description how they look like and why are they needed in a language would be nice. Maybe a short comparision to another language that solves this problem without a design pattern.
Design patterns are sometimes called "idioms". In non-OO languages (C, Forth, COBOL, etc.) they're just "the usual ways of doing things". Sometimes, they're called "algorithms". Every language (indeed, every discipline) has patterns of designing solutions.
If you've seen something two or three times, you've seen a pattern. If you can describe the context, the problem, the solution and consequences, you've elevated the pattern from something vague to something concrete and specific.
In non-OO languages, the patterns aren't often named and catalogued. Don't know why this would be the case, it seems to be so.
这篇关于编程语言和设计模式的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!