survey results. class year prior programming experience

64
Survey Results

Upload: elvis-plumer

Post on 15-Dec-2015

224 views

Category:

Documents


1 download

TRANSCRIPT

Survey Results

Class Year

Prior Programming Experience

Object Oriented Experience

Java AWT/Swing Experience

How students feel about 15 so far

Hours spent per week

• Length of lineso hours were a zoo the same week the survey was released.

Never seen lines so long or expect to see them as bad again.o even though we have 150 hours of help a week, lines were

still too long• Socratic Methodo TAs are carefully trained during TA camp, here to support not

to tutoro they will NOT give you the answers or tell you if you are

correct or not

TA Hours

• What we’ll fixo dates for last few assignments were on weekend where fewer hours were

held. For future programming assignments, this will not be the case.o we will change hours for the final projects and will be increasing them

around final project deadlines

• What you’ll fixo start early, start now, start yesterday: very little wait the first week of Doodle

Jumpo this week hours have also been almost empty, so start Tetris while it is easy

to get your questions answeredo come prepared with a specific question or bug, so that the TA can work with

you effectively to help you

TA Hours

• Timelinesso projects are graded and returned before early hand-in of next assignmento DQs are returned the night that they are turned in, so students can start

work right awayo one project for one student takes an hour overall to grade (from the time

a TA takes to go through code plus discussion/clarification from HTAs/other TAs)

• DQso due on Sundays at 2pm, so that TAs can immediately grade during

weekly Sunday meetingo these are due BEFORE the help session because students are expected

to have thought about and worked on the design before the correct answers are explained in the session

Grading

• Consistencyo all TAs work off a common rubric. Most work is graded

during a weekly meeting with all TAs to ensure we are consistent

o as the course progresses, we will be getting stricter about things like design and style

o can always appeal grading complaints to the HTAs and/or Andy

Grading

Introducing… Maps (1/3)

● Maps are used to store (key, value) pairs, so a key is used to lookup its corresponding value

● (Word, Definition) in a dictionary● (Brown ID, Person), in banner● (Name, Phone #) in a contacts list● (Identifier, Memory address) in compiler –

called symbol table12/33

Introducing… Maps (2/3)

● In Java, use the java.util.HashMap<K,V> class● In general, this structure is often called a hash table● Other structures to accomplish this goal include

TreeMap, Hashtable, LinkedHashMap, and moreo each has its own advantages and drawbackso we will focus on HashMap

• HashMaps have constant-time insert, removal, and search. We will explain why shortly 13/33

HashMap Syntax

● Like other data structures, need to specify the type of elements we put in

● However, this time we need to specify the type of both the key AND the value

● The Key and Value can be instances of any class

new HashMap<KeyClass, ValueClass>();

14/33

HashMap Syntax● If we wanted to map an Integer to its String representation HashMap<Integer, String> intTable = new HashMap<Integer,

String>();

● If we wanted to map a TA to his/her Birthday HashMap<CS15TA, Date> birthdayTable = new HashMap<CS15TA,

Date>();

● In all cases, both key and value type must resolve to a class

● Note: Can’t use <int, boolean> because both int and boolean are primitives, not classeso cannot use a primitive type as a generic, so use a built-in class that is equivalent to

that primitive (wrapper)

● Instead use <Integer, Boolean> 15/33

java.util.HashMap Methods (1/2)//K refers to the type of Key, V to type of value.//adds the specified key, value pair to the tablepublic V put(K key, V value)

//returns the value to which the specified key is mapped, or null //if the map contains no mapping for the key//Note on parameter type: Java accepts any Object, but you should //supply the same type as the keypublic V get(Object key)

//returns the number of keys in this hashtablepublic int size()

16/33

java.util.HashMap Methods (2/2)//Note on parameter type: Java accepts any Object, but you//should supply the same type as either the key or the value

//tests if the specified object is a key in this hashtablepublic boolean containsKey(Object key)

//returns true if the hashtable maps at least one key to this valuepublic boolean containsValue(Object Value)//removes the key and its corresponding value from the hashtable//returns value which the key mapped to, or null if key had no mappingpublic V remove(Object key)//More methods in JavaDocs

17/33

Finding out your friends’ logins (1/4)

● Given an array of CS students who have the properties “csLogin” and “real name”, how might you efficiently find out your friends’ logins?

● Givenso String[] _friends, an array of your 30 friends’

nameso CSStudent[] _students, an array of students

18/33

● Old Approach:for (int i=0; i < _friends.length; i++){ //for all friends for (int j=0; j < _students.length; j++){ //for all students if (_friends[i].equals(_students[j].getName())){ String login = _students[j].getLogin(); System.out.println(_friends[i] + “‘s login is “ + login +

“!”); } }}

