TEACHING COMPUTER AND PROBLEM SOLVING
SCIENCE CONCEPTS WITH A SPREADSHEET
Mary Veronica Kolesar, Vicki FL AlIan Department of Computer Science Utah State University Logan, Utah 84322-4205 E-mail:
[email protected],
[email protected]
INTRODUCTION WHY A SPREADSHEET? Traditionally, computer science educators have introduced students to basic computer science concepts via a
The authors have collected, in several sections of CS 1 taught on campus in 1993, data reiating ievel of previous experience to success rate, defined as percent of those initially enrolkxl who complete the course with final grade of C- or better. The data, seen in Figure 1, indicate that previous computer experience in running applications programs produces a success rate (54%) much higher than the rate for students with minimal experience (22%) and very close to the success rate of students who have had previous programming experience (58%).
pro~ming language paradigm as evidenced by typical texts used in CS 1 [D083, KW87, HKF93]. The same approach is used with respect to development of problemsolving skills. This paper describes an alternative approach in which a spreadsheetAlatabase package is used as an introductory vehicle to motivate many computer science ideas. As an added benefit to this approach, the student learns to use a valuable problem-solving tool.
A DIFFERENT
FIGURE 1: Relationship of previous success in CS1.
APPROACH
experience
to
%
The authors ate developing a pmpamtoty (pre-CSl) course entitled Problem Solving, Mathematics and Computers . One of our major premises is that students can learn the concepts of computer science and programming more quickly and with leas dit%culty if they are fmt given a fm foundation, a “grounding” in problem-solving skills and computer science concepts isolated from the syntactical details of implementing solutions. This is a key to our approach. We model problem-solving methodology and employ computer-based problem-solving tools that are simple versus complex, nonprocedural versus procedural, tools which allow the students to do meaningful work and to produce impressive results without spending inordinate time on the learning of syntax.
MINIMAL
APPLICAllOW
P~
Experience
Learning the use of a spreadsheet gives students such applications experience. Danielle Bernstein points out that using software packages, one can teach such concepts as fdes, records, structures, booleans, memory, and data typex “These topics can be examined without the overhead of extensive program planning or syntax problems that can get in the way for a beginner” ~re90]. Engineers have long used spreadsheet packages as problem-solving tools Wl, Sli89, Hsi87] and their use has been a subject for experimentation in computer science [APNA90, Fre90].
As different aspects of the tools are presented, some fundamental computer science concepts surface naturally. others are easily extracted. Permission to copy wtthout fee atl or part of thts materfai is granted provided that the copies are not made or distributed for direct commercial advanta e, the ACM copyright notice and the title of the publication and Yta date appear, and notice is given that copyi is by permission of the Association of Computing Machinery. Y o copy othetwise, or to republish, requires a fee ancl/orspecific permission. SiGCSE ’95 3/95 Nashviiie, TN USA @ 1995 ACM O-89791-693-XJ9L5100CB ....S.5O
1 This work supported in part by the National Science Foundation under grant DUE-92541 86
10
David Patterson has said that “It is practicably criminai that computer science studenta have a compiete iack of exposure to programs of use outside the computer industry. ... This introspective siant has meant that developments in the use of computers have passed us by- to the detriment of both parties. Spreadsheets, which Aian Kay tailed the most important innovation in programming in 20 years, are just one example.” l?at92]. Such an approach has the added benefit of being attractive to women, because, according to Bern@4m, women, who perceive computers as tools rather than toys, are more attracted to a system in which “red work” is done quickiy cFre90].
change proves worthwhile for CS neophytes. Since a spreadsheet ceii can contain an alphanumeric Mel, a numeric vaiue or a formuk the concept of data types flows naturaiiy. The necessity of explicitly indicating strings can be shown with label entries consisting of digits. For example, entry of a phone number, 555-5555, displays -5000, unless it is fiagged as an alphanumeric. By chsnging the dispiay format of a numeric entry, the student is lead to consider how a value entered as 24.329 can be dispiayeti as an integer, 24, then again as a freed-point value of 24.33, and then in scientitlc notation. These exercises lead into a discussion of internai representation, as weii as serve ~ a basis for understanding print formats used in programming.
Therefore, we have incorporated a spreadsh@./database package as an important component in our preparatory ciass. In addition to the topics mentioned by Bcanstein, the package is a usefui “hook” on which to hang concepts including interfaces, data storage, data representation, variabl~ operators and order of precedence, functions and
Discussion of the use of formuiae presents an outstanding opportunity for introducing some important topics. It is possible to start out with constants versus variables and move on to operators, expressions and order of precedemx. Arithmetic operators are a naturai notion for most students, but, as any CS 1 instructor knows, the concept of relational and logicai operators that produce boolean remits is diff~cuit for many students. Spreadsheets are an excellent wa:y to introduce booleans.
-*m, Pointem, control structures, and designing for change. The package we use is Boriands Quattro Pro v5.0, but almost any popuiar spreadsheet should work. Since our preparatory course assumes no previous computer experience, we make a speciai effort to give students a solid understanding of how a computer works. It is our beiief that having such an understanding of the basic operations of computer components reduces students’ frustration by making it easier for them to anaiyze and resolve “computer errors”. Discussions in class and in the lab tutoriais enmurage students to examine why and how things are done.
INTRODUCING
In a spreadshee~ the boolean result true#idse is dispiayed as IN, students see results displayed just as they are for arithmetic expressions. They imme&ately recognize that evacuation of a boolean expression DOES give a nxmk Students create truth tables using logicai operators and experiment with order of preceden=, they demonstrate DeMorgan’s iaw. Such hands-on experience seems to tesult in a more soiid understanding of the tnateriai.
CS CONCEPTS
The spreadsheet capability of copying formulae with reiative ceii references makes the demonstration of iteration very simple. For example, the Fibonacci numbers can easiiy be generated itemtively: in the ftwo mws of a column (A, for example), enter the fmt two Fibonaeci numbers (both 1} in the third row, enter the fornnda to add the previous two numbers (A3 =+A1+A2); and, copy the formuia into as many cells in the column as desired. An investigation of the formuiae stored in various cells, e.g. A7=+A5+A6, points out the repetition of the same operation with different vaiues. Construction of other series, such as the series approximation of OX,ailows the student to “program” relatively complex iterative problems with iittie concern for syntax.
Before being intmduccd to the spreadsheet, students become fkmiliar with basic computer components, functions and terminology and spend some lab time becoming acquainted with DOS. The distinctions and dationships between systems and applications programs are easily shown with the introduction of the spreadsheet. Directions on loading the spreadsheet program make explicit the difference between the storage functions of RAM and the hard drive. This distinction is reinforced when the SAVE command is introduced. Studenta are able to compare and contrast a command-iine user interfitce as seen in DOS with Quattro’s more graphlcai interface incorporating windows, menus, and a mouse. The meaning of a WYSIWYG dispiay is easily demonstrated, as is the concept of a HELP faciiity. While the anaiogy betuen a spreadsheet cell and a variable is obvious to someone with programming experience, the explicit demonstration of a named location whose contents can
Another computer science topic easily introduced via the spmwisheet is data structures. Files are presented through iab activities in which students utilize both input and output data fdes. The difference between an ASCII file and a bhuiry fde is easiiy demonstrated by using the DOS type command to dispiay various files. It’s not hard to convince
11
students meetinstudy groups todiscussdata analysis and to&vise strat@eafor ana@zingthe dam.Stu dentsmceivea copy of the assignment along with a study guide that includes discussion questions that attempt to motivate critical thhking.
students thatthere ISadifference astheywatch aQuattro Pro spreadsheet file being displayed by DOS! ‘he concept of a record is basii to the use of a spreadsheet that incorporates built-in database functions. With some encouragemen~ students begin to ponder how the information in a record (or in the entire worksheet) might be stored. While the actual technique used is unimportan~ consideration of the problem extends a prime opportunity to motivate the concept of lists, arrays, pointers and linked lists. Experimentation with sorting capabilities allows the instructor to pique interest in sorting algorithms. Further consideration of the spmadaheet’s capability to sort on any column can be used to introduce the need for different algorithms to accomplish the same basic task: in an application that allows sorting on many different keys, does it make sense to actually rearrange the data in memory every time or would it be more efficient to use pointers to “sort”? An obvious concept suggested in spreadsheets is subpgmm. The built-in functkms are a perfect vehicle for d-ussing modules and pammeter~ it is natural to the student that one must specify what is to be summed when asking for a SUM An introduction to macros serves as a powerful, hands-on illustration of the value of creating reusable procdmx. Use of the IF function allows us to examine the selection control structure. IntmxIuction of functions also can be utilized to expand on Stu&nts’ Un&rsm@ “ Ofdatatypes toinclu&both the data AND the operations that can be performed on those data. Having previously made the analogy between cells and variables, we can discuss the operations that can be
For example, differences between numeric and categorical data are explained and students use that information to detemdnethe types ofanalysis thatcanbedone onvarious fields in the workaket. ‘l%e study guide raises questions concerning the handling of missing data and students are asked to devise three methods of determining how the spreadsheet handles missing data... with the proviso that asking someone else is NOT an option! Students are given access to material from the Quattro Pro manual and must reference it (with help and examples) to determine how to use the databme DCOUNT fimction to count the number of mrdes/femaks, for example. This exemise gives them pmcticrd experience with user documentation and can be cited when the topic of documentation is addmwed later in the qmuter. Questions such as the following encourage students to extend their problem solving beyond just “what is given”: What kind of i@rmadon could be obm”ned #CS160 grade What kid of for the quarter were included in the &a? relationships could you investigate? Is there any jhture U@dness to these &ala? Spec@cally, what other data could be collected (now or at some future date) to allow further meaningfid analysis? (A text copy of the full assignmeau ss.asn.tx~ can be OMained via anonymous ftp fiwn Slow.cs.usu.edu, /@llb/@e_cs .)
-* On different variable types. Similarly, looking at a row or column as a list and incorporating functions like w MAX, AVERAGE, etc. gives the opportunity to investigate the idea of operations on a list. Some students will even go beyond the built-in fimctions and recognize aorting asalistoperatd
PROBLEM
SOLVING:
DATA
The tequiretnents for the assignment itself are purposely left somewhat “vague” with an explanation that “real world” problems don’t come with the requirements for a solution spelled out. Students are encouraged to foxrmdate questions concerning the assignment and class time is devoted to discussing their questions. It is only fair to mention that many students report that they dislike the “vagueness” of the data analysis asaignmen~ however, class evaluations alsoratethiaspMMeetdataanaiysisassigmnentaaoneof the most interesting and beneficial in the course. Our expkmation isthatthinking causmso mediscomfwbutis also mwmding!
ANALYSIS
in keeping with the idea of presenting a useful tcml with Whiclttodomeanin --~mgimtitiof analyzing a set of demogmphic data collected on the class members. The data aet is designed to capitatii on students’ natural Umdency to be interested in themselves, especially in comparison with their peers. Students fill out a “ the first weekofthequartcr andtheteaching q~ amistant enters the raw data into the spreadsheet using only random numbers as identifiers. See Figure 2 for an example. After learning the basics of using the spreadsheet package,
CONCLUSION
wi~
u~g a ~~ IMC@W.~ Ma great deal of syntacticrd overhe@ are able to motivate computer scieuce topics in a pre-CS 1 course via a simpleWuae application that allows hands-on experimentation. At the same time students learn practical problem-solving
19
FIGURE2: Sample
demographic data used for analysis
. WORK
YEAR
MAJOR
GPA
CREDITS
STATUS
CODES
NO.
SEX
AGE
COLLEGE
MATH
1
M
22
2
so
P BA
14
0
0
O=unemploged
2
M
18
8
FR
PRE CS
16
0
2
1=1 toshrs
Work
3
M
18
4
FR
ENG
16
0
4
2=5+
4
M
24
8
SR
PREMED
12
4
4
3=10+
S
M
22
4
FR
GREG
6
M
24
4
so
PRE EE
7F22
8
JR
APB IOL
8M
2
2-BS
BUS
9
F
42
3
GR
10
M
25
8
JR
24
8
19
11
M
MATH
so
BIOL
4
so
PRE EE
4
FR
CHEM
8
FR
BIOL
3
2.8
Status
tolo
hrs
to 15 hrs
12
4
3
4=1 5+ to 20 hrs
15
6
2
14
0
2
5=20+ to 30 hrs 6= 30+ &s
9
0
4
College 2= Business
13
0
3
4= Engineering
13
5
4
8=Science
13
5
4
9=Gen reg
12
F
13
F
14
M
15
M
22
8
SO
PREMED
3.2
12
6
4
1= Geometry
16
F
20
2
so
P BIS
3,9
14
0
2
2= Algebra
17
M
9
JR
UNDECL
18
M
FR
ART
19
ekiila. In terms of student interest and involvement
3.6
this is
J.T. Allen, H. Porter, T.R. Nanney, and K Abemethy. Reexamining the Introductory Computer Science Course in Liberal Arts Institutions. SIGCSE Bulletin, 22(1):100-4, Febmary 1990.
Frenkel.
Communications
Women
4= Calculus
-31
J.R. -y, E.B. Koffman and FL. Friedman. Problem Solving and Program Design in C. Addison Wesley, Reading, Maasaehusetts, 1993
(1-M87]
F.S.T. I-Mm A Computational Design of Some Matrix Iterative Methods using Spreadsheets. Industrial engineering, 191718+, my 1987. J. Konvalii and S. Wiletnan. Programming Pascaf. hfC&ilW-~ 1987.
With
and Computing. 23(11}34-46,
of the ACM
November 1990. ml]
3
0
lKW871
N. Dale and D. Orshalick. Introduction to PASCAL and Structured Design. D.C. Heath and Company, Lexington, Massachusetts, 1983. K.A.
2
13
BIBLIOGRAPHY
m=w
1
3= Trig
that they enjoy the satisfaction of learning a tool wh~h ean be applied to the solution of a variety of usefil problems.
lD083]
Math
O= Algebra
one of our most successful class activities. Students report
[APNA90]
Highest
J.D. Harber and G. Davenport. Numbers - A Medium that Counts. IEEE Computer 11:39-44, July 1991. Grap/zics Application,
13
l?at92]
D.A. Patterson. Haa CS Changed in 20 Years? Computing Research News, 4(2B2-3, March 1992
[Sli89]
J.D. SIiie. Let a Spreadsheet Do the Work. Electronic Design, 3’L101, November 23 1989.