The George Washington University
School of Engineering and Applied Science
Department of Computer Science
CSci 51 -- Spring 2001
Occasional Lecture Notes
last change: Thursday, Feb. 8, 2001

Normally, lecture notes are not formally distributed in this course. On the other hand, viewgraphs that present material not covered in the course textbook will appear, from time to time, in this file. New notes will simply be added to the end of the file. Watch the date at the top to see if anything has been changed.


Objectives, Lecture 2 (1/18/01)

  • Discuss the purpose of a compiler and the process of compiling, linking, and executing (running) a program.
  • Get a bit acquainted with the Spider animation system.
  • Compile and run some Spider programs.

Objectives, Lecture 3 (1/23/01)

  • Examine a few more Spider programs - discuss repetition (LOOP) and decision (IF) statements
  • Discuss human languages vs. programming languages
  • Observe compiler's response to language errors

The Power of Programs

  • Programs can be written to solve a multitude of (sometimes very complex) problems
  • Yet they are made up of careful combinations of very simple operations
  • Simple operations are combined in the following ways
    • sequence - one operation (or group of operations) directly follows another
    • decision - an operation (or group of operations) is executed, or not executed, based on the results of a yes/no (true/false) decision
    • repetition - an operation (or group of operations) is executed repeatedly, a given number of times, or until a given condition is true
  • Believe it or not, that's all! All programs are constructed this way!

How are programming languages different from natural (human) languages?

  • Human languages evolve naturally; programming languages are carefully designed
  • Computer languages have very fussy rules, but these are easier to learn because they have fewer exceptions than human languages do
  • A compiler's function is to examine a program in a higher-level programming language, then - if the program follows all the rules - translate it to machine code. Here are the phases:
    • lexical analysis: classify every symbol according to its "part of speech"
    • syntactic analysis: check for proper "sentence structure" - do all the parts of speech occur in the proper order?
    • semantic analysis: determine the meaning of the program - does every symbol have a well-defined meaning?
    • translation into machine code

Syntactic and semantic analysis

  • Syntactic analysis compares statements in a language to the grammar, or set of rules, for writing a well-formed statement in that language.
  • Semantic analysis analyzes well-formed statements of a language to determine whether they are meaningful.
    • Monkey ate banana.
    • Monkey ate the banana.
    • The monkey ate the banana.
    • George ate the banana.
    • The banana ate the monkey.
    • The banana ate George.
    • Time flies like an arrow; fruit flies like a banana.
    • “We'll see,” said the blind man, as he picked up his hammer and saw.
    • Outside of a dog, a person's best friend is a book. Inside of a dog, it's too dark to read.

Objectives, Lecture 7 (Tues. Feb. 6, 2001)

  • Test plans

Test plans

What is the purpose of a program test plan?


When is the best time to develop a test plan?

After you write the program?

After you write the algorithm?

As soon as you understand the problem to be solved?


black-box testing ==>

functional testing

<testing> (Or "black-box testing", "closed-box testing") The application of test data derived from the specified functional requirements
without regard to the final program structure.

(1996-05-15)

white box testing

<programming> (Or "clear", "glass", "open") Software testing approaches that examine the program structure and derive test data from the
program logic.

Structural testing is sometimes referred to as clear-box testing since white boxes are considered opaque and do not really permit visibility
into the code.

(1996-05-10)

Source:  Free Online Dictionary of Computing http://www.foldoc.org


How many test cases should a test plan have?

As few as possible, but no fewer

Problem: date validation

Given a month, a day, and a year between 1000 and 3000, determine whether the combination would make a valid date.

Let's write a test plan for this!