● Note: Use String class’ equals() method because “==” checks for equality of reference, not of content

● This is O(n2) – far from optimal

Finding out your friends’ logins (2/4)

19/33

● An approach using a HashMap:o Key is nameo Value is logino Use name to look up login!

Finding out your friends’ logins (3/4)

20/33

● An approach using a HashMapHashMap<String, String> myTable = new HashMap<String, String>();for (CSStudent student : _students){ myTable.put(student.getName(), student.getLogin());}for (String friendName : _friends){ String login = myTable.get(friendName); if (login == null){ System.out.println(“No login found for “ + friendName); continue; } System.out.println(friendName + “‘s login is “ + login + “!”);}

● What’s the runtime now?● O(n) – because each insert and search is O(1); much

better!

Finding out your friends’ logins (4/4)

21/33

Counting frequency in an Array (1/4)

● How many times does a given word show up in a given string?

● GivensString[] _book, an array of Strings containing many wordsString _searchTerm, the String you’re looking for

22/33

Counting frequency in an Array (2/4)

int wordCounter = 0;for (String word : _book){

if (word.equals(_searchTerm)){wordCounter++;

}}System.out.println(_searchTerm + “ appears “ + wordCounter + “ times”);

23/33

● When tracking one word, code is simple● But what if we wanted to keep track of 5

words? 100?● Should we make instance variables to count

the frequency of each word?● Should we iterate through the _book for

each of the search terms? Sounds like O(n2)...

Counting frequency in an Array (3/4)

24/33

HashMap<String, Integer> counter = new HashMap<String, Integer>();

