




























Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
A part of the lecture notes for cs2110 fall 2008 course at cornell university. It covers the history of programming languages, focusing on machine language, assembly language, high-level languages, and java. The lecture also includes java tips, tricks, and pitfalls, as well as debugging and experimentation.
Typology: Assignments
1 / 36
This page cannot be seen from the preview
Don't miss anything!





























Due Wednesday, September 10, 11:59pm Materials available in CMS
Report any problems to your Section TA (email is fine)
Consulting will start very soon—watch for announcements Instructor & TA office hours are in effect
Used with the earliest electronic computers (1940s) Machines use vacuum tubes instead of transistors Programs are entered by setting switches or reading punch cards All instructions are numbers Example code 0110 0001 0000 0110 Add Reg1 6 An idea for improvement Use words instead of numbers Result: Assembly Language
Idea: Use a program (a compiler or an interpreter ) to convert high-level code into machine code Pro Easier for humans to write, read, and maintain code Con The resulting program will never be as efficient as good assembly-code Waste of memory Waste of time The whole concept was initially controversial FORTRAN (mathematical FORmula TRANslating system) was designed with efficiency very much in mind
Initial version developed in 1957 by IBM Example code C SUM OF SQUARES ISUM = 0 DO 100 I=1, ISUM = ISUM + I*I 100 CONTINUE FORTRAN introduced many high-level language constructs still in use today Variables & assignment Loops Conditionals Subroutines Comments
COmmon Business Oriented Language Developed by the US government (about 1960) Design was greatly influenced by Grace Hopper Goal: Programs should look like English Idea was that anyone should be able to read and understand a COBOL program COBOL included the idea of records (a single data structure with multiple fields , each field holding a value)
These languages introduced and popularized Object Oriented Programming (OOP) Simula was developed in Norway as a language for simulation in the 60s Smalltalk was developed at Xerox PARC in the 70s These languages included Classes Objects Subclasses & Inheritance
class Thing { int val; Thing(int val) { this.val = val; } Thing() { this(3); } } Thing one = new Thing(1); Thing two = new Thing(2); Thing three = new Thing();
16 class Widget { static int nextSerialNumber = 10000; int serialNumber; Widget() { serialNumber = nextSerialNumber++; } public static void main(String[] args) { Widget a = new Widget(); Widget b = new Widget(); Widget c = new Widget(); System.out.println(a.serialNumber); System.out.println(b.serialNumber); System.out.println(c.serialNumber); } }
class Thing { int val; boolean setVal(int v) { int val = v; } }
Method must be named main Parameters passed to program on command line A class method; don’t need an object to call it Can be called from anywhere No return value
Refer to my static and instance fields & methods by (unqualified) name: serialNumber nextSerialNumber Refer to static fields & methods in another class using name of the class Widget.nextSerialNumber Refer to instance fields & methods of another object using name of the object a.serialNumber Example System.out.println(a.serialNumber) out^ is a static field in class^ System The value of^ System.out^ is an instance of a class that has an instance method println(int) If an object must refer to itself, use^ this