CS 151: Object-Oriented Design December 5 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak www.cs.sjsu.edu/~mak.

Slides:



Advertisements
Similar presentations
CS 174: Web Programming April 28 Class Meeting
Advertisements

The Legendary IBM 1401 A Major Milestone in the History of Modern Computing 2009 Summer University Seminar 1 July 27, 2009 Department of Computer Science.
CS 185C/286: The History of Computing November 7 Class Meeting Department of Computer Science San Jose State University Fall 2011 Instructor: Ron Mak
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
CS 185C: The History of Computing August 24 Class Meeting Department of Computer Science San Jose State University Fall 2011 Instructor: Ron Mak
CS 146: Data Structures and Algorithms July 14 Class Meeting Department of Computer Science San Jose State University Summer 2015 Instructor: Ron Mak
CS 235: User Interface Design April 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
CS 157B: Database Management Systems II March 18 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron Mak.
CS 152: Programming Language Paradigms April 9 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak
CS 149: Operating Systems January 22 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
CS 151: Object-Oriented Design October 3 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
CS 235: User Interface Design November 3 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
Object Oriented Programming Lecture 8: Introduction to laboratorial exercise – part II, Introduction to GUI frames in Netbeans, Introduction to threads.
CS 46B: Introduction to Data Structures June 16 Class Meeting Department of Computer Science San Jose State University Summer 2015 Instructor: Ron Mak.
CS 174: Web Programming September 30 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
CS 235: User Interface Design September 22 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
CS 152: Programming Language Paradigms May 7 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak
CS 149: Operating Systems April 7 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
CS 151: Object-Oriented Design October 24 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
CS 151: Object-Oriented Design September 26 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
CS 153: Concepts of Compiler Design August 26 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
CS 151: Object-Oriented Design September 5 Class Meeting Department of Computer Science San Jose State University Spring 2013 Instructor: Ron Mak
CS 151: Object-Oriented Design September 12 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
CS 160: Software Engineering October 22 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
CS 153: Concepts of Compiler Design October 7 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
CS 151: Object-Oriented Design November 21 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
CS 152: Programming Language Paradigms January 27 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak.
CS 146: Data Structures and Algorithms July 14 Class Meeting Department of Computer Science San Jose State University Summer 2015 Instructor: Ron Mak
CS 151: Object-Oriented Design October 31 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
CS 151: Object-Oriented Design October 15 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
CS 174: Web Programming October 14 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
CMPE 226 Database Systems November 18 Class Meeting Department of Computer Engineering San Jose State University Fall 2015 Instructor: Ron Mak
Design Patterns David Talby. This Lecture Re-routing method calls Chain of Responsibility Coding partial algorithms Template Method The Singleton Pattern.
CS 160: Software Engineering December 10 Class Meeting Department of Computer Science San Jose State University Fall 2014 Instructor: Ron Mak
CS 151: Object-Oriented Design November 5 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
CS 152: Programming Language Paradigms April 30 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak.
CS 151: Object-Oriented Design October 1 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
CS 153: Concepts of Compiler Design November 18 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
CS 151: Object-Oriented Design October 29 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
CS 146: Data Structures and Algorithms June 11 Class Meeting Department of Computer Science San Jose State University Summer 2015 Instructor: Ron Mak
CS 235: User Interface Design April 28 Class Meeting Department of Computer Science San Jose State University Spring 2015 Instructor: Ron Mak
CS 46B: Introduction to Data Structures July 23 Class Meeting Department of Computer Science San Jose State University Summer 2015 Instructor: Ron Mak.
CS 151: Object-Oriented Design November 26 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
CS 174: Web Programming November 16 Class Meeting Department of Computer Science San Jose State University Fall 2015 Instructor: Ron Mak
CS 151: Object-Oriented Design November 19 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
CS 152: Programming Language Paradigms April 28 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak.
CS 154 Formal Languages and Computability April 19 Class Meeting Department of Computer Science San Jose State University Spring 2016 Instructor: Ron Mak.
CS 160 and CMPE/SE 131 Software Engineering May 12 Class Meeting Department of Computer Science Department of Computer Engineering San José State University.
CS 152: Programming Language Paradigms May 12 Class Meeting Department of Computer Science San Jose State University Spring 2014 Instructor: Ron Mak
CS 151: Object-Oriented Design December 3 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak
CS 153: Concepts of Compiler Design August 29 Class Meeting
CMPE 135: Object-Oriented Analysis and Design October 24 Class Meeting
CMPE 135: Object-Oriented Analysis and Design November 21 Class Meeting Department of Computer Engineering San Jose State University Fall 2017 Instructor:
CS 153: Concepts of Compiler Design November 28 Class Meeting
CS 153: Concepts of Compiler Design November 30 Class Meeting
CMPE Database Systems Exercise #1 Solutions
CMPE 152: Compiler Design August 23 Class Meeting
CMPE 135: Object-Oriented Analysis and Design December 6 Class Meeting
CMPE 135: Object-Oriented Analysis and Design November 29 Class Meeting Department of Computer Engineering San Jose State University Fall 2018 Instructor:
CMPE 152: Compiler Design December 6 Class Meeting
CMPE 152: Compiler Design November 29 Class Meeting
CMPE 135: Object-Oriented Analysis and Design November 29 Class Meeting Department of Computer Engineering San Jose State University Fall 2018 Instructor:
CMPE/SE 131 Software Engineering May 9 Class Meeting
CMPE 135: Object-Oriented Analysis and Design April 30 Class Meeting
CMPE 135 Object-Oriented Analysis and Design March 7 Class Meeting
CMPE 135: Object-Oriented Analysis and Design March 14 Class Meeting
CS 144 Advanced C++ Programming April 25 Class Meeting
CS 144 Advanced C++ Programming April 9 Class Meeting
CS 151: Object-Oriented Design October 8 Class Meeting
CMPE 152: Compiler Design May 2 Class Meeting
Presentation transcript:

