Computer Programming Putting the machine under our command.

Slides:



Advertisements
Similar presentations
CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
Advertisements

EEE226 MICROPROCESSORBY DR. ZAINI ABDUL HALIM School of Electrical & Electronic Engineering USM.
Behind the Scenes: Building Applications
Programming System development life cycle Life cycle of a program
1 Copyright © 2012 Pearson Education, Inc. Publishing as Prentice Hall.
© 2007 Prentice-Hall, Inc. 1 Technology in Action.
1 Chapter 1 Introduction to Object-Oriented Programming.
The Analytical Engine Module 6 Program Translation.
1 Lecture 1  Getting ready to program  Hardware Model  Software Model  Programming Languages  The C Language  Software Engineering  Programming.
Computing Components 01/26/11. Announcements & Reminders Programs 1 due Friday, 9/2/11 What is my late policy? Proxy Codes for Labs  You should be able.
1 Copyright © 2010 Pearson Education, Inc. Publishing as Prentice Hall.
Copyright © 2006 by The McGraw-Hill Companies, Inc. All rights reserved. McGraw-Hill Technology Education Copyright © 2006 by The McGraw-Hill Companies,
SOFTWARE SYSTEMS SOFTWARE APPLICATIONS SOFTWARE PROGRAMMING LANGUAGES.
CPU Processor-on-a-chip.
CPU Describe the purpose of the CPU
The CPU The Central Presentation Unit Language Levels Fetch execute cycle Processor speed.
Computers Central Processor Unit. Basic Computer System MAIN MEMORY ALUCNTL..... BUS CONTROLLER Processor I/O moduleInterconnections BUS Memory.
Technology in Action Alan Evans Kendall Martin Mary Anne Poatsy Tenth Edition Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 1 Building Applications.
1 Chapter-01 Introduction to Computers and C++ Programming.
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
Technology in Action Alan Evans Kendall Martin Mary Anne Poatsy Eleventh Edition Copyright © 2015 Pearson Education, Inc.
BLOCK DIAGRAM OF COMPUTER
1 Technology in Action Chapter 7 Behind the Scenes: Software Programming.
Learning Objectives Data and Information Six Basic Operations Computer Operations Programs and Programming What is Programming? Types of Languages Levels.
Topics Introduction Hardware and Software How Computers Store Data
Technology in Action Chapter 10 Behind the Scenes: Software Programming Copyright © 2014 Pearson Education, Inc. Publishing as Prentice Hall.
COMPUTER PROGRAMMING Source: Computing Concepts (the I-series) by Haag, Cummings, and Rhea, McGraw-Hill/Irwin, 2002.
Technology in Focus: Under the Hood
Technology In Action Chapter 10 © 2006 Prentice-Hall, Inc.1 Technology In Action Chapter 10 Behind the Scenes: Software Programming Chapter 10 Behind the.
General Computer Science for Engineers CISC 106 Lecture 02 Dr. John Cavazos Computer and Information Sciences 09/03/2010.
Technology in Action Alan Evans Kendall Martin Mary Anne Poatsy Ninth Edition Copyright © 2013 Pearson Education, Inc. Publishing as Prentice Hall.
© 2009 Prentice-Hall, Inc Technology in Action Chapter 10 Behind the Scenes: Software Programming.
Levels of Architecture & Language CHAPTER 1 © copyright Bobby Hoggard / material may not be redistributed without permission.
COMPUTER PROGRAMS AND LANGUAGES Chapter 4. Developing a computer program Programs are a set (series) of instructions Programmers determine The instructions.
Copyright © 2012 Pearson Education, Inc. Publishing as Pearson Addison-Wesley C H A P T E R 1 Introduction to Computers and Programming.
Computer system overview1 The Effects of Computers Pervasive in all professions How have computers affected my life? How have computers affected my life?
What have mr aldred’s dirty clothes got to do with the cpu
Overview of Programming and Problem Solving Textbook Chapter 1 1.
Technology in Action Alan Evans Kendall Martin Mary Anne Poatsy Twelfth Edition Copyright © 2016 Pearson Education, Inc.0.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
INTRODUCTION TO COMPUTING CHAPTER NO. 04. Programming Languages Program Algorithms and Pseudo Code Properties and Advantages of Algorithms Flowchart (Symbols.
Basic of Programming Language Skill Area Computer System Computer Program Programming Language Programmer Translators.
The Central Processing Unit (CPU) and the Machine Cycle.
Chapter One An Introduction to Programming and Visual Basic.
Stored Programs In today’s lesson, we will look at: what we mean by a stored program computer how computers store and run programs what we mean by the.
Programming in C++ Dale/Weems/Headington Chapter 1 Overview of Programming and Problem Solving.
Copyright © 2011 Pearson Education, Inc. Publishing as Prentice Hall 1.
Programming and Languages Dept. of Computer and Information Science IUPUI.
HOW COMPUTERS WORK THE CPU & MEMORY. THE PARTS OF A COMPUTER.
The Processor & its components. The CPU The brain. Performs all major calculations. Controls and manages the operations of other components of the computer.
Chapter 11  Getting ready to program  Hardware Model  Software Model  Programming Languages  Facts about C++  Program Development Process  The Hello-world.
Lecture #1: Introduction to Algorithms and Problem Solving Dr. Hmood Al-Dossari King Saud University Department of Computer Science 6 February 2012.
©2013 Pearson Education, Inc. Upper Saddle River, NJ. All Rights Reserved. Introduction to Computers and Computing.
Lecture # 10 Processors Microcomputer Processors.
Riyadh Philanthropic Society For Science Prince Sultan College For Woman Dept. of Computer & Information Sciences CS 251 Introduction to Computer Organization.
CHAPTER 2 GC101 Program’s algorithm 1. COMMUNICATING WITH A COMPUTER  Programming languages bridge the gap between human thought processes and computer.
Technology in Action © 2008 Prentice-Hall, Inc..
The CPU, RISC and CISC Component 1.
Chapter 1: An Overview of Computers and Programming Languages
Lecture 1 Introduction Richard Gesick.
Developing Applications
Computer Programming.
Software Programming J. Holvikivi 2014.
Topics Introduction Hardware and Software How Computers Store Data
Chapter One: An Introduction to Programming and Visual Basic
Little Man Computer There’s a little man in the mailroom that follows each instruction to the letter but he can only follow one instruction at a time.
CS105 Introduction to Computer Concepts Intro to programming
Programming Logic and Design Eighth Edition
Presentation transcript:

Computer Programming Putting the machine under our command

Definition of a Program A collection of instructions that describe a task, or set of tasks, to be carried out by a computer

Types of Computer Programs Firmware Systems Software Applications Software

Programming Languages A programming language is an artificial language that can be used to control the behavior of a machine.

Early Computer Programming The first computers were programmed by changing the wiring

Programming Language Background John von Neumann - stored program Alan Turing - Turing Machine Alonzo Church - Lambda calculus

First Generation Languages Machine level code Binary Univac & IBM 701 Add reg 1 to reg 2 place results in reg

Second Generation Languages Assembly code Mnemonic code to represent instructions Move 61 to register named “al” mov al, 061

Third Generation Languages Use English-like terms Compiler to translate to machine level Fortran, ALGOL, COBOL early examples COMPUTE NET-PAY = GROSS-PAY - TOTAL-TAX

Fourth Generation Languages More oriented toward problem solving State the problem, don’t care how it is solved. Divided into categories SQL - Structured Query Language Select * from Employee where Last-Name = “Smith”

Fifth Generation Languages Set of constraints rather than steps to solve problems Heuristics Artificial Intelligence Prolog cat(tom) |- true

Program Development Life Cycle Step 5 Finishing the Project Step 4 Debugging Step 3 Coding Step 2 Making a Plan Step 1 Describing the Problem

Step 1 : Describing the Problem The problem statement is: The starting point of programming A description of tasks the program is to accomplish How the program will execute the tasks Created through interaction between the programmer and the user The program statement includes error handling and a testing plan

PROGRAM GOAL: To compute the total pay for a fixed number of hours worked at a parking garage. INPUTS: Number of Hours Worked a positive number OUTPUTS: Total Pay Earned a positive number PROCESS: The Total Pay Earned is computed as $7.32 per hour for the first eight hours worked each day. Any hours worked beyond the first eight are billed at $11.73 per hour. ERROR HANDLING: The input Number of Hours Worked must be a positive real number. If it is a negative number or other non-acceptable character, the program will force the user to re-enter the information. TESTING PLAN:INPUTOUTPUTNOTES 88*7.32Testing positive input 33*7.32Testing positive input 128* *11.73Testing overtime input –6–6Error message/ask user to re-enter value Handling error Parking Garage Example

Step 2: Developing an Algorithm Algorithm development: A set of specific, sequential steps that describe what the computer program must do Complex algorithms include decision points: Binary (yes/no) Loop (repeating actions) Visual tools used to track algorithm and decision points: Head off to cafe Buy textbook Go to accounting lecture YesNo Yes Wake Up Check wallet for $ Do I have > $80 Go get gas Did I get $80 from the ATM? Do I have my credit card? Go to the ATM for cash

Flowchart and Pseudocode Underlined words are information items that appear repeatedly in the algorithm. 1. Ask the user how many hours they worked today 2. If the number of hours worked < = 8, compute total pay without overtime otherwise, compute total pay with overtime pay 3. Print total pay Bold terms show actions that are common in programming, such as reading data, making decisions, printing, and so on. Flowchart Pseudocode

Step 3: Coding Coding is translating an algorithm into a programming language Generations of programming languages

Compilation Compilation is the process of converting code into machine language Compiler reads the source code and translates it into machine language After compilation, programmers have an executable program

Interpreter Interpreter translates source code into a line by line intermediate form Each line is executed before the next line is compiled Programmers do not have to wait for the entire program to be recompiled each time they make a change. Programmers can immediately see the results of changes as they are making them in the code.

Step 4: Debugging Running a program to find errors is known as debugging Sample inputs are used to determine runtime (logic) errors Debugger: Tool that helps programmers locate runtime errors

Step 5: Finishing the Project Users test the program (internal testing) Beta version released: Information collected about errors before final revision Software updates (service packs): Problems found after commercial release Documentation created: User manuals User training

Programming Languages Selecting the right language: Space available Speed required Organizational resources available Type of target application Visual Basic C / C++ Java HTML JavaScript VBScript ASP / JSP Flash / XML

The CPU: Processing Digital Information CPU is the brains of the computer Different types of CPUs Intel and AMD chips: Used in most Windows-based PCs Apple systems use different CPU design Differentiating CPUs Processing power Clock speed and cache

Instruction Set All commands that the CPU can execute Arithmetic Logic Data Control flow

Instruction Set Architecture CISC Complex Instruction Set Computer Many different instructions Intel - Windows RISC Reduced Instruction Set Computer Fewer instructions Motorola/Intel - Macintosh

The CPU Machine Cycle Fetch The program’s binary code is “fetched” from its temporary location in RAM and moved to the CPU Decode The program’s binary code is decoded into commands the CPU understands. Execute The ALU performs the calculations. Store The results are stored in the registers

The System Clock Located on the motherboard Controls the CPU’s processing cycles Clock cycle Pulse or tick Clock speed Number of pulses per second Measured in hertz (Hz)

The Control Unit Manages the switches inside the CPU Is programmed by CPU designers to remember the sequence of processing stages for that CPU Moves each switch to its correct setting (on or off) and then performs the work of that stage

The Arithmetic Logic Unit (ALU) Part of the CPU designed to perform mathematical operations (addition, subtraction, multiplication, division, etc.) Also performs logical OR, AND, and NOT operations Is fed data from the CPU registers Word size: Number of bits a computer can work with at a time

Cache Memory Small amount of memory located on the CPU chip or near it Stores recent or frequently used instructions and data Used for quick access by the CPU Different levels of cache

Software Horror Stories verify/horror.html