Teaching Computer Studies

By

Geoffrey Kavanagh

©1999-2008

No part of this document may be copied without permission of the author.

Contents

Teaching Programming Guidelines1

Teaching Programming2

The concept of a program3

Types of programs4

Programs that are used by people4

Programming languages4

Application programs4

Programs that are used by computers5

Operating systems5

Compilers5

BIOS5

The teaching sequence of Programming and Applications6

Teaching about Applications Programs7

The Evolution of Word Processors8

Word processors9

Spreadsheets11

Databases14

Basic application software concepts16

Types of programming languages17

Modular programs18

General modules for programs19

General objectives in teaching a high level language20

Good programming practices21

Topics in Computer Science23

Program Layout25

Sample layouts26

Output statements27

Calculations29

Formatting of output31

Data types32

Values and variables33

Declaration of variables35

Assignment Statements36

Tracing Variables38

Input commands39

Errors in programs41

General Advice to students on debugging43

Algorithms and Pseudo code44

Loops46

Counted Loops46

Conditional statements50

Programming in PASCAL - Lesson materials54

Calculations in PASCAL55

TURBO PASCAL (V 6.0) menu and command interface56

Format (style) of PASCAL programs57

Rules for identifiers in PASCAL58

Clearing the screen of the output from previous programs59

Output Statements In PASCAL60

Calculations In PASCAL63

Formatting Output65

Formatting Values – numbers with decimal points (REALS)67

Formatting Strings and Values67

Comment Statements68

VARIABLES69

VARIABLE DECLARATION70

PLACING INFORMATION IN MEMORY71

Tracing Values in a program72

LOOPS78

Arrays in Pascal88

Textfiles in Turbo Pascal97

ALGORITHMS104

Programming Algorithms105

Common Algorithms for senior programming courses111

Other Computer Studies Topics (work sheets, assignments and exams)124

Binary Number Exercises125

Binary Arithmetic126

Hexadecimal Numbers127

Binary Number Test128

Computer Careers131

Ergonomics136

Boolean Logic Problems154

The History of Computers156

Computer and Information Science, Final Project/Presentation159

History of Computers - Some important people and events163

The R S FLIP-FLOP168

A discussion of items of concern to the students of EDU 1040Y170

Teaching - General171

Teaching - Computer Science178

Other reference materials181

Teaching Computer Studies - Guidelines by G. Kavanagh © 1999 – 2008 1

Teaching Programming:

Guidelines

Teaching Programming

A major challenge of teaching programming is in bringing students to the realization that they are creating programs in such a way that others can use them easily.

There are two reasons for this: the first being that many of students are unfamiliar with programming as a discipline and second, most students are not used to the idea of putting themselves in the roles of creator and consumer. The idea that there are potential consumers for programs that are created by the students must be stressed throughout the subject of programming.

Additionally, students may not be fully aware of the different classes of software that are used in the operation of a computer. Because of this, when starting the teaching of programming it is important not only to stress what a program is, but also that there are different types of programs.

This information should be presented after a discussion of the main (or theoretical) parts of the computer. Students should be aware of the structure of the computer as being composed of: INPUT, Processing Unit, Memory, and OUTPUT.

The Concept of a “program”

At the beginning of this unit, establish a connection between everyday processes that are familiar to the student and the notion of a “program”. These processes should not be computer related in order to facilitate the internalization of this information. The idea is to build a link between the idea of a program and past experiences of the students.

A “program” can be explained as “any set of instructions to perform an ordered series of actions”.

Examples of these sets of instructions (“programs”) can then be elicited from the class.

Examples of “programs”:

-a recipe

-a dress pattern

-directions on how to get somewhere

Similarly, the idea of software can be linked to non-computer related examples from the lives of the students. Software can be defined as “a program (or programs) that has been recorded so that the information does not have to be entered by hand (manually)”. This recorded information requires machinery in order for it to be useful – that is, for some action to be performed. Once again examples of “software” can be elicited from the class.

SoftwareDevice

- a recorded videotape- a video cassette recorder

- a music C.D. or tape- a C.D. or tape player

- a telephone number- a telephone

Students should be asked to give further examples (non-computer related) that illustrate the difference between “programming” and “using software”. For example:

- entering a telephone number- using a special key or button to reach that

number

- entering instructions into a- pressing a button to have the

microwave microwave perform preset instructions

Types of programs

Programs can be divided into two general types: those used by people and, those used by computers.

Programs that are used by people:

Programming Languages – software which allows a person (a programmer) to give instructions to the computer in order to accomplish a task.

Applications – a broad class which includes everything from games to databases. These are programs designed to allow a person to accomplish specific tasks. Programmers using programming languages create these.

Operating Systems - instructions that allow the user to control and make use of the components he computer system.

- allow software to function on different hardware brands.

