• Tidak ada hasil yang ditemukan

Programming Paradigms 10

Dalam dokumen Guide to Teaching Computer Science (Halaman 60-65)

33 3.6 Programming Paradigms

3.6

3

paradigm is a heuristic for solving algorithmic problems, a programming language is a means of expression for a programming paradigm.

The concept of programming paradigm is defined in different ways (see, e.g., Abelson et al. 1996; Ambler et al. 1992; Floyd 1979; Sethi 1996; Tucker and Noonan 2002; Van Roy and Haridi 2004; Watt 1990), each emphasizing different aspects of the concept. The following definition, for example, which is composed on several of the resources men- tioned above, summarizes the major points:

Programming paradigms are heuristics used for solving algorithmic problem. A program- ming paradigm analyzes a problem through specific lens, and based on this analysis, for- mulates a solution for the given problem by breaking the solution down to specific building blocks and defining the relationship among them.

We mention several major programming paradigms: procedural (imperative), object- oriented, functional, logical, and concurrent.

Many researchers emphasize the importance of both teaching the subject of program- ming paradigms to students and of exposing students to a number of programming para- digms (Carey and Shepherd 1988; Floyd 1979; Haberman and Ragonis 2010; Van Roy et al.

2003). We mention three reasons that explain the importance of learning several program- ming paradigms: the development of cognitive tools, the ability to explore the same concept in different paradigms improves learners’ understating of the said concept, and increasing learners’ flexibility in problem-solving processes of different kinds of problems.

At the same time, however, there are programming languages courses that emphasize the programming language aspect, while less attention is paid to the programming para- digm aspect. This can be explained by the fact that the concept of a programming paradigm is considered to be a soft idea (see Sect. 3.7 of this chapter), as opposed to rigid content, such as programming language syntax (Corder 1990; Turkle 1984); therefore, its teaching is not simple. For these reasons, we dedicate special attention in this Guide to the teaching of programming paradigms.

A discussion about the concept of programming paradigm in the MTCS course has several additional advantages. First, it enables the instructor of the MTCS course to dis- cuss with the students the meaning of the levels of abstraction (a central computer science concept) within a relatively familiar context, that is, the relations between programming paradigms and programming languages. Second, since in most cases, high school com- puter science curricula are partially based on programming, the students’ familiarity with the concept of programming paradigm, including the differences and connections between this concept and the concept of programming language, may increase their awareness in their future teaching to the difference between technical aspects of programming languages and conceptual computer science ideas. Such understanding may help the prospective computer science teachers teach computer science on a higher level of abstraction. Third, it may improve students’ understanding of the essence and history of the discipline of computer science. Finally, it is reasonable to assume that not all students have learned a course that focuses on the notion of programming paradigm; the MTCS course can be, therefore, an appropriate opportunity to partially close this gap.

Activities 10, 11, and 12 that explore the notion of programming paradigm are rela- tively advanced; therefore, they should be facilitated in the MTCS course only with students who have the needed background in computer science. Specifically, before the activities

35 3.6 Programming Paradigms

Activity10:ProgrammingParadigms–ExplorationofLearners’Knowledge The aim of this activity is to let the instructor of the MTCS course observe students’

level of familiarity with the concept of programming paradigm. It should be facilitated, as mentioned above, only after the instructor verifies that the students are familiar with at least two programming paradigms, or at least with two programming languages which represent two different programming paradigms.

Stage A: Worksheet, individual work

The students are asked to work individually on the worksheet presented in Table 3.2.

Stage B: Class discussion

After the students work on this worksheet individually, the instructor collects their answers and discusses them with the class; when needed, clarifications are added by the instructor. At the end of this discussion, the instructor summarizes the activity by:

Presenting a definition for the concept of programming paradigm

Presenting the differences between several programming paradigms (according to

students’ knowledge)

Highlighting the difference between a programming paradigm and a program-

ming language with several examples

Explaining that since programming languages implement programming para-

digms, different programming languages may implement the same programming paradigm; nevertheless, if one is familiar with one programming language which are facilitated, it is important to verify that the students are familiar with at least two programming paradigms; if they are not familiar with at least two programming paradigms, the instructor of the MTCS course may consider dedicating 1–2 lessons to the teaching of a programming paradigm with which the students are not familiar. Such lessons will pro- vide the instructor with an additional opportunity to discuss with the students differences between programming paradigms and to reemphasize the fact that programming languages are, in fact, an expressive mechanism for programming paradigms.

Table 3.2 Worksheet on programming paradigms Worksheet – programming paradigms Answer the following questions:

