J. P. Cohoon and J. W. Davidson © 1999 McGraw-Hill, Inc. Introduction to Programming and Object-Oriented Design Basics of machine, software, and program.

Slides:



Advertisements
Similar presentations
Basic Computer Hardware and Software.
Advertisements

Fundamentals and a Brief History of Computer Systems.
Hardware Programming. COMP102 Prog. Fundamentals I: Hardware / Slide 2 l Four components of a computer system: n CPU - central processing unit –Makes.
Introduction to Computer Systems
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Sixth Edition by Tony Gaddis, Judy Walters,
©TheMcGraw-Hill Companies, Inc. Permission required for reproduction or display. COMPSCI 125 Introduction to Computer Science I.
Introduction to C++ Programming CS 117 Section 2 and KNET Sections Spring 2001 MWF 1:40-2:30.
Visual Basic Introduction IDS 306 from Shelly, Cashman & Repede Microsoft Visual Basic 5: Complete Concepts and Techniques.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Topic 1: Introduction to Computers and Programming
Basics Machine, software, and program design JPC and JWD © 2002 McGraw-Hill, Inc.
Starting Out with C++: Early Objects 5/e © 2006 Pearson Education. All Rights Reserved Starting Out with C++: Early Objects 5 th Edition Chapter 1 Introduction.
V Material obtained from summer workshop in Guildford County.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Introduction to Computer Administration Introduction.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
What is a Computer?  A computer is a device capable of performing computations and making logical decisions. It is a device for solving problems.  Some.
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
CS 161 INTRO TO PROGRAMMING I Dr. Blaise W. Liffick Fall
Why Program? Computer – programmable machine designed to follow instructions Program – instructions in computer memory to make it do something Programmer.
Chapter Introduction to Computers and Programming 1.
Introduction to Programming Dr Masitah Ghazali Programming Techniques I SCJ1013.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
Introduction to Computers, Problem Solving, and Programming Chapter 1.
Chapter 1 An Overview of Computers and Programming Languages.
Topics Introduction Hardware and Software How Computers Store Data
Liang, Introduction to Java Programming, Ninth Edition, (c) 2013 Pearson Education, Inc. All rights reserved. 1 Chapter 1 Introduction to Computer Science.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Chapter 1: Introduction to Computers and Programming.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
Computer Systems Organization CS 1428 Foundations of Computer Science.
Introduction to Computers, Problem Solving, and Programming Chapter 1.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
CE Operating Systems Lecture 3 Overview of OS functions and structure.
Computer Architecture
Liang, Introduction to C++ Programming, (c) Chapter 1 Introduction to Computers, Programs, and C++
Editors And Debugging Systems Other System Software Text Editors Interactive Debugging Systems UNIT 5 S.Sharmili Priyadarsini.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
ELEMENTS OF A COMPUTER SYSTEM HARDWARE SOFTWARE PEOPLEWARE DATA.
Hardware and Software Programming. COMP104 Lecture 2 / Slide 2 Hardware and Software l Why should we bother with hardware, while we are having a programming.
1 Software. 2 What is software ► Software is the term that we use for all the programs and data on a computer system. ► Two types of software ► Program.
Looking Inside the Computer System
Chapter 1 : Overview of Computer and Programming By Suraya Alias
Copyright 2003 Scott/Jones Publishing Standard Version of Starting Out with C++, 4th Edition Chapter 1 Introduction to Computers and Programming.
A.Abhari CPS1251 Topic 1: Introduction to Computers Computer Hardware Computer components Connecting Computers Computer Software Operating System (OS)
Brief Version of Starting Out with C++ Chapter 1 Introduction to Computers and Programming.
Basic Computer Hardware and Software.
Chapter 1 An Overview of Computers and Programming Languages.
Hello world !!! ASCII representation of hello.c.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Chapter 1 Looking Inside the Computer System.
By Kundang K Juman Hardware & Software. COMP102 Prog. Fundamentals I: Software / Slide 2 l Four components of a computer system: n CPU - central processing.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
Introduction to Computing Systems
BASIC PROGRAMMING C SCP1103 (02)
Chapter 1: An Overview of Computers and Programming Languages
BASIC PROGRAMMING C SCP1103 (02)
COMPUTER ORGANIZATION & ASSEMBLY LANGUAGE
Basic Computer Hardware & Software
C++ Programming: From Problem Analysis to Program Design
Basic Computer Hardware and Software.
UNIV 103 CS Majors Seminar Dr. Blaise W. Liffick Fall 2017.
Computer Science I CSC 135.
Topics Introduction Hardware and Software How Computers Store Data
Hardware & Software Programming. COMP102 Prog. Fundamentals I: Software / Slide 2 l Four components of a computer system: n CPU - central processing unit.
National Diploma in Computer Studies
Introduction to Computer Programming
Introduction to Computer Systems
Presentation transcript:

J. P. Cohoon and J. W. Davidson © 1999 McGraw-Hill, Inc. Introduction to Programming and Object-Oriented Design Basics of machine, software, and program design

Ch 1 / Foil 2 l Every computer is organized roughly into four parts n CPU - central processing unit –Where decisions are made, computations are performed, and input/output requests are delegated n Memory –Stores information being processed by the CPU n Input devices –Allows people to supply information to computers n Output devices –Allows people to receive information from computers Computer Organization

Ch 1 / Foil 3 Computer Organization

Ch 1 / Foil 4 CPU l “Brains” of the computer n Arithmetic calculations are performed using the Arithmetic/Logical Unit or ALU n Control unit decodes and executes instructions l Arithmetic operations are performed using binary number system

Ch 1 / Foil 5 CPU l Fundamental building block is a switch n Switches are made from ultrasmall transistors l Example -- Pentium II

Ch 1 / Foil 6 l The individual digits of a binary number are referred to as bits n Each bit represents a power of two l Examples = = = = 2 Binary Arithmetic Binary addition Equivalent decimal addition

Ch 1 / Foil 7 Binary Arithmetic 5 × 3 15 Equivalent decimal multiplication 0101 × Binary multiplication

Ch 1 / Foil 8 l Convention for handling signed numbers in binary representation The leading bit is a sign bit –Binary number with leading 0 is positive –Binary number with leading 1 is negative l Magnitude of positive numbers is just the binary representation l Magnitude of negative numbers is found by performing the two’s complement n Complement the bits –Replace all the 1's with 0's, and all the 0's with 1's n Add one to the complemented number l Carry in most significant bit position is thrown away when performing arithmetic Two’s Complement

Ch 1 / Foil 9 Two's Complement Example l Performing two's complement on the decimal 7 to get -7 n Using a five-bit representation 7 = Convert to binary Complement the bits Add 1 to the complement Is -7 in two's complement

Ch 1 / Foil 10 Two's Complement Arithmetic l Computing using a two's complement representation with five-bit numbers = 8 + (-7) = Two's complement of Two's complement of Add 8 and Is the five-bit result Throw away the high-order carry as we are using a five bit representation

Ch 1 / Foil 11 Control Unit l The fetch/execute cycle is the steps the CPU takes to execute an instruction l Performing the action specified by an instruction is known as “executing the instruction” l The program counter (PC) holds the memory address of the next instruction

Ch 1 / Foil 12 Input and Output Devices l Accessories that allow computer to perform specific tasks Receiving information for processing Return the results of processing Store information l Common input and output devices SpeakersMouse Scanner PrinterJoystickCD-ROM KeyboardMicrophone l Some devices are capable of both input and output Floppy drive Hard drive Magnetic tape units

Ch 1 / Foil 13 Monitor l Display device l Also known as CRT (cathode ray tube) l Operates like a television l Controlled by an output device called a “graphics card”

Ch 1 / Foil 14 Monitor and Card Characteristics l Refresh rate n How fast image is updated on the screen l Resolution n Displayable area –Measured in dots per inch, dots are often referred to as pixels (short for picture element) n Standard resolution is 640 by 480 n Some cards support resolution up to 1280 by 1024 l Number of colors supported

Ch 1 / Foil 15 l Application software n Programs designed to perform specific tasks that are transparent to the user l System software n Programs that support the execution and development of other programs n Two major types –Operating systems –Translation systems Software

Ch 1 / Foil 16 Application Software l Application software is the software that has made using computers indispensable and popular l Common application software Word processors Desktop publishing programs Spreadsheets Presentation managers Drawing programs Learning how to develop application software is our focus

Ch 1 / Foil 17 l Controls and manages the computing resources l Important services that an operating system provides n File system –Directories, folders, files n Commands that allow for manipulation of the file system –Sort, delete, copy n Ability to perform input and output on a variety of devices n Management of the running systems l Examples n MSDOS ®, Windows ®, UNIX ® Operating System

Ch 1 / Foil 18 Translation System l Set of programs used to develop software l A key component of a translation system is a translator l Types of translators Compiler Converts from one language to another Linker Combines resources l Examples n Borland C++ ®, Microsoft Visual C++ ®, g++, Code Warrior ® –Performs compilation, linking, and other activities.

Ch 1 / Foil 19 Software Development l Major activities Editing Compiling Linking with precompiled files –Object files –Library modules Loading and executing Viewing the behavior of the program

Ch 1 / Foil 20 Software Development Cycle

Ch 1 / Foil 21 IDEs l Integrated Development Environments or IDEs n Translation systems that support the entire software development cycle –E.g., Borland, MS Visual C++, Code Warrior l Combine all of the capabilities that a programmer would want handy while developing software Editor Compiler Linker Loader Debugger Viewer

Ch 1 / Foil 22 Engineering Software l Software engineering n Area of computer science concerned with building large software systems l Challenge n Tremendous advances in hardware have not been accompanied by comparable advances in software

Ch 1 / Foil 23 Complexity Trade-off l System complexity tends to grow as the system becomes more user friendly

Ch 1 / Foil 24 Software Engineering Goals l Reliability n An unreliable life-critical system can be fatal l Understandability n Future development becomes very difficult if software is hard to understand l Cost Effectiveness n Cost to develop and maintain should not exceed profit l Adaptability n System that is adaptive is easier to alter and expand l Reusability n Improves reliability and maintainability, and reduces development costs

Ch 1 / Foil 25 Software Engineering Principles l Abstraction n Extract the relevant properties of an object while ignoring inessential details l Encapsulation n Breaking down an object into parts, hiding and protecting its essential information, and supplying an interface to modify the information in a controlled and useful manner l Modularity n Dividing an object into smaller pieces or modules such that the object is easier to understand and manipulate l Hierarchy n Ranking or ordering of objects based on some relationship between them

Ch 1 / Foil 26 l Process of extracting only the relevant properties of an object l Extracted properties define a view of the object l Example Car dealer views a car from selling features standpoint –E.g., price, length of warranty, color, optional equipment Mechanic views a car from systems maintenance standpoint –E.g., type of oil, size of the oil filter, type of spark plugs Abstraction

Ch 1 / Foil 27 Encapsulation l Breaking down an object into parts, hiding and protecting its essential information, and supplying an interface to modify the information in a controlled and useful manner l By hiding the information its representation and content can be changed without affecting other parts of the system l Example - car radio n Interface consists of the controls and types of connectors for connecting the radio to the car n The details of how it works is hidden n To install and use a radio, we do not need to know anything about the radio’s electrical system

Ch 1 / Foil 28 Modularity l Dividing an object into smaller pieces or modules such that the modules hold useful information and the object is easier to understand and manipulate l Most complex systems are modular l Example - Automobile can be decomposed into subsystems Cooling system –Radiator –Thermostat –Water pump n Ignition system –Battery –Starter –Spark plugs

Ch 1 / Foil 29 Hierarchy l Ranking or ordering of objects based on some relationship between them l Hierarchies help us understand complex systems n Example - a company hierarchy helps employees understand the company and their positions within it l For complex systems, a useful way of ordering similar abstractions is from least general to most general n Scientists use this technique to identify and classify species l Hierarchical ordering based on natural relationships is called a taxonomy

Ch 1 / Foil 30 Northern Timber Wolf Taxonomy Kingdom Animalia Subkingdom Metaoza Phylum Chordata Subphylum Vertabrata Superclass Tetrapoda Class Mammalia Subclass Theria Infraclass Eutheria Cohort Ferungulata Superorder Ferae Order Carnivora Suborder Fissipeda Superfamily Canoidea Family Caninae Subfamily Caninae Genus Canis Subspecies Canis lupus occidentalis (Northern Timber Wolf)

Ch 1 / Foil 31 OO Design and Programming l Object-oriented (OO) design and programming is a methodology that supports good software engineering l Object-oriented design promotes thinking about software in a way that models the way we think and interact with the real world l Example - watching television n The remote is a physical object with properties –Weight, size, can send messages to the television n The television is also a physical object with various properties

Ch 1 / Foil 32 Objects l An object is almost anything that can be attributed with the following characteristics Name Properties The ability to act upon receiving a message –Basic message types l Directive to perform an action l Request to change one of its properties

Ch 1 / Foil 33 Object-Oriented Programming l Example n Sketch the design of a simple computer game called Bug Hunt –Goal of game is to eliminate the bugs on the screen n Features of game –A moving bug is displayed in a window on the screen –The bug changes directions randomly –A bug is eliminated by “swatting” it several times –If a bug is eliminated, a faster one pops up –If an attempted swat misses the bug, the game ends

Ch 1 / Foil 34 Object-Oriented Programming l First step n Determine the objects –Mouse –Window –Bug

Ch 1 / Foil 35 Bug Hunt l To implement Bug Hunt, a bug needs the following properties n Position in the window n A display image or picture n Current speed n Current direction n Strength (the number of swats it takes to eliminate the bug)

Ch 1 / Foil 36 Bug Hunt l A bug needs to handle the following messages n Draw n Move n Change direction n Hit n Kill n Is-pointed-at

Ch 1 / Foil 37

Ch 1 / Foil 38 Inheritance