Object Oriented Design & Packages CSC 171 FALL 2001 LECTURE 13.

Slides:



Advertisements
Similar presentations
Chapter 4 The Von Neumann Model
Advertisements

Chapter 4 The Von Neumann Model
RAPTOR Syntax and Semantics By Lt Col Schorsch
Lecture 6 Programming the TMS320C6x Family of DSPs.
Data-Flow Analysis Framework Domain – What kind of solution is the analysis looking for? Ex. Variables have not yet been defined – Algorithm assigns a.
Designing Classes Chapter 8. Classes Collection of objects Objects are not actions Class names – Nouns Method names – Verbs What Makes a Good Class Represent.
The Object of Java Spring 2003 Wayne State College CSC 340 Lect. #1.
1 Sec (2.3) Program Execution. 2 In the CPU we have CU and ALU, in CU there are two special purpose registers: 1. Instruction Register 2. Program Counter.
Java Programming, 2E Introductory Concepts and Techniques Chapter 2 Creating a Java Application and Applet.
1 Machine Language Alex Ostrovsky. 2 Introduction Hierarchy of computer languages: 1. Application-Specific Language (Matlab compiler) 2. High-Level Programming.
Welcome to Computing Presentation slides modified by M. A. Papalaskari from “Java Software Solutions Foundations of Program Design (3 rd ed.)” by John.
Computer Science 210 Computer Organization The von Neumann Architecture.
CIS 644 Aug. 25, 1999 tour of Java. First … about the media lectures… we are experimenting with the media format please give feedback.
Lecture #30 Page 1 ECE 4110– Sequential Logic Design Lecture #30 Agenda 1.von Neumann Stored Program Computer Architecture Announcements 1.N/A.
Chapter 4 The Von Neumann Model
CSC321 Making a Computer Binary number system → Boolean functions Boolean functions → Combinational circuits Combinational circuits → Sequential circuits.
Introduction to Computer Engineering CS/ECE 252, Fall 2009 Prof. Mark D. Hill Computer Sciences Department University of Wisconsin – Madison.
Computer Architecture And Organization UNIT-II General System Architecture.
Execution of an instruction
Intro MIPS Computer Organization I 1 September 2009 © McQuain, Feng & Ribbens The Stored Program Computer 1945: John von Neumann – Wrote a.
COMPUTER ORGANISATION I HIGHER STILL Computing Computer Systems Higher Marr College Computing Department 2002.
Exam Format  105 Total Points  25 Points Short Answer  20 Points Fill in the Blank  15 Points T/F  45 Points Multiple Choice  The above are approximations.
© 2006 Pearson Addison-Wesley. All rights reserved DrawingGizmo « constructor » DrawingGizmo() « update » void moveForward() void turnClockwise()
Von Neumann Model Computer Organization I 1 September 2009 © McQuain, Feng & Ribbens The Stored Program Computer 1945: John von Neumann –
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Creating a Java Application and Applet
Von Neumann Computers Article Authors: Rudolf Eigenman & David Lilja
CS 1308 Exam 2 Review. Exam Format 110 Total Points 24 Points Short Answer 28 Points Fill in the Blank 16 Points T/F 36 Points Multiple Choice The above.
Chapter 4 The Von Neumann Model
sample Chapter 10: The Stored Program Architecture.
Computer Organization Instructions Language of The Computer (MIPS) 2.
Digital Computer Concept and Practice Copyright ©2012 by Jaejin Lee Control Unit.
Representation of Data - Instructions Start of the lesson: Open this PowerPoint from the A451 page – Representation of Data/ Instructions How confident.
© 2004 Pearson Addison-Wesley. All rights reserved September 5, 2007 Packages & Random and Math Classes ComS 207: Programming I (in Java) Iowa State University,
Computer Organization and Architecture Lecture 1 : Introduction
The Stored Program Computer
Control Unit Lecture 6.
Chapter 4 The Von Neumann Model
Computer Design & Organization
Java Import Statement Copyright © Curt Hill
The Need for Specifications
Computer Science 210 Computer Organization
Chapter 1 Preliminaries.
Chapter 4 The Von Neumann Model
Introduction to Computer Engineering
Chapter 4 The Von Neumann Model
An Introduction to Visual Basic .NET and Program Design
The fetch-execute cycle
Chapter 4 The Von Neumann Model
Computer Science 210 Computer Organization
Intro to Architecture & Organization
Introduction to Computer Engineering
Mauchly and Eckert John W. Mauchly (1907–1980) and J. Presper Eckert (1919–1995 ) headed the ENIAC team at the Moore School of Engineering, University.
A primer on Computers and Programs
Computer Architecture
Chapter 4 The Von Neumann Model
MARIE: An Introduction to a Simple Computer
Packages & Random and Math Classes
The Stored Program Computer
The Von Neumann Machine
Chap 1. Getting Started Objectives
Chap 4. Programming Fundamentals
Information Representation: Machine Instructions
Introduction to Computer Engineering
Introduction to Computer Engineering
CS 1308 Exam 2 Review.
Introduction to Computer Engineering
Introduction to Computer Engineering
Sec (2.3) Program Execution.
Chapter 4 The Von Neumann Model
Presentation transcript:

Object Oriented Design & Packages CSC 171 FALL 2001 LECTURE 13

History: von Neumann Machines 30 June 1945: John von Neumann wrote the "First Draft of a Report on the EDVAC“ – Never got past draft stage – No co-authors ever named Set the stage for the architectural design of several generations of computers The architectural style became known as the "von Neumann architecture" Source of the concept of the "stored program" becomes a matter of controversy. Eckert and Mauchly claimed that they had those thoughts before von Neumann joined the U of Penn. Konrad Zuse clamed that he had those thoughts in the 1930's

von Neumann Architecture Dual usage of main memory to store both program instructions and data FETCH-DECODE-EXECUTE cycle – Fetch an instruction from memory – Decode the instruction Operation (OP-CODE) Operand (data portion – constant, memory loc, pointer) – Execute operation on operand – Increment program counter and repeat

Software Lifecycle

Waterfall Model with Iterative Feedback

Forward looking Iterative Waterfall Model

Programming by Contract Problem: – Class descriptions are often vague – Example: “I want you to write a ‘Drawingtool’ class for a graphics applet. It only moves forward, but it can change direction – draw or not draw.” One widely accepted solution is – Class specifications

Class specifications A Class Invariant Precondition/postcondition specifications for each method An optional modifies clause for each method

Class Invariant A collection of facts that are always true about class objects Example: a “DrawingTool” – Appears as an arrow within the DrawingCanvas window – Is either up, down, left, or write – Is either in drawing mode or in moving mode

The Precondition/Postcondition Contract IF The calling code ensures the precondition is true at the time it calls the method THEN The postcontion is guaranteed to be true at the time the method completes exectuion

Pre/Post conditions – Constructor public DrawingTool() Postconditions – A new DrawingTool object is created and placed in the center of the DrawingCanvas window – The object is set to drawing mode – The arrow for this object is pointing up – The DrawingTool arrow is colored Green

Pre/Post conditions – Updates Every non-constructor method has an implicit precondition: that the object is not null public turnClockwise() Postconditions – The object is rotated by 90 degrees clockwise from its previous direction

Pre/Post conditions – Updates public draw() Postconditions – The object is set to drawing mode – The DrawingTool arrow is colored Green public dontdraw() Postconditions – The object is set to moving mode – The DrawingTool arrow is colored Red

Pre/Post conditions – Updates public moveForward() Preconditions – A minimum of 20 pixels remain in front of the DrawingTool arrow before and edge of the DrawingCanvas window Postconditions – This DrawingTool object is moved in the arrow’s direction by 20 pixels from its previous location – If this object is in drawing mode, a line segment is drawn across the 20 pixel path just traversed

Good Class Specifications Precise Concise Sufficiently complete Accurate with respect to intended behavior

Packages java.swing java.awt. java.applet java.util java.lang java.io java.net Java provides tools to permit programmers to build their own packages

Package Declaration package identifier ; package identifier.identifier ; package identifier.identifier.identifier ; Etc....

Example 3 source files: package money; public class Euro { } package money; public class Dollar { } package money; public class Yen { } All in one directory

Directory Structure Before compile MoneyPackage – Dollar.java – Euro.java – Yen.java After compile MoneyPackage – Dollar.java – Euro.java – Yen.java – money Dollar.class Euro.class Yen.class

Using Packages import identifier ; import identifier.identifier ; import identifier.identifier.identifier ; import identifier.* ; Etc....

Accessing Packages WIN C:\autoexec.bat Set CLASSPATH =.;C:\MoneyPackage UNIX – C shell.login Setenv CLASSPATH.:/MoneyPackage UNIX – Korn shell.profile CLASSPATH=.:/MoneyPackage Export CLASSPATH

Using Package import identifier