Article

Functional programming patterns and their role in instruction

Authors:
To read the full-text of this research, you can request a copy directly from the author.

Abstract

Functional programming is a powerful style in which to write programs. However, students and faculty alike often have a hard time appreciating its beauty and learning to exploit its power. These difficulties arise in part because the functional style requires programmers to think at a higher level of abstraction, and in part because functional programs differ in fundamental ways from programs written in more common styles. A pattern language of functional programs can provide programmers with concrete guidance for writing functional programs and at the same time offer a deeper appreciation of functional style. Used effectively, such pattern languages will help functional programming educators reach a broader audience of faculty, students, and professionals. The result will be better programmers and better programs.

No full-text available

Request Full-text Paper PDF

To read the full-text of this research,
you can request a copy directly from the author.

... The literature reveals only few direct references to the use of algorithmic patterns in academic studies, either as a problemsolving strategy or as a teaching tool. Some researchers suggest pattern definitions, while others describe experiences or suggest methods for incorporating patterns into fundamental CS courses [1,5,17,18,28], into the teaching of OO programming [26] or functional programming [29]. Wallingford [26] and Ginat [10] describe the use of algorithmic patterns as a problem-solving tool for undergraduate CS students, aimed at developing the students' ability to combine different patterns into a new solution. ...
Article
Full-text available
The concept of patterns appears in the teaching of computer science in three main forms: algorithmic patterns, design patterns, and pedagogical patterns. A pattern is the identification of an abstract structure that can be further used in other, different contexts. This paper refers to algorithmic patterns as a tool that may be applied in computer science problem-solving processes, suggests an activity aimed at imparting algorithmic patterns to prospective computer science teachers, and presents part of an investigation of prospective teachers' understanding of algorithmic patterns. The main findings of the research support the inclusion of this topic in computer science teacher preparation programs, present the aspects of the concept for which the prospective teachers show meaningful understanding, and expose difficulties they experience when coping with patterns and composing recursion patterns. The focus is on abstract abilities demonstrated by computer science prospective teachers in the different stages of the activity.
... Therefore, those patterns have been constructed to be used as a powerful tool in programming learning activities. Although most of them are written for object-oriented programming language, few of them are written in other computer languages, such as functional or procedural languages [17] [16]. Since we were interested on procedural languages, great part of our work was dedicated to: ...
Article
Full-text available
This paper describes an interface that provides accessible cognitive components to programming learners during problem solving. We show how an Intelligent Tutoring System can keep the epistemological fidelity between its interface and its internal representation. For this purpose, we allow the student, throughout the interface, to select high level actions (cognitive knowledge components) and primitive actions mapped to elementary patterns, i.e., pieces of code commonly used by experienced programmers and educators.
Conference Paper
A discussion took place on the SIGCSE mailing list in late March of 2004 that raised important issues on how to teach introductory courses using Java. This article attempts to summarize several of the important points raised during this discussion, among them whether or how objects should be taught early or late in a CS 1 course, or indeed, whether object-oriented languages should be postponed until a second course.
Article
The present article describes the challenges programming apprentices face and identifies the elements and processes that set them apart from experienced programmers. And also explains why a conventional programming languages teaching approach fails to map the programming mental model. The purpose of this discussion is to benefit from ideas and cognitive philosophies to be embedded in programming learning tools. Cognitive components are modeled as elements to be handled by the apprentices in tutoring systems while performing a programming task. In this process a mental level solution (the mental model of the program) and an implementation level solution (the program) are created. The mapping between these representations is a path followed by the student explicitly in this approach.
Article
Developing solutions to recurring algorithmic and design problems in various contexts constitutes a fundamental part of computer science (CS) and software engineering. A main principle in software development is the transfer of solutions from previously solved problems to novel ones. The ability to abstract similarities and apply previous productive experiences to new situations relates to analogical reasoning - one of the most important problem-solving heuristics.However, some of the major difficulties that CS students encounter with algorithmic problem-solving involve poor analogical reasoning skills. This paper describes a Pattern-Oriented-Instruction (POI) approach to a computer science fundamentals course. The main principles governing the POI approach lie in defining Algorithmic Patterns - solutions to basic algorithmic problems - and in organizing course problem-solving activities around them. The POI approach is grounded in cognitive theories that deal with an individual's knowledge organization in memory. The knowledge structure is assumed to have implications with regard to problem-solving performance. The aim of our research is to explore how a course designed according to the POI approach affects students' analogical reasoning when they analyze an algorithmic problem and design a solution.
Conference Paper
Full-text available
Importing design patterns from software engineering to the computer science education (CSE) field was followed by defining patterns and pattern languages suitable for CS courses. The main goal of incorporating patterns in CSE was to enhance students' programming abilities, as well as their design and problem-solving skills. Accordingly, various instructional materials were suggested for using patterns in classroom learning activities, such as collections of patterns and related programming assignments. However, the existing pattern-based materials seem to be insufficient for implementation in the classroom, especially when teaching introductory courses that emphasize syntax and programming language features. Therefore, alternative methods using applicative models for pattern-based instruction, which emphasize problem solving and program design issues rather than specific language features and syntax, should be developed and assimilated within the CS teaching community. We believe that successful implementation of such models should be accompanied by appropriate teacher-training.In this paper we describe an initial effort to expose CS teachers to the notions of pedagogical patterns and pattern-based instruction, aimed at motivating them to meaningfully adopt and adapt patterns to their concrete pedagogical needs.
Article
We introduce "algorithmic patterns" as entities that combine design elements and mathematical aspects. We regard algorithmic patterns as operational concepts, which are repeatedly utilized in algorithmic problem solving, and enfold computational ideas with related mathematical characteristics. We illustrate their relevance with "The Sliding Delta" pattern. The pattern is defined, and then utilized in three different applications. The utilization demonstrates the relevance and effectiveness of the displayed notion of algorithmic patterns.
Article
A discussion took place on the SIGCSE mailing list in late March of 2004 that raised important issues on how to teach introductory courses using Java. This article attempts to summarize several of the important points raised during this discussion, among them whether or how objects should be taught early or late in a CS 1 course, or indeed, whether object-oriented languages should be postponed until a second course.
Article
Full-text available
Design patterns inspired by functional programming concepts can advance object-oriented design. This thesis promotes the idea that concepts from the world of functional programming can be captured with design pattern descriptions. These can then be used to benefit from functional programming concepts with ordinary object-oriented languages. The functional patterns are evaluated for their impact on language design and a new approach to a dual-paradigm language is presented.
Article
Full-text available
This paper outlines the recurring use of continuations. A brief overview of continuations is given. This is followed by several patterns that outline the use of continuations leading up to using continuations to implement coroutines, explicit backtracking, and multitasking. Scheme is used for the examples as it supports first class continuations.
Conference Paper
Full-text available
Designing a two-person game involves identifying the game model to compute the best moves, the user interface (the "view") to play the game, and the controller to coordinate the model and the view. A crucial task is to represent the algorithms used in their highest abstract forms. This can prove to be a difficult and subtle endeavor. It is made easier however by the use of good object-oriented (OO) design principles to help maintain a high level abstract viewpoint during the design process. The state pattern is used to represent the game board and is coupled with the visitor pattern to provide state-dependent, variant behaviors. The min-max algorithm and its variants are implemented as the strategy pattern, which allows flexible and extensible computational capability. Careful analysis is performed to properly abstract the interactions between the model and the view. The command design pattern is used to provide callback services between the model and the view. Leading students through this design process enables them to learn algorithms and architectures that easily scale to full-sized applications.
Article
Full-text available
Refactoring is about improving the design of existing code and as such it must be familiar to every programmer, software engineer and designer. Its key characteristic is the focus on structural changes, strictly separated from changes in functionality: Before changing the functionality of a software system, it is often necessary to restructure it to make it more amenable to change. After establishing a working piece of software, it is often necessary to revise its structure of names, modules, types and so forth. A common example of refactoring is the replacement of a concrete data type by an abstract data type (ADT): all direct references to the representation type must be replaced by uses of the ADT selectors and discriminators. After this refactoring, it is possible to change the implementation of the abstract data type without affecting its client code at all; refactoring thus enables system change, modifying a design to introduce information hiding as and when it becomes necessary.
Conference Paper
Most computer science curricula include design patterns during the junior/senior software development sequence. We present a simplified application of two classic design patterns that is specifically targeted at students in their first programming course. We also include suggested pedagogy on how to develop the concepts necessary to implement and appreciate the application.
Article
this paper are given in Scheme. For a brief summary of the subset of Scheme used in these examples, see the appendix "A Scheme Primer".
Article
Introduction Roundabout describes a method for writing recursive programs. Recursion is a powerful technique for writing code that follows the structure of the data it processes. By following the data's structure, recursion directly supports inductive reasoning about the program's behavior and correctness. Perhaps more importantly, it can also lead to code that is easier to write, modify, and read. This language guides the programmer through the development of recursive programs in the face of a number of common forces. Most of the ideas contained in these patterns apply to the use of recursion in any context or language. However, I have been collecting and refining these ideas while teaching functional programming in Scheme to university undergraduates. This fact may account for several features of this version of Roundabout: . a bias toward a functional style of programming, . an assumption that students are familiar with inductive data definitions and BNF notation, and
  • Erich Gamma
  • Richard Helm
  • Ralph Johnson
  • John Vlissides
Erich Gamma, Richard Helm, Ralph Johnson, and John Vlissides, Design Patterns, Addison Wesley, New York, 1995.