Presentation is loading. Please wait.

Presentation is loading. Please wait.

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.

Similar presentations


Presentation on theme: "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."— Presentation transcript:

1 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

2 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.

3 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); }

4 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

5 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?

6 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 http://www.computerhistory.org/  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

7 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 1791-1871. 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! http://www.computerhistory.org/babbage/

8 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

9 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.

10 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. 1402 Card Reader Punch 1407 Console 1401 CPU 729 Tape Drives 1403 Line Printer

11 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. _

12 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.

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

14 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. _

15 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.

16 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.

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

18 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! _

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

20 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 email 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? _

21 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. _

22 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 _

23 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 _

24 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 _

25 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

26 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. _


Download ppt "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."

Similar presentations


Ads by Google