CS 99

Summer 2001                                                                                  06.25

 

 


Lecture Notes 1

 

Introduction

·         CS99 is a 2-credit S-U class, intended for people with no programming experience.  This class will preserve that intention.

·         Those of you who have programmed before, in C++ or another language (and just what are you doing here anyway!?) may  find the pace of this course intolerably slow.  If you do have that experience, and that does happen,  then you should think about switching to CS100, as that may be more to your liking.  However, you don’t have much time to do that (I think Friday is the last day for switching) and the first assignment for CS100 is due this Wednesday.

·         See the handout for further details

·        This is a laboratory class as well as a lecture class.  Lecture meets Mondays and Wednesdays, while Lab meets Tuesdays and Thursdays.  Siddharth the TA will be responsible for the Labs, while I will be mostly responsible for everything else.

·        The labs will generally be designed so that there’ll be a portion you will be expected to complete in the hour available for lab, and a portion you will be expected to finish in your own time, after lab hours.

·         Siddharth and I will have 2 hours of Office hours  a week each, and there’ll be a tutor available.


Course Goals

·        At the end of this class, we want you to be able to solve simple programming problems (from scratch), learn a little Java, learn how to use the CodeWarrior development environment, and be aware of what might be expected from you in some of the upper level computer science courses here at Cornell.

·        Most of this course will be centered around the Laboratory experiments, and not the lecture.  You will never learn to program by just watching someone talk about it. 

 

Computer Basics

(Reading Savitch 1.1, 1.2)

·         On to lecture!

·         What is a computer?
Examples of computers

·         What is an algorithm? 
An algorithm is simply a series of steps to solve a problem. Not everything has an algorithm?  For instance, is there an algorithm for writing the perfect love letter?

·         What is a program?
A program is an algorithm written in a manner that a computer can understand and execute.  Usually that means it is written in a computer language that the computer understands.

·         How do we tell a computer to run a program?  Do we just say, computer do this?  Unfortunately, it’s not that simple (yet).  Computers only understand a very basic language of switches and registers.  If you had to talk the way computers talk, you’d be there all day just to tell it how to print “hello” on the screen …  there’s a name for that: machine or assembly language.  Those of you who stick around in computer science long enough might just take an upper level class where you do have to write in that language: consider it a rite of passage.

·         No, the way it usually works is that we use a high-level programming language that looks almost like English.  It’s not as expressive as English, but it’s certainly more precise.  Usually we type our program as a simple text file.  The manner in which that program is expressed is very limited: you have to follow faithfully the particular conventions of that programming language and the syntax is almost invariably ruthlessly narrow.

·         Once you’ve written the program into a text-file, then the usual process is that you need a Compiler that will then translate your particular programming language into a fashion that the computer you’re using actually understands, more like the machine and assembly language.

·         Java is just such a high-level programming language.

·         You need a Java compiler and a Java interpreter to run a Java program on your computer (you don’t really need a Java compiler to run Java bytecode on your computer, an interpreter will do just fine, but the Java bytecode will have had to have come from somewhere else.  To produce your own Java bytecode, you will need a compiler on your computer.

·         To get the compiler and interpreter, go the java.sun.com Website and download JDK1.X for your particular computer architecture (there are versions for Windows, SUN stations, and SPARC machines).  To get Java for the Mac, you’ll have to go the Apple site, www. apple.com.  It’s free! 

·         Once you’ve installed JDK1.X on your computer, it’s rather simple to start writing your own programs.  All you need is a simple text editor like Notepad to get started.

·         Demonstration with Notepad and JDK1.3 on Laptop: Hello World!

 

CodeWarrior

·         Is an integrated development environment (IDE) for writing and producing your own Java programs.  Think of it as an application like Microsoft Word, which is a development environment, in a way, for Text with all kinds of fancy bells and whistles.

·         You don’t need any of this extra stuff to run Java, but it makes life a whole lot simpler.

·         CodeWarrior has it’s own kinds of files and settings that aren’t native to Java but to CodeWarrior itself.  In CodeWarrior there are basically two kinds of files: Text files and Project files.  The text files are just the sort of files we were playing around with earlier in Notepad: simple ascii text files.

·         The project files are files you’ll only see in CodeWarrior, known them by their file type .mcp

·         These project files are responsible for ‘containing’ your real program files as well as various settings and other kinds of useful things you’ll want available for the particular kind of project you’re working on: there are Applet project files, Graphics project files, and several types of  Application project files with tiny differences between them

·         Demonstration with CodeWarrior, Hello World, again

 

Anyway you’ll see much more of this tomorrow in Lab.  See you then!