Programming languages

Programming languages are systems of commands that can be used to instruct the computer to perform a series of tasks.

Application Programs

These are sometimes known as “packaged” or “off the shelf”. These programs contain the necessary instructions for the computer to perform certain tasks. The user of the application enters information into the program, which then processes it in order to perform the tasks.

Application programs are designed (usually) to allow the user to do this without having to know a programming language.

Application programs are divided into the following general types:

  • Productivity Software

- Word processors, Spreadsheets, Databases

- Electronic mail, Graphics

  • Education and Reference Software
  • Entertainment Software
  • Business Software
Operating Systems

A set of routines (a set of instructions directing the performance of a specific task) that manages the operations of the computer. They allow software to function on different hardware brands.

Generally in introductory courses the emphasis in on the Productivity Software category (in particular Word processors, Spreadsheets, and Databases) of Applications.

In introductory courses that contain units on both application programs and programming a decision must be made as to which one is taught first.

Programs that are used by computers:

Operating Systems

See above.

Compilers

Programs that prepare machine language instructions from instructions written in high level languages (e.g. PASCAL, BASIC, C, Turing).

BIOS (Basic input/output system)

The BIOS translates the commands found in the software into the signals that a particular computer requires in order to carry out the commands. BIOS is stored in ROM chips installed on the motherboard by the manufacturer.

The concept of BIOS can be taught by relating it to the more common concept of driving a car. BIOS can be considered to be the controls of a car, which allow you to control the vehicle without actually having any direct contact with the parts of the vehicle such as the engine.

The information about the types of programs should be placed into the context of the previously taught information about the parts of the computer. The following points should be made (or reiterated):

-programs which are being executed are stored in the main (or primary memory)

-programs not currently being executed but which need to be available are stored in secondary memory

-some parts of the operating system remain in main memory all the time (while the computer is operating)

-operating system routines bring into main memory the routines and programs to be executed (these could be compilers or “applications”)

The teaching sequence of Programming and Applications

In many instances applications are taught prior to the introduction of programming. This has the following benefits for the students, should they not be already familiar with these concepts:

-they become familiar with an editor and menu system

-they learn the uses of basic application software

Teachers can use this section to emphasize both of the following: the role of the students as consumers (“users”) of computer programs and, the idea that these programs have been created by other people (“programmers”). The history of computer technology can be introduced in this part of the course to facilitate further discussion of how the changing needs of users have prompted changes in software and to emphasize that one does not need to be a programmer to successfully use applications.

There are two possible negative aspects of teaching applications prior to programming. The first is that some students, who are looking for an introduction to application programs and not programming, may choose to leave the introductory course after they have learned how to use these programs. Teachers of introductory courses must be careful to stress that programming is only one aspect of these courses that are designed as an overview of the subject of computers. The second problem is potentially more serious. During the teaching of spreadsheets, in particular, teachers must stress the interconnected role of variables and cells (as holders of data). These concepts become vital later when teaching programming.

Teaching programming first also allows students to become familiar with an interface. Students become aware of the effort involved in producing a well-structured program. This in turn allows them to appreciate the existence of application programs. They develop a familiarity with the types of information that are used in programs.

The major problems with teaching programming first are:

-students may become bored with the process of programming (i.e. the idea that many instructions are required to produce a useful program).

-if students are not well versed in problem solving skills they will have difficulty in producing the sequence of instructions necessary to solve a problem

Both of these are issues that need to be addressed no matter which order the topics are taught. However in this situation what may occur is that students may choose to drop the course before experiencing other aspects of the course.

Teaching About Application Programs

The eventual goal of teaching about applications is to have the students understand that all application programs allow the user to manipulate data in some fashion.

  1. Wordprocessors manipulate “words” in order to produce documents
  2. Spreadsheets manipulate numbers in order to perform calculations
  3. Data bases allow us to manipulate different types of data in sort and select from this information

In general all application programs allow the user to perform the following tasks in an easier fashion than by manual methods:

-correct information

-store information

-retrieve stored information

-modify stored information

-produce copies of information

Even though databases are usually taught as the last topic in applications, it should be pointed out to the students that this type of application is perhaps the most important one used in business. As teachers we tend to teach the other two first because they have greater utility for the students.

At this point, in order to reinforce the idea of users as consumers of software, it is useful to discuss with the students how application programs evolved starting with word processors.

In each of the following sections, suggested exercises are given for those students who are not familiar with a particular type of application. Students should be assessed prior to the start of a topic as to their familiarity with each application.

The Evolution of Word Processors

Originally word-processing programs were not developed for, or run on personal computers. These programs ran on mainframe computers or on dedicated mini-computers. These first wordprocessors, designed to work the same way as typewriters, were page oriented. Information was presented on the screen in a similar way, as it would be shown on a sheet of paper. The user had to deliberately move from one page of text to another. If new text was added to an existing page causing it to move to another page, the user had to direct the wordprocessor to repaginate.

