Latest Update: 03/08/2000
Week 04 Notes for CS 2500 -- Spring 2000
(this is draft material)
* Take roll
* Schedule Highlights:
* Announce that the next programming assignment is ready.
* Announce that there is a quiz coming up on Friday, March 17.
* Anything left over from last week we want to do?
* Any questions?
* Examine non-recursive and recursive versions of in-order
traversal of a BST. Show the non-recursive first, and then
the recursive. This is good to indicate the power of
recursion. (Source: Stubbs and Webre)
* Discuss Activation Records and implementation of recursion.
Use the evaluation of factorials as the working example.
* Write out a "tree" to show how inefficient it is to calculate
n choose k with recursion.
* Later in the week we can discuss what the class has to think
about in order to finish the first programming assignment.
+ Possibilities:
- Discuss how to write code that reads chars and translates
to numerical.
- Discuss idea of having functions do translation
suitChar <--> suitNum, and rankChar <-->rankNum.
* Remarks on 2nd level program:
+ Don't use global variables -- if you have them in the
current design, move them into the main program. Each
function should get variables it needs either as parameters
or local variables.
+ Use mnemonic names for variables. In other words the name
of the variable should tell the reader what is the role of
the variable in the program. Include additional comments
that further clarify the purpose of each variable, unless
the name itself makes everything abundantly clear.
+ Remember you have to send a script that shows adequate
testing
+ Do not e-mail "attachments" or "enclosures". Just send
files as I showed in the hello world example, or paste
directly into the message window if you are using a GUI
e-mail program.
+ send e-mail to john@ishi.csustan.edu. If you are on a sun,
sending mail to "john" or for example john@altair or
john@csustan won't work. Use the exact address
john@ishi.csustan.edu.
+ Get in the habit of writing a header comment for each
function *before* you write the function -- even if it is
just one sentence. You will *save* time if you do this,
because you will make fewer logical errors. (Also you will
lose substantial points if your program is not documented,
or if the documentation is incoherent.)
+ Don't forget that "case matters" in Unix and C++. The card
codes use upper case letters, so your program has to look
for upper case lettes.
* We can talk about arrays, records, arrays of records, records
containing arrays, etc.
* Point out locations in "General Info" section of web space
where there is information on compiling, setting up www
browsing, and other things ...
=================================================================
Point out that there are C++ strings and C strings. Students
should use
#include <string>
if they want to use C++ strings.
If they want to use C strings, then do one or both of:
#include <cstring>
#include <string.h>
=================================================================
* Discuss virtues of abstract data typing and modular code.
Easier to design correctly
Easier to change implementations
protects integrity of data from users
Easier to re-use code