1. What is a programming language?

2. What is a programming paradigm?

3. Give examples of three programming paradigms. For each paradigm, explain why it is a programming paradigm.

4. Compare the two concepts: a programming paradigm and a programming language.

(continued)

3

Activity11:Abstract-OrientedExaminationofProgrammingParadigms

Stage A: Problem solving in different programming paradigms, work in pairs The students are asked to work in pairs on the worksheet presented in Table 3.3.

Clearly, another problem can be presented in the worksheet, for example, one of the sort algorithms.

Table 3.3 Problem solving in two programming paradigms Worksheet – problem solving in different programming paradigms Part A

Solve the following task in at least two programming paradigms. Do not implement the solution.

Given an arrangement of domino stones, determine whether or not it is a legal arrangement and return True or False accordingly.

For example, this is an illegal arrangement of Domino stones:

and this is a legal arrangement of Domino stones:

Part B

After solving the task, reflect

− What stages you went through while working on the solution in each programming paradigm? Were the stages similar? Were they different?

− For each programming paradigm, describe which of its characteristics are expressed in your solution.

− If you had to choose a programming paradigm to solve the problem, what would be your preferable paradigm? Explain your choice.

represents a specific programming paradigm, it is reasonable to assume that he or she will be able to switch to another programming language that represents the same programming paradigm

Highlighting the fact that the differences between programming paradigms are

fundamental and therefore, unlike switching between programming languages that represent the same programming paradigm, the switching between program- ming paradigms is not a trivial cognitive task.

As mentioned, this activity allows the instructor of the MTCS course to identify stu- dents’ current knowledge with respect to the notion of programming paradigms.

Based on this observation, the instructor can move on and continue the lesson with either Activity 11 or Activity 12 or both.

Activity10 (continued)

(continued)

37 3.6 Programming Paradigms

Part A requires students to think on the level of abstraction represented by the pro- gramming paradigms; that is, to think on a relatively higher level of abstraction. Part B, in which they are asked to reflect on the strategies they employed in Part A, further increases the abstraction level of students’ thinking since they are asked to discuss similarities and differences between programming paradigms.

Stage B: Class discussion

The class discussion that summarizes the activity should highlight the fact that pro- gramming paradigms provide a context in which a discussion on different levels of abstraction can take place. This idea is reflected in several ways. First, the difference between a programming paradigm and a programming language can be addressed;

second, it can be discussed how each paradigm and each programming language exhibits abstraction; finally, mechanisms that programming paradigms and program- ming languages provide us to express and create abstraction can be analyzed.

Activity12:ActivityDesignforaGivenProgrammingParadigm

Based on the above activities, in this activity the students practice the construction of tasks that are suitable to be solved by a specific programming paradigm. The impor- tance of this activity derives from the fact that the curriculum the prospective computer science teachers will teach in the future is probably based on a specific programming paradigm. Therefore, they should be aware of the fitness of the tasks that they will develop for their future pupils to the programming paradigm used by the curriculum.

Stage A: Tasks and paradigms, group work

The students are asked to work in groups, to choose two programming paradigms with which they are familiar, and for each paradigm:

Bring an example for a task that is suitable to be solved by the said paradigm.

Explain why the task is suitable to be solved by the said paradigm.

Solve the task with the said programming paradigm.

Stage B: Reviewing the groups’ work

Each group presents its tasks and explains its considerations in the design process of the tasks for each paradigm. For each presented task, the other class members are asked to express their opinion whether or not the task fulfills the requirements, that is, whether the task fits to be solved by the proposed paradigm.

For selected tasks, the instructor asks whether it can be naturally solved by another programming paradigm than the one proposed by the team which presented it. If it is, the students can be asked to explain why and to solve it in the other paradigm; if it is not – the instructor can ask what changes should be made in the question for- mulation to make it naturally solvable also by additional paradigm. The changes

(continued) Activity11 (continued)

3

suggested by the students can then be analyzed and conclusions with respect to the kind of changes can be derived.

Stage C: Class discussion

The summary should address the different considerations addressed by the groups while designing questions for different programming paradigms. It is relevant to raise the question whether similar considerations were used for all paradigms. Such a dis- cussion, once again, enables to highlight first, the different perspectives that different programming paradigms exhibit in problem solving situations and second, the variety of the levels of abstraction on which the topic of programming paradigms can be thought of.

11 Based on Hazzan (2008).

3.7

Dalam dokumen Guide to Teaching Computer Science (Halaman 60-65)