arXivDaily arXiv每日学术速递 周一至周五更新
arXiv 1905.13674cs.PLcs.SE
收藏

面向对象设计模式与程序设计语言的相互作用

On the Interaction of Object-Oriented Design Patterns and Programming Languages

Gerald Baumgartner, Konstantin Läufer, Vincent F. Russo

摘要:

设计模式是从许多真实的系统中提炼出来的,用于对常见的编程实践进行分类。然而,由于缺乏支持程序设计语言的构造或机制,一些面向对象的设计模式被扭曲或过于复杂。在本文中,我们分析了几个已发布的设计模式,以寻找解决实现语言约束的惯用方法。从这个分析,我们奠定了基础的通用语言的结构和机制,如果提供了一个静态类型的,面向对象的语言,将更好地支持设计模式的实现,并传递,有利于建设许多真正的系统。特别是,我们的语言结构目录包括与继承分离的子类型,独立于类的词法作用域闭包对象,以及多方法分派。所提出的构造和机制并不是全新的,而是从各种语言和程序设计语言研究中采用的,并以新的正交方式组合。我们认为,通过描述设计模式的建议的结构和机制,模式描述变得更简单,因此,访问到更多的语言社区。特定语言中缺少的结构和机制可以使用聚合习惯用法来实现。

英文摘要:

Design patterns are distilled from many real systems to catalog common programming practice. However, some object-oriented design patterns are distorted or overly complicated because of the lack of supporting programming language constructs or mechanisms. For this paper, we have analyzed several published design patterns looking for idiomatic ways of working around constraints of the implementation language. From this analysis, we lay a groundwork of general-purpose language constructs and mechanisms that, if provided by a statically typed, object-oriented language, would better support the implementation of design patterns and, transitively, benefit the construction of many real systems. In particular, our catalog of language constructs includes subtyping separate from inheritance, lexically scoped closure objects independent of classes, and multimethod dispatch. The proposed constructs and mechanisms are not radically new, but rather are adopted from a variety of languages and programming language research and combined in a new, orthogonal manner. We argue that by describing design patterns in terms of the proposed constructs and mechanisms, pattern descriptions become simpler and, therefore, accessible to a larger number of language communities. Constructs and mechanisms lacking in a particular language can be implemented using paradigmatic idioms.

机构、总结、中文摘要均由AI分析而来,可能存在错误,请以论文正文为准。

↑