Week 1 Meeting 1

Why programming?

·         Computer science is studying foundational techniques used to solve real world problems using computers

·         Computer science is an applied discipline, i.e., you apply these techniques to new problems to create new solutions for these problems

·         Programming is the way you instruct a computer to execute the solutions you have created

Data vs Instructions

Instructions tell the computer to do something.

 

Data is the something that has something done to it.

 

Here is an instruction: 3 + 4

The 3 and the 4 are both data.  The instruction tells the computer to add these two pieces of data.

Hardware:

Processor

The portion of the circuitry that reads and executes instructions

Temporary Storage aka Main Memory or Memory

Both instructions and data are stored in memory.

Memory is a large collection of bits in a computing device.

A bit is typically implemented by a transistor.

A transistor is basically a capacitor.

A capacitor has the ability to hold an electric charge.

A capacitor can be on (it is holding a charge) or off (it is not holding a charge).

We consider a capacitor that is on to be a 1, and a capacitor that is off to be a 0.

 

Thus memory is simply a very long string of 1’s and 0’s.

 

Both instructions and data are held in memory.

 

How do we know whether any given set of bits is an instruction or a piece of data?

State

At any given time, memory contains a specific pattern of 1’s and 0’s.  We call the specific pattern of 1’s and 0’s that appear at a particular time a memory image.

Permanent Storage

Permanent storage is some device that can maintain the value of the bits it is storing without being connected to a power source.  The most common permanent storage device used to be the hard-disk in personal computers and servers, but it may have been surpassed in number of raw devices by flash memory devices by now….

In general, in any particular device, permanent storage is larger and slower than memory.

 

We generally call a logical piece of permanent storage a file

 

Running and editing a Program

A program to sequentially draw graphical shapes on the screen. 

Make a directory (folder) named cs256 on your P: drive.

Right-click this link:  ../demos/SequentialShapes.java and save to P:\cs256\SequentialShapes.java

Edit:
In JGrasp, choose menu item:

File | Open

Browse to P:\cs256\SequentialShapes.java

Compile:

Next, click the compile button    compileButton to translate your java code into byte codes that the java Virtual Machine can execute.

(this icon was invented before marijuana was legalized J)

 

Notice the messages from the compiler in the Run I/O window at the bottom of the screen.

Run

Click the run applet button  

 

Notice a window appears with a circle inside a square.

 

See if you can determine why the image appears as it does by reading the java code.

Try changing the order of the java statements and see how it changes the image.