for (String currWord : _book){ if (counter.containsKey(currWord){ Integer count = counter.get(currWord); counter.remove(currWord); count++; counter.put(currWord, count); } else{ //First time seeing word counter.put(currWord, 1); }}

Counting frequency in an Array (4/4)

//_searchTerms is an array of Strings we’re countingfor (String word : _searchTerms){ Integer freq = counter.get(word); if (freq == null){ freq = 0; } System.out.println(word + “ shows up “ + freq + “ times!”);}

Despite increase in search terms, still O(n)

25/33

Map Implementation (1/5)

● How do we implement a Map with constant-time insertion, removal, and search?

● In essence, we are searching through a data structure for the value associated with the keyo similar to the searching problem we have been trying to optimize

● Data structures we have so far:o Runtime to search in an unsorted array is O(n) o To search in a sorted array using binary search is O(logn)o Using a binary search tree, search is also O(logn), but we have faster

insertion and removalo Can we do better than a binary search tree?

26/33

● How about a ternary search tree (each node has at most 3 children)?o O(Log3N)

● Or a 10-way tree with O(Log10N)● Let’s try the runtime for a search with 1,000,000 nodes

o Log101,000,000 = 6o Log2 1,000,000 < 20, so shallower but broader tree

● Analysis: the logs are not sufficiently different and the comparison (basically an n-way nested if-else-if) is far more time consuming, hence not worth it

Map Implementation (2/5)

27/33

Map Implementation (3/5)

● Try a radically different approach, using an array● What if we could directly use the key as an index to access

the appropriate spot in the array?● Remember: digits, alphanumerics, symbols, even control

characters are all stored as bit strings– “it’s bits all the way down…”

o see ASCII table o bit strings can be interpreted as numbers in binary that can be used to index

into an array

28/33

Map Implementation (4/5)● But creating an array to look up CS15 students (value) based

on some ID number (key) would be a tremendous waste of spaceo If ID number is one letter followed by five digits (e.g., D00011), there are

26*105 combinations!o do not want to allocate 2,600,000 words for no more than 300 studentso (1 word = 4 bytes)o array would be terribly sparse…

● What about using social security number?o would need to allocate 109 words, about 4 gigabytes, for no more than 300

students! And think about aribtrary names <30 chars, need 2630 !!

29/33

Map Implementation (5/5)

● Thus, two major problems:o How can we deal with arbitrarily long keys, both

numeric and alphanumeric?o How can we build a small, dense (i.e., space-

efficient) array that we can index into to find keys and values?

● Impossible?● No, we approximate

30/33

Hashing● How do we approximate?

o We use Hashingo Hashing refers to computing an array index

from an arbitrarily large key using a hash function

o Hash function takes in key and returns index in array

● Index leads to a simple value or an entire object

● Therefore, a two-step process:o hash to create index, use index to get value

hashfunction indexkey value

array

31/33

Hashing● Array used in hashing typically holds several hundred to

several thousand entries; size typically a prime (e.g., 1051)o array of links to instances of the class TA

Greg

Ardra

Sonia

null

null

0

1

2

3

4

N - 1

Hash(‘Greg’)=0

Hash(‘Ardra’)=1

Hash(‘Sonia’)=4

32/33

● An example of a hash function for alphanumeric keyso ASCII is a bit representation that lets us represent all alphanumeric symbols

as integerso Take each character in key, convert to integer, sum integers - sum is indexo But what if index is greater than array size?o Use mod, i.e. (index % arrayLength) to ensure final index is in bounds

● A better hash functiono take a string, chop it into sections of 4 letters each, then take value of 32 bits

that make up each 4-letter section and XOR them together, then % that result by table size

● Almost any reasonable function that uses all bits will do, so choose a fast one, and one that distributes more or less uniformly (randomly) in the array to minimize holes!

Hash Functions

33/33

Collisions● If we have 6,000 Brown student names that we

are mapping to Banner IDs using an array of size 1051, clearly, we are going to get “collisions” where different keys will hash to the same index

● Does that kill the idea? No!● Instead of having an array of type Value, we

instead have each entry in the array be a

_head pointer to an overflow “bucket” for all keys that hash to that index. The bucket can be, e.g., our perennial favorite, the unsorted singly linked list, or an array, whatever…

● So, if we get a collision, the linked list will hold all values with keys associated to that bucket 34/33

Collisions● Since multiple objects will typically hash to the same

bucket, for methods like get(key) and remove(key), HashMap will have to iterate through all items in the hashed bucket to get or remove the right object

● This is O(k), where k is the length of a bucket – it will be small, so brute force search is fine

● The best hash functions minimize collisions● Java has its own efficient hash function, covered in CS16● A way to think about hashing: a fast, large intial division

(e.g., 1051-way), followed by a brute force search over a small bucket – even bucket size 100 is fast!

35/33

HashMap Pseudocodetable = array of lists of some

sizeh = some hash function

public put(K key, V val): int index = hash(key) table[index].addFirst(key,

val)

O(1), if h() runs in O(1) time

public V get(K key): index = hash(key) for (k, v) in table[index]:

if k == key: return v return null //key not found

Runs in O(k) time, where k is size of bucket, usually small

Note: LinkedLists only hold one element per node, so in actual code, you would need to make a class to hold the key and the value 36/33

HashMaps… efficiency for free?

● Not quite● While put() and get() methods run in O(1) time, each

takes more time than inserting at the end of a queue, for example

● A bit more memory expensive (array + buckets)● Inefficient when many collisions occur (array too small)● But it is likely the best solution overall, if you don’t need order● No support for ordering

o (key, value) pairs are not stored in any logical order

37/33

Lecture 20A Brief History of Computers & Programming

LanguagesSee The Innovators: How a Group of Hackers, Geniuses, and Geeks Created the

Digital Revolution by Walter Isaacson. Copyright © 2014 by Walter Isaacson

In the beginning…(1/4)● Long history of mechanical computing

devices (adders) as part of development of clocks, orreries, elaborate music boxes and instruments o based on cogs on wheels, carry mechanism

o 1645: Blaise Pascal creates the Pascaline adding machine – up to 8 dials

o 1671: Leibniz Calculating Machine could add, subtract, multiply, and divide

1 of 24

Music Link: https://www.youtube.com/watch?v=P0FxZUrIB5M&index=2&list=RDtds0qoxWVssMuseum dedicated to mechanical music making: http://www.museumspeelklok.nl/Agenda/Rondleiding

In the beginning…(2/4)● 1822: British inventor Charles Babbage proposed idea of

mechanical calculation to compute polynomials (for ballistics, longitude tables) - designed but never built the Difference Engine

● Then proposed combining mechanical calculation with idea of feeding instructions to a more powerful machine via punched cards in the style of music boxes and the Jacquard Loom, thus designing the first(mechanical) computer, the Analytical Engine

o first had to invent machine tools for the precise machining required, but never completed the Analytical Engine

o but the “architecture” is strikingly similar to the essence of modern computers: driven by instructions; arithmetic unit, memory, input/output

Jacquard Loom

Charles Babbage

Punch cards on a Jacquard Loom

2 of 24

Difference Engine● A modern implementation of the difference engine

was finally completed by the London Science Museum in 2002

3 of 24

Analytic Engine

● Babbage’s son built a small part of his analytic engine in 1910, and the Science Museum has begun the process of building a compete version

4 of 24

Ada Lovelace

In the beginning…(3/4)● ~1845: Augusta Ada Lovelace, Lord

Byron’s daughter, writes program tocalculate Bernoulli numberso first known computer program and programmer!o written for Babbage’s analytical engineo “machine does exactly what you tell it to do”o “the Analytical Engine weaves algebraic patterns

the way the Jacquard Loom weaves flowers and leaves”

o Ada programming language named in her honor was a DOD-sponsored language for writing complex programs using software engineering principles, including Abstract Data Types

A piece of the analytic engine (photo from the Science Museum of London) 5 of 24

In the beginning…(4/4)

● In the 1900’s specialists programmed “business machines" (note IBM’s original name) by actually changing hardware’s wiringo advanced models used plug boards - try to debug that!

● 1946: J. Presper Eckert and John Mauchly at University of Pennsylvania built Electronic Numerical Integrator and Computer (ENIAC) – see http://ftp.arl.mil/mike/comphist/eniac-story.htmlo first electronic general purpose “automatic” computer, used for ballistics

and bomb calculationso 18,000 vacuum tubes, MTBF of 20 minutes!o still programmed by wiringo 5,000 adds/ subtracts/sec, 400 multiplies/sec, 35 divisions or square

roots/sec (10 digit numbers)o men wanted to build h/w, left less prestigious programming to the all-

female corps of programmers, called “computers”, a 19th century termo http://www.npr.org/blogs/alltechconsidered/2014/10/06/345799830/the-

forgotten-female-programmers-who-created-modern-tech6 of 24

Stored Program Computer Architecture● 1945: John von Neumann introduces seminal concept of “stored program”

o “it’s bits all the way down…” for both data and instructionso program can be stored in main memory and even treated as data

to be operated on –paved the way for modern computers

CPU

I/O Interface Memory

Address

Data

Control

Sy

ste

m B

us

es

Simplified Processor Architecture

● Simple instruction execution loopo use instruction register to fetch instruction stored

at that address in memory, increment instruction register, decode and execute instruction

o instruction typically is <op-code> <address>o instruction may update memory – even modify

stored program itself, e.g., for loops. Unsafe: use h/w looping w/ index registers

● von Neumann was a polymath: worked on atom and hydrogen bombs, co-invented “game theory”, computational biology, etc.

● CS15 Final Project Othello uses the minimax algorithm 7 of 24

Moore’s Law and the Shrinking Computer● Moore’s (1) “Law”: an observation that over the history of computing

hardware, number of transistors in a dense integrated circuit doubles approximately every two yearso fastest exponential in history

● Smaller feature size, greater density means shorter paths, faster signal propagation in microprocessors

● We benefit not just from microminiaturization of the CPU but also from great electromechanical engineering of peripheral devices (e.g., disk controllers, disks – 40MB was a big disk in the 60s! Dual Meta-4 mini had 32KB, 1MB disk)

● Today’s IBM zEC12 microprocessor (6 cores @5.5 Ghz) has about same computing power as 5,000 football fields worth of our IBM /360 mod 50s (.14MIPS) 50 years ago - mainframes still selling!

● See http://www.eweek.com/servers/slideshows/a-look-at-mainframe-history-as-ibm-system360-turns-50-cobol-turns-55.html/

● But are silicon chips hitting a limit?

● What’s next: biological computers? Quantum computers? 8 of 24 (1) Gordon Moore was the co-founder of Intel and the co-inventor of the integrated circuit, which led to microprocessors, etc.

Computers get Ever Faster, but do they get More “Powerful”?

● Computer is the only Universal Machine!● Yet theoretically only need 6 instructions for ANY algorithm!

o load accumulator (high-speed register) from memory addresso store accumulator to memory addresso subtract contents of memory address from accumulator, store result in accumulatoro jump to memory address (instruction) if accumulator < 0 (“conditional jump”)o read to accumulator from external input deviceo write from accumulator to external output device

● You can buildo add by subtracting negative numberso divide by repeated subtract, multiply by repeated addo If-then-else and loops with conditional jumpo output to printer by write into special memory location 9 of 24

Trade Offs in Power/Complexity of Instruction● Trade-offs

o complexity of instruction (how much it does)o speed of instruction executiono size of instruction set (and can compiler take advantage of them)

● Today’s computerso Complex Instruction Set Computer (CISC) > 500

• started with IBM mainframes in 50s and 60s, now “Intel architecture” dominates o Reduced Instruction Set Computers (RISC) 100 – 300 (simpler but faster instructions)

• major innovation and important in 80s and 90so Intel architecture has adapted best ideas from RISCo ARM architecture also designed in accordance w/ RISC; used in phones, tablets, etc.o emphasis today is on “multi-core” (multiple CPUs per chip) and low-power designso GPUs (Graphics Processing Units) are even more powerful, for games, but also for

data crunching, e.g., scientific simulation (weather prediction, protein folding…)

10 of 24

● Alan Turing (1912 – 1954) – logician, mathematician, first computer scientist● Designed code breaking machine to crack the German Enigma cypher during WWII● Formalized notions of algorithm, computer and mechanized computing in an era that was

very concerned with what was computable and what was not, mechanized mathematics, e.g., undecidability, halting problem, etc….Also started AI, Turing test

● Turing Machine as the simplest possible conceptual device to execute an arbitrary algorithm: device with a writable tape and a read/write head; the logic is in a table

● Table contains the “program” of “instructions” as a “state machine” – if in state i and read 1, do x, go to a next state, if read 0, do y, go to a next state. Simple actions:

1) move the head one square L or R

2) read/write current cell (empty or tally mark)

3) integers represented by equivalent number of tally marks● Universal Turing Machine that could simulate any other TM proof