CS 151: Object-Oriented Design December 5 Class Meeting Department of Computer Science San Jose State University Fall 2013 Instructor: Ron Mak

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 2 Animation Example: Merge Sort  Animate the merge sort algorithm.

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 3 Animation Example: Merge Sort, cont’d  Two threads The main thread for the GUI. The sorting thread.  Class Sorter implements the Runnable interface.  Method MergeSort.sort() takes two parameters: The Double array to be sorted A Comparator object Method compare() returns -1, 0, or +1 depending on whether object1 is less than, equal to, or greater than object2. _ interface Comparator { int compare(T object1, T object2); }

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 4 Animation Example: Merge Sort, cont’d  The run() method of class Sorter : public void run() { MergeSorter.sort(values, new Comparator () { public int compare(Double d1, Double d2) { panel.setValues(values, d1, d2); try { Thread.sleep(DELAY); } catch (InterruptedException exception) { Thread.currentThread().interrupt(); } return d1.compareTo(d2); } }); panel.setValues(values, null, null); } Update the display before each compare. Sleep Then compare Demo

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 5 Animation Challenge  Spawn (create and start) a thread for each merge. Do the merges in parallel! Will the sort be faster or slower?

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 6 Unofficial Field Trip  Computer History Museum in Mt. View  Saturday, December 7, 11:30 – closing time Special free admission. Schedule  11:30-12:00– PDP-1 plays Christmas carols  11:45-1:00– Live demonstration of the IBM 1401  1:00-1:30– Live demonstration of the Babbage Difference Engine  1:30-closing– Self-guided tours of the Revolution exhibits  3:00-3:30– Spacewar! demo on the PDP-1 by one of its authors Extra credit – A multiple-choice quiz based on the Revolution exhibits  The quiz will be distributed before you arrive at the museum.  Please enter your answers into Canvas. } three groups

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 7 Unofficial Field Trip, cont’d  Babbage Difference Engine, fully operational Hand-cranked mechanical computer. Computed polynomial functions. Designed by Charles Babbage in the early to mid 1800s.  Arguably the world’s first computer scientist, lived He wasn’t able to build it because he lost his funding.  Live demo at 1:00 PM  His plans survived and this working model was built. Includes a working printer!

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 8 Unofficial Field Trip, cont’d  The new Revolution exhibit is now open! Walk through a timeline of the First 2000 Years of Computing History. Historic computer systems, data processing equipment, and other artifacts. Small theater presentations. Atanasoff-Berry Computer Hollerith Census Machine

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 9 What was the PDP-1?  Commercial computer produced in 1959 by the Digital Equipment Corporation (DEC).  18-bit word size  4K words of memory Upgradable to 64K  2700 transistors  3000 diodes  Paper tape  CRT display Steve Russell, who programmed the original Spacewar! video game while at MIT in 1961.

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 10 What was the IBM 1401?  IBM 1401 computer, fully restored and operational A small transistor-based mainframe computer. Extremely popular with small businesses in the late 1950s through the mid 1960s  Maximum of 16K bytes of memory.  800 card/minute card reader (wire brushes).  600 line/minute line printer (impact).  6 magnetic tape drives, no disk drives Card Reader Punch 1407 Console 1401 CPU 729 Tape Drives 1403 Line Printer

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 11 What was Computing Like Before the 1401?  Data was stored in punched cards called “IBM cards” or “Hollerith cards” Named after Herman Hollerith.  80 columns per card, one character per column. Up to 12 punched holes per column.  Alphanumeric data, often grouped into fields. _

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 12 Data Processing  Data processing was all about punched cards.  My school compiler project: 3½ boxes of punched cards Each box = 2000 cards, 10 lbs.

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 13 Data Processing

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 14 Data Processing  Cards were punched manually at a keypunch machine. Or they were punched automatically by unit-record equipment under program control. _

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 15 The 1403 Line Printer  Each print line can contain up to 132 characters. Mechanically (impact) printed. No lasers!  Outstanding print quality. Horizontally straight lines of text.  How fast was the 1403 line printer? 600 lines per minute! Sample print quality.

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 16 The 1403 Print Mechanism  132 horizontal print hammers behind the paper, one per print column. Paper pulled upwards.  Inked ribbon in front of the paper.  Horizontally rotating print chain in front of the ribbon. The print chain contains type slugs of the characters.  As the desired character flies past a print column, the column's hammer fires to press the paper against the ribbon and the type slug. The print chain does not stop. The paper advances as soon as the entire line is printed.

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak Card Read Punch Stack of punched cards to be read Card hoppersBlank cards to be punched

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 18 How the 1402 Read Punched Cards (cont’d)  It’s all in the timing! One brush per card column. All 80 columns were read simultaneously. Cards were fed into the 1402 card hopper “9 edge face down”.  How fast was the 1402 card reader? Up to 800 cards per minute! _

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 19 IBM 729 Magnetic Tape Drive

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 20 Postmortem Reports  Due Monday, December 9 at 11:59 PM A few paragraphs.  Word document or just an message Individual and private.  What did you learn in this class?  What were your accomplishments on your project team?  How well did each of your teammates do? _

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 21 Final Exam  Thursday, December 12 in Science 311 7:15 – 9:30 AM  It will be similar to the midterm. Covers the entire semester. _

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 22 Review for the Final Exam  Are you a better programmer today than you were at the start of the semester?  What makes you a better programmer? It’s more than just writing programs that work.  Although that’s important! Requirements  Functional  Non-functional Documentation  UML diagrams  Use cases  CRC cards Good design  Reliable  Robust  Flexible  Maintainable _

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 23 Review for the Final Exam, cont’d  How do the following make you a better programmer? Loose coupling Encapsulation Coherency Consistency Programming to the interface Design patterns  factory, strategy, iterator, observer, composite, decorator, template Dynamic class loading _

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 24 Review for the Final Exam, cont’d  Understand how each of the following contributes to better design: Frameworks Generic types Interfaces Inheritance Polymorphism Abstract classes Type inquiry Reflection Metadata descriptor classes _

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 25 Review for the Final Exam, cont’d  Design patterns Know when to use when designing a program. Recognize their use when reading a program.  Graphical User Interface (GUI) programming with Swing Event handlers Frames, panels, buttons, text fields, menus, etc. Layout managers Inversion of control  Collections framework Interfaces Classes Ability to create your own collection class

SJSU Dept. of Computer Science Fall 2013: December 5 CS 151: Object-Oriented Design © R. Mak 26 Review for the Final Exam, cont’d  Multithreading The Runnable interface The run() method Synchronization  race conditions  locks  lock conditions  synchronized methods Thread-safe code  Your Rock-Paper-Scissors project. _