Students introduced to programming using a design-based approach and a functional programming language become familiar with first-class functions. They rarely, however, connect first-class functions to objects and object-oriented program design. This is a missed opportunity because students inevitably go on to courses using an object-oriented programming language. This article describes how students are introduced to objects within the setting of a design-based introduction to programming that uses a functional language. The methodology exposes students to interfaces, classes, objects, and polymorphic dispatch. Initial student feedback suggests that students benefit from the approach.
翻译:学生采用基于设计的方法和功能性编程语言参与编程,熟悉一流功能,但很少将一流功能与对象和面向目标的方案设计联系起来,这是一次错失的机会,因为学生不可避免地会继续学习使用以目标为导向的编程语言的课程,这一条描述了学生如何在以设计为基础、采用一种功能性语言的编程中介绍对象。这种方法使学生接触、班级、对象和多形态发送。学生的初步反馈表明,学生从这种方法中受益。