These early wordprocessors, particularly the dedicated machines, cost as much ten times as much as a modern personal computer. If the user needed to use another application program, then another dedicated machine had to be used. The specific word-processing software used on these machines could not be exchanged for any other word-processing software. As personal computers developed, these dedicated wordprocessors became unpopular. Students can be asked at this point to discuss these developments and to list the advantages and disadvantages of personal computers and word-processing software in the context of these developments.

Historical note: the first word-processing program for personal computers was WordStar developed by Seymor Rubenstein in 1978. The first spreadsheet program for personal computers (Apple) VisiCalc was introduced in 1979. Bob Frankston and Dan Bricklin developed this software. Wayne Ratliff developed the first database software, Vulcan, in 1979. This was marketed with the assistance of George Tate in 1980 as dBase II.

For approximately a decade word-processing software was linked to the typewriter in terms of the style of the documents produced (especially typefaces). Despite this they gained a firm foothold first in the workplace and then the home.

Word Processors

To help students understand why word processors are used in the production of documents, the class should examine the following methods of creating documents:

  1. by hand
  2. using a typewriter
  3. using a word processor

with regard to the following:

  1. Corrections to documents
  2. Copying of documents
  3. Storage of documents
  4. Modification of documents

This examination should begin with a discussion of how a document is produced by hand. Students should be guided towards realizing that there are essentially two categories of activities taking place when a document is “written”. These are editing (changes that affect the content of the document) and formatting (changes that affect the appearance of the document). This would be followed by a similar examination of the production of a document using a typewriter and then a wordprocessor.

A chart can be produced allowing the students to see how these developments (i.e. typewriters and wordprocessors) assisted the production of documents.

Following this a discussion of more recent changes in word-processing software can take place:

-the proliferation of fonts

-the inclusion of both spelling and grammar checkers in wordprocessors

-the inclusion of a thesaurus

-the ability to include drawings (from inside and outside the program)

-the ability to include information from other (application) programs

-the ability to use documents produced as a web page

-the ability to direct or send these documents electronically without ever actually producing a paper (hard) copy

As part of this discussion it should be noted that these changes did not magically appear rather, that they were the products of programmers responding to the needs of users.

Students who are not familiar with word-processing should be given the opportunity to modify an existing document by both editing it and formatting it according to instructions from the teacher.

Following this, they should create a document and produce a document according to guidelines established by the teacher. This work could be an autobiography, a magazine article or a resume. The assignment should allow the student choice in terms of the content but the style (or format) should be established as part of the assignment. This particular work could lead to other assignments in other topics (Computer History, Careers, Ergonomics etc.).

Spreadsheets

Providing connections between the experience of students and the use of word-processors is relatively easy since all students have experience in writing in some form (specifically handwriting). Most students do not have experiences that can readily be drawn upon to provide the connection to spreadsheets. One of the challenges of teaching the basic concepts of spreadsheets is in providing a connection to the experiences of the students.

Most students do have experience in budgeting money to be spent on a variety of items. This is probably the best starting point for teachers in terms of teaching spreadsheets.

The following are the main spreadsheet concepts that students should understand:

-information is arranged in rows and columns

-the intersection of a row and column is known as a cell

-cells are used to hold values

-calculations are performed by using formulas (or formulae) that contain references to cells

-if values in cells that are referenced in formulas are changed, then this will automatically result in changes in the calculations based on these formulas

-labels are used to describe parts of a spreadsheet

There are two main ideas that carry over from spreadsheets into programming. The first of these is that all data can generally be divided into two types: data that is to be used in calculations and, data that is not to be used in calculations. Second that named locations (on the spreadsheet or in memory) are used to hold information. In order to use that information, we refer to the name (or address) of the location and not the specific value. This allows the information in the location to be changed without the reference to it (a formula in this case) being changed.

Prior to starting any exercises on spreadsheets, the students should review the definition of an application program and of wordprocessing software.

Following this review background information should be given as to the beginnings of the idea of spreadsheets in general. The style of the electronic spreadsheet is based on large sheets of paper containing rows and columns that were originally used to display calculations. Because of the size of these sheets of paper they were known as spreadsheets. Since students do not usually have experience in using a paper spreadsheet this experience should be provided in the classroom.

This concept of performing budget style calculations on a sheet divided into these rows and columns is an ideal starting point for students being introduced to electronic spreadsheets.

There are two main goals of the following exercise:

-to have the students become familiar with the basic concepts and terms involved with spreadsheets in general

-to have students realize some of the difficulties involved with a “pencil and paper” spreadsheet

At the start of the exercise students, using paper divided into a grid, are asked to do the following: