administrivia from [email protected] thu nov 8 12:05:31 2001 date: thu, 8 nov 2001 12:04:36...
Post on 19-Dec-2015
214 views
TRANSCRIPT
![Page 1: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/1.jpg)
Administrivia
From [email protected] Thu Nov 8 12:05:31 2001
Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST)
From: [email protected]
no goodies for you
just a lump of coal
![Page 2: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/2.jpg)
Administrivia
From [email protected] Thu Nov 8 12:05:31 2001Return-Path: <[email protected]>Received: from Princeton.EDU (postoffice.Princeton.EDU [128.112.129.120]) by upright.CS.Princeton.EDU (8.11.6/8.11.6) with ESMTP id fA8H5QQ29528 for <[email protected]>; Thu, 8 Nov 2001 12:05:31 -0500 (EST)Received: from yuma.Princeton.EDU (yuma.Princeton.EDU [128.112.128.89]) by Princeton.EDU (8.9.3/8.9.3) with SMTP id MAA29199 for dpd; Thu, 8 Nov 2001 12:04:36 -0500 (EST)Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST)From: [email protected]: <[email protected]>Status: RO
no goodies for youjust a lump of coal
![Page 3: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/3.jpg)
Why the internet works
• TCP/IP• Other protocols
– http– Smtp
• Lots of means of testing and seeing the network– Traceroute (on UNIX) (tracert on windows)– ping– www.arin.net (whois command)– www.caida.org (who sees who)
• http://www.caida.org/projects/internetatlas/gallery/ascore/demo.xml (step by step)
![Page 4: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/4.jpg)
When things go wrong
• Code-red virus– On July 19, 2001 more than 359,000 computers were
infected with the Code-Red (CRv2) worm in less than 14 hours. At the peak of the infection frenzy, more than 2,000 new hosts were infected each minute. 43% of all infected hosts were in the United States, while 11% originated in Korea followed by 5% in China and 4% in Taiwan. The .NET Top Level Domain (TLD) accounted for 19% of all compromised machines, followed by .COM with 14% and .EDU with 2%. We also observed 136 (0.04%) .MIL and 213 (0.05%) .GOV hosts infected by the worm.
– Visualization
![Page 5: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/5.jpg)
The Internet
• Where did it come from
• How has it grown
• Who owns the internet
![Page 6: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/6.jpg)
Internet, as we know it
• 1960’s DoD built ARPANET– Experimental network
– Would function even in event of nuclear war
• 1985 NSF created NSFNET– Based on ARPRANET
– National backbone service
– Free to educational and research institutions
– Corporations (eg Sprint, MCI) built networks • Networks linked to NSFNET
![Page 7: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/7.jpg)
Internet, as we know it (cont.)
• 1993 InterNIC created by NSF– directory and database services (AT&T)
– registration services (Network Solutions Inc.)
– information services (General Atomics/CERFnet)
• 1989 http created by Tim Berners-Lee – Released to high energy physicists in 1991
– Mosaic in 1993
– Netscape in 1994
![Page 8: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/8.jpg)
Internet – key events
• 1961 Kleinrock – packet-switching theory
• 1966 Roberts – Plan for ARPANET
• 1969 – First ARPANET
With much help from Hobbes' Internet Timeline http://www.zakon.org/robert/internet/timelineCopyright (c)1993-2000 by Robert H Zakon.
![Page 9: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/9.jpg)
First packets sent by Charley Kline at UCLA as he tried logging into SRI. The first attempt resulted in the system crashing as the letter G of LOGIN was entered. (October 29)
![Page 10: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/10.jpg)
Internet – key events (cont.)
• 1973 – Ethernet invented– Email is 75% of ARPANET traffic
• 1974– TCP designed
• 1978– TCP split into TCP and IP
• 1980– First virus
![Page 11: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/11.jpg)
Internet – key events (cont.)
• 1983– First nameserver– Cut over to TCP/IP
• 1984– DNS (Domain Name System) introduced
• .com, .edu, …
– Number of hosts above 1000
• 1988– CERT (Computer Emergency Response Team) formed
in response to Morris worm
![Page 12: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/12.jpg)
Internet – key events (cont.)
• 1989– Number of hosts above 100,000
• 1990– ARPANET ceases to exist
• 1993– Mosaic; WWW proliferates at a 341,634% annual growth rate
of service traffic
• 1994– 25th anniversary of ARPANET
![Page 13: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/13.jpg)
Growth in number of hosts
![Page 14: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/14.jpg)
Growth in number of domains
![Page 15: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/15.jpg)
Growth in number of networks
![Page 16: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/16.jpg)
WWW Growth
![Page 17: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/17.jpg)
Who owns the internet?
• Central organizations– InterNIC and its successors (for names)– ISP’s for transportation
• The networking community– Setting and following standards
• IETF (Internet Engineering Task Force)• W3C (World Wide Web Consortium)
– Network managers
![Page 18: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/18.jpg)
Who owns the internet? (cont.)
• We all do– Information wants to be free– A lot of good social behavior is required
![Page 19: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/19.jpg)
What happens next?
• Various scenarios…– Which one do you believe?
![Page 20: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/20.jpg)
Networking (conclusion)
• At the bottom– Hardware generating packets– Protocols for packet transmission– Collision, backoff, …
• In the middle– TCP/IP is the key idea
• At the top– Some nice tools
• Ping, traceroute, … are useful
– Ports on my machine for http, ftp, fingerd, ping, …
![Page 21: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/21.jpg)
A few questions
• What does it mean to be connected to the internet?– How is the web different from the internet?
• What about security?– Child security in chatroom– Would/should you give a credit card number
• What’s next?
![Page 22: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/22.jpg)
Programming
November 13, 2001
![Page 23: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/23.jpg)
Where we are
• Built a machine
• Built an operating system to control the machine
• Now, want to run programs under the operating system
![Page 24: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/24.jpg)
What is programming
• We did machine language– Single instructions that tell the hardware what to do
– Primitive• Arithmetic, simple branching, communication with memory
• We built state machines– States using memory– Transitions modeling tasks
![Page 25: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/25.jpg)
Problem solving
We’ve seenTruth tables
Logic gates
States and transitions in a state machine
Machine language
Now, higher level programming language
![Page 26: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/26.jpg)
To build a computer program
• Figure out what you want to do– Understand the rules that guide the process you
are automating• Make sure that your rules are complete
• Translate the rules into the computer language– Build structures to hold your data– Build tools to manipulate them
• Make sure that the program does what the rules say
![Page 27: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/27.jpg)
Figuring out the rules
• For traffic lights, – We stored data that told us the current color of lights
– We read input from sensors
– We had rules that told us whether to change state
– We had rules that told us how to change state
![Page 28: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/28.jpg)
Light
ATraffic Light Behavior
IF A=1
AND B=0
Always
IF A=0
AND B=1
Otherwise
Light BOtherwise
Always
![Page 29: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/29.jpg)
Turn Memory Into Variables
• Store data to tell current color of lights– Dim LightA, LightB as Integer
• ‘ 0 for red, 1 for yellow, 2 for green
• Read input from sensors– Dim SensorA, SensorB as Integer
• ‘ tell if cars are waiting
![Page 30: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/30.jpg)
Turn Rules Into Statements
• Decide whether to change state– If LightA = 2 And SensorA = 0 And SensorB = 1 Then
• ‘ here we want to specify that the colors change
– If LightB = 2 And SensorA = 1 And SensorB = 0 Then• ‘ again, we want to specify that the colors change
![Page 31: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/31.jpg)
Build shell of program
Dim LightA, LightB as Integer Dim SensorA, SensorB as Integer If LightA = 2 And SensorA = 0 And SensorB = 1 Then
ChangeGreenToYellow(LightA)ChangeYellowToRed(LightA)ChangeRedToGreen(LightB)
If LightB = 2 And SensorA = 1 And SensorB = 0 ThenChangeGreenToYellow(LightB)ChangeYellowToRed(LightB)ChangeRedToGreen(LightA)
![Page 32: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/32.jpg)
Some Rules
• Statements have to be in blocks• How does the computer know that it is
If LightA = 2 And SensorA = 0 And SensorB = 1 ThenChangeGreenToYellow(LightA)ChangeYellowToRed(LightA)ChangeRedToGreen(LightB)
• And NotIf LightA = 2 And SensorA = 0 And SensorB = 1 Then
ChangeGreenToYellow(LightA)
ChangeYellowToRed(LightA)ChangeRedToGreen(LightB)
![Page 33: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/33.jpg)
Some Rules
• Statements have to be in blocksIf LightA = 2 And SensorA = 0 And SensorB = 1 Then
ChangeGreenToYellow(LightA)
ChangeYellowToRed(LightA)
ChangeRedToGreen(LightB)
End If
![Page 34: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/34.jpg)
More Rules
• We have to tell the program to loopDo While condition
action Loop
![Page 35: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/35.jpg)
More Rules
• We have to tell the program to loop
Do While StillWantToControlTraffic RunMyTrafficControlProgram
Loop
![Page 36: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/36.jpg)
Procedures
• Must fill in functions to change lightsPrivate Sub ChangeGreenToYellow(Light As Integer)
Light = 1End SubPrivate Sub ChangeYellowToRed(Light As Integer)
Light = 2End SubPrivate Sub ChangeRedToGreen(Light As Integer)
Light = 0End Sub
![Page 37: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/37.jpg)
Could build Procedure of Procedures
ChangeGreenToYellow(LightA)ChangeYellowToRed(LightA)ChangeRedToGreen(LightB)
Could become the command ChangeLights(LightA,LightB)
Private Sub ChangeLights(Light1 As Integer, Light2 As Integer)
ChangeGreenToYellow(Light1)
ChangeYellowToRed(Light1)ChangeRedToGreen(Light2)
End Sub
![Page 38: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/38.jpg)
Using the procedure
ChangeLights(LightB,LightA) then does
ChangeGreenToYellow(LightB)
ChangeYellowToRed(LightB)
ChangeRedToGreen(LightA)
![Page 39: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/39.jpg)
The program
Private Sub ChangeGreenToYellow(Light As Integer)Light = 1
End SubPrivate Sub ChangeYellowToRed(Light As Integer)
Light = 2End SubPrivate Sub ChangeRedToGreen(Light As Integer)
Light = 0End SubPrivate Sub ChangeLights(Light1 As Integer, Light2 As Integer)
ChangeGreenToYellow(Light1)
ChangeYellowToRed(Light1)ChangeRedToGreen(Light2)
End Sub
![Page 40: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/40.jpg)
The program (cont.)
Dim LightA, LightB as Integer
Dim SensorA, SensorB as Integer
If LightA = 2 And SensorA = 0 And SensorB = 1 Then
ChangeLights(LightA,LightB)
End If
If LightB = 2 And SensorA = 1 And SensorB = 0 Then
ChangeLights(LightB,LightA)
![Page 41: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/41.jpg)
Make it happen forever
Dim LightA, LightB as Integer
Dim SensorA, SensorB as Integer
Dim StillWantToControlTraffic as Integer
StillWantToControlTraffic = 1
Do While StillWantToControlTraffic If LightA = 2 And SensorA = 0 And SensorB = 1 Then
ChangeLights(LightA,LightB)
End If
If LightB = 2 And SensorA = 1 And SensorB = 0 Then
ChangeLights(LightB,LightA)
End If
Loop
![Page 42: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/42.jpg)
What could go wrong?
• Program could get confused– Check for consistency
• ReplacePrivate Sub ChangeGreenToYellow(Light As Integer)
Light = 1End Sub
• WithPrivate Sub ChangeGreenToYellow(Light As Integer)
If (Light = 0) ThenLight = 1
ElseReportInconsistency()
End IfEnd Sub
![Page 43: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/43.jpg)
Building a bigger program
• Could write this as a subroutine– Private sub
ControlTrafficLight(light1,light2,sensor1,sensor2)
• Could reuse the subroutine to do a whole string of lights.
• But how would we keep track of hundreds of lights?
![Page 44: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/44.jpg)
Arrays
• Build arrays– LightNS[1], LightNS[2], LightNS[3], …– LightEW[1]. LightEW[2]. LightEW[3], …– SensorNS[1], SensorNS[2], SensorNS[3], …– SensorEW[1], SensorEW[2], SensorEW[3], …
![Page 45: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/45.jpg)
Arrays (con’t).
• Keep track of things in arrayControlTrafficLight(lightNS[i],lightEW[i],sensorNS[i],sensorEW[i])
• Control all the traffic lights in ManhattanFor i = 1 To 100
ControlTrafficLight(lightNS[i],lightEW[i],sensorNS[i],sensorEW[i]) Next i
• But, – lights may want to communicate
– Light at an intersection carries more information
![Page 46: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/46.jpg)
Object oriented programming
• Figure out characteristics of your data– objects
• Figure out operations you will want to perform – Methods
• Modern idea in programming.
![Page 47: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/47.jpg)
Objects
• Traffic light at intersection involves– Lights in each direction
• Call them red, yellow and green and not 0,1,2
– Sensors in each direction– Timing (rate of change in each direction)
• Timings needn’t be the same
– Neighboring Lights• May affect change as much as sensors
![Page 48: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/48.jpg)
Methods
• Method of querying color of light
• Method of changing color of light
• Method of scheduling a color change later
• …
![Page 49: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/49.jpg)
What happens to the program?
• Compiled or interpreted– Eventually it gets translated into machine
language
• If compiled– Can store executable and run again
• If interpreted– Interpret each time it is executed
![Page 50: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/50.jpg)
What does the compiler do?
• Identifies variables (need space in RAM)– Uses stores and loads to get values to registers
• Parses commands– Turns each command into a string of machine
language commands
• Sets things up for execution
![Page 51: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/51.jpg)
History of Programming Languages
• Fortran (1954) for scientific • Cobol (1959) for business
• Algol (1958) more universal Fortran
• Lisp (1958) string/concept oriented
• APL (1960) formula oriented
![Page 52: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/52.jpg)
History of Programming Languages
• PL/1 (1964) from Algol + Fortran
• Basic (1964) for everyone to use
• Simula (1967) combines with Algol to yield Smalltalk (1969) – object oriented
• BCPL B C (1971)
• Algol Pascal (1971) Modula 1,2,3,
![Page 53: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/53.jpg)
History of Programming Languages
• C++ (1983) C with object oriented features– Often C is still used
• Awk (1978) Perl (1987) report generators– Web programming language
• Java (1991) object oriented and portable– Web applets, devices
• Visual Basic(1991) macros and programs– Core of Microsoft systems
![Page 54: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/54.jpg)
What makes a good language
• Does the task you want
• Keeps you from making mistakes
• Supports debugging when you need it
• Has a strong tool kit
![Page 55: Administrivia From santaclaus@northpole.org Thu Nov 8 12:05:31 2001 Date: Thu, 8 Nov 2001 12:04:36 -0500 (EST) From: santaclaus@northpole.org no goodies](https://reader035.vdocument.in/reader035/viewer/2022062714/56649d395503460f94a132f2/html5/thumbnails/55.jpg)
Next class
• Look at a bigger system
• Some internals of how the compiler works
• Some notable bugs
• How do we know if we’ve gotten it right?