that one could build a universal “programmable” computer. MIT’s AI guru Minsky showed a 43 state UTM!

● Committed suicide after being prosecuted and “treated” for being gay

Turing, Computability

11 of 24

First, Numeric Machine Language, Then Came Assembly Language (1/2)● 1949: John Mauchly develops Short Order Code

o first assembly languageo provided vehicle for higher-level languages to be developed

● Symbolic code that is 1:1 with machine code

o load accumulator with contents stored at address 4o program translates to machine code via table lookup of opcode, decimal to binary

conversion algoo assembler early example of treating a program as data!

opcode

LOAD 4 0001 0000 0000 0000 0100

memory address

12 of 24

First, Numeric Machine Language, Then Came Assembly Language (2/2)● Must be defined for each processor

o hard-wired for particular processor’s architectureo generated by compilers for higher-level languages

● Modern processors are very complicatedo so writing at assembly language level takes real skillo compilers can optimize code globally for high-level languages, using sophisticated

computation graphso programmers generally optimize code only locally

● Still used today when speed and size counto embedded computers, device drivers, gameso programmer must understand hardware well to use effectivelyo increasingly, C is used as a “machine-independent” assembly language

13 of 24

High-Level Languages● Attempt to make programming more intuitive

o closer to programmer’s concepts (high-level)o further from machine’s concepts (low-level)

● Symbolic code that is 1:N with machine codeo one high-level instruction may become tens or hundreds of machine code instructions

● Most importantly, machine independento avoided vendor lock-ino depended on compiler to translate high-level constructs to computer’s machine codeo thus allows one source program to be used on many target architectures

● Still trying to make languages higher levelo Java guarantees single compilation, same execution on multiple machines via byte

codes: write once, run everywhereo compile to byte code virtual machine; computer will have virtual machine interpreter

14 of 24

High-Level Languages: Important Dates (1/2)● 1957: John Backus et. al. at IBM develop FORTRAN language and compiler

o FORmula TRANslatoro still used today, mostly for scientific computing, highly optimized o for number crunching

● 1959: Committee on Data System Languages develops COBOL, • led by Rear Admiral Grace Hopper, one of first modern • programmers (Grace Hopper Celebration of Women in Computing)

o Common Business Oriented Language, “English-like”, support o for data recordso still tons of legacy code in banks, insurance companies, retail… (Y2K!)

● 1959: John McCarthy develops Lispo LISt Processingo seen as slow, so primarily used only for “AI” projectso Scheme is a modern Lisp-like “functional programming” language 15 of 24

High-Level Languages: Important Dates (2/2)

● 1960: ALGOL 60 standard publishedo ALGOrithm Languageo basis of most popular languages today

● 1964: John Kemeny and Thomas Kurtz at Dartmouth develop BASICo Beginners All-purpose Symbolic Instruction Codeo simple language, meant to be used by beginners

and non-professionals, efficient on microcomputerso was popularized by Microsoft’s Visual BASIC, now

being replaced by JavaScript

16 of 24

Structured Programming (1/2)● 1968: Edsgar Dijkstra writes landmark note: “GoTo Statement Considered

Harmful”o no predictability, can go anywhere in programo leads to spaghetti codeo can’t be understood by programmer or compiler

● New languages would have constructs for common one-in-one-out flows of control for controlled branchingo if/else-if and switch statementso while and for loopso gives sequential, predictable order to code, only controlled branches allowed

17 of 24

Structured Programming (2/2)● Brown’s AM101, AM40, CS11 (CS15 precursors) switched to new

style in late 60’so taught PL/I, then PL/C, using structured programming styleo then, even taught “structured assembly” based on positive experienceso switched to Pascal as a more modern versiono see, we have a rich history of experimentation!

● Too much commercial legacy code was spaghetti!

18 of 24

Next Generation High-Level Procedural Languages

● Emphasize task decomposition, no bundling of data and procedures in objects● 1964: Researchers at IBM develop PL/I

o Programming Language Io designed to synthesize best features of FORTRAN, COBOL, and Algol 60o failed as attempt to be the one general purpose programming language

● 1970: Niklaus Wirth develops Pascalo named for Blaise Pascal, to be educational language

● 1972: Dennis Ritchie at Bell Labs develops Co predecessor named Bo often called portable assembly languageo surpassed COBOL as most popular language

19 of 24

Even OOPLs are Relatively Old● 1967: Ole-Johan Dahl and Kristen Nygaard at Norwegian Computing Centre

develop Simula, SIMUlation Language and first OO programming language, classes

● 1972: Alan Kay, Adele Goldberg, et al. at Xerox PARC develop Smalltalk and the Windows metaphor/GUI

● 1972: Barbara Liskov at MIT develops CLU, with focus on ADT’s (next slide)● 1980: US Department of Defense develops Ada to combat plethora of languages

o ADT’s, Objects, Concurrency…

● 1983: Bjarne Stroustrup develops C++o OO extensions to popular C language -- named C++ as a play on the ++ operator

● 1995: James Gosling et. al. at Sun Microsystems develop Java, a cleaned-up, smaller dialect of C++o meant to be internet and embedded device programming languageo provide facilities for better reuse and safetyo some professionals avoid it because it is seen as inefficient (use C++ or C instead)o Microsoft’s C# is a powerful Java-ish competitor; also Python, Ruby-on-Railso JavaScript is NOT Java, and is only partially an OOP 20 of 24

Barbara Liskov’s Distinguished Lecture at Brown 11/06/14

• Biography: o member of the National Academy of Engineering and the National Academy of Sciences, charter

fellow of the National Academy of Inventors. o ACM Turing Award (the Nobel prize of CS), IEEE Von Neumann medal

• The Power of Abstractiono abstraction is at the center of much work in Computer Scienceo it encompasses finding the right interface for a system as well as finding an effective design for a

system implementationo furthermore, abstraction is the basis for program construction, allowing programs to be built in a

modular fashion.• What I learned from her talk

o ADTs need to describe the behavior, not just the method signatures, return types, error conditions…i.e., the “pragmatics”

o Java and other OOPLs can only provide support for enforcing that subtypes can do what supertypes can – they can’t enforce the idea that subtypes should also exhibit the same behavior

21 of 24

Who “owns” ADT’s?• November 7, 2014• Computer Scientists Ask Supreme Court to Rule APIs Can’t Be Copyrighted• EFF Files Amicus Brief on Behalf of Tech Pioneers in Oracle v. Google Court Battle• San Francisco - The Electronic Frontier Foundation (EFF) filed a brief with the

Supreme Court of the United States today, arguing on behalf of 77 computer scientists that the justices should review a disastrous appellate court decision finding that application programming interfaces (APIs) are copyrightable. That decision, handed down by the U.S. Court of Appeals for the Federal Circuit in May, up-ended decades of settled legal precedent and industry practice.

• Signatories to the brief include five Turing Award winners, four National Medal of Technology winners, and numerous fellows of the Association for Computing Machinery, IEEE, and the American Academy of Arts and Sciences. The list also includes designers of computer systems and programming languages such as AppleScript, AWK, C++, Haskell, IBM S/360, Java, JavaScript, Lotus 1-2-3, MS-DOS, Python, Scala, SmallTalk, TCP/IP, Unix, and Wiki.

22 of 24

Software Engineering (1/2)● 1968: NATO Science Committee addresses “software crisis”

o hardware progressing rapidly, but not softwareo software development seen mostly as craft with too much trial-and-erroro too little has changed – e.g., ACA website debacle! o coins term software engineering

● 1975: Frederick Brooks writes landmark book “The Mythical Man-Month”o says “no silver bullet,” software is inherently complexo complexity can be ameliorated but cannot be cured by higher-level languageso adding people to late project delays it (“9 women can’t make baby in a month”)

● 1990s: Les Hatton develops “30-5-1” ruleo from study of real commercial programso discovered 30 bugs per 1000 lines untested code on average, then only 5 in well-

tested code, and 1 bug still remaining after code in productiono rule held regardless of language, probably still true today! 23 of 24

Microsoft just squashed a 19-year-old software bug. How did it go undetected so long?

● Tuesday, November 11th, Microsoft patched critical bug affecting Windowso bug could potentially allow hackers to remotely control users’ machines

● IBM researchers who found bug say it could have been around for two decadeso Spotting bugs in code can be difficult, even after extensive review

● “This isn't the first time major flaws have taken years to uncover. In 2010, a Google engineer uncovered a 17-year-old Windows bug affecting all 32-bit versions of the operating system and that could be used to hijack PCs. In September, another problem called "Shellshock" was discovered in a free software package built into some 70 percent of all devices connected to the Internet. It could have been introduced as long as 22 years ago, says Chet Ramey, the long-time maintainer of the code.”

Full article here: http://www.washingtonpost.com/blogs/the-switch/wp/2014/11/12/microsoft-just-squashed-a-19-year-old-software-bug-how-did-it-go-undetected-so-long/

23 of 24

Software Engineering (2/2)● Sophisticated development and testing methodologies

o CS17 and CS19 teach students to write tests that inform the implementation rather than write tests that are tailored to the implementation

o goal is to cover both general and edge cases

● Libraries of reusable componentso companies offer well-tested common componentso “plug-n-play” frameworks to connect trusted catalogue partso OO is a good paradigm to make this goal feasible – works well for GUI widgets and

large-scale components (e.g., “Enterprise JavaBeans”, QT Framework)

● CS32: modern software engineering using Java!● Note: new languages and software engineering technologies (frameworks,

IDEs…) still hot subjects, both in industry and in academeo e.g., Apple’s new Swift, positioned as successor to C and Objective-C, see

https://developer.apple.com/swift/23 of 24

Announcements

• Tetris help session in Salomon 101 at 5PM.• HW3 due Saturday at 5PM!• Tetris early handin 11/18; on time 11/20; late

11/22. Start working now!• Lecture on Thursday and next Tuesday will

be in Salomon 101• We sent out grade reports Sunday evening.

64/33