DDC 1023 – Programming Technique

Slides:



Advertisements
Similar presentations
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Advertisements

Lecture 1: Overview of Computers & Programming
CHAPTER 1: AN OVERVIEW OF COMPUTERS AND LOGIC. Objectives 2  Understand computer components and operations  Describe the steps involved in the programming.
Starting Out with C++, 3 rd Edition 1 Chapter 1. Introduction to Computers and Programming.
Chapter 1 An Overview of Computers and Logic
CIS105 Chapter 1 Theory Review. Page 2 Hardware and Software are the two major components o any computer system Hardware is the set of physical devices.
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,
An Overview of Computers and Logic
An Overview of Programming Logic and Design
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages C++ Programming:
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
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.
Programming Logic and Design Fourth Edition, Introductory
An Overview of Computers and Programming
Computers & Logic An Overview. Hardware Hardware is the equipment, or the devices, associated with a computer. For a computer to be useful, however, it.
CS102 Introduction to Computer Programming
Computer Programming-1 CSC 111 Chapter 1 : Introduction.
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Programming Logic and Design Fifth Edition, Comprehensive
Alternate Version of STARTING OUT WITH C++ 4 th Edition Chapter 1 Introduction to Computers and Programming.
Chapter Introduction to Computers and Programming 1.
CSC 125 Introduction to C++ Programming Chapter 1 Introduction to Computers and Programming.
An Overview of Computers and Logic
1 CSC103: Introduction to Computer and Programming Lecture No 2.
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 © 2011 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Seventh Edition by Tony Gaddis, Judy.
C++ Programming: From Problem Analysis to Program Design, Third Edition Chapter 1: An Overview of Computers and Programming Languages.
P ROGRAMMING L OGIC AND D ESIGN S IXTH E DITION Chapter 1 An Overview of Computers and Programming.
An Object-Oriented Approach to Programming Logic and Design Chapter 1 An Overview of Computers and Logic.
CHAPTER 1 INTRODUCTION 1 st Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
CHAPTER 1 INTRODUCTION 1 st semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
CHAPTER 1 INTRODUCTION 2 nd Semester H King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1.
Chapter 1 Computers, Compilers, & Unix. Overview u Computer hardware u Unix u Computer Languages u Compilers.
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)
Programming Logic and Design Seventh Edition
Ch 1 - Introduction to Computers and Programming Hardware Terminology Main Memory Auxiliary Memory Drives Writing Algorithms Using Pseudocode Programming.
Chapter 1 An Overview of Computers and Programming Languages.
Copyright © 2014, 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with C++ Early Objects Eighth Edition by Tony Gaddis,
C++ Programming: From Problem Analysis to Program Design, Fifth Edition Chapter 1: An Overview of Computers and Programming Languages.
Copyright © 2010 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Chapter 1: Introduction to Computers and Programming.
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
CHAPTER 1 OVERVIEW OF COMPUTER AND PROGRAMMING 1.1 Electronic Computer Then and Now 1.2 Computer Hardware 1.3 Computer Software 1.4 The Software Development.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
Chapter 1: Introduction to Computers and Programming
Chapter 1 Introduction 2nd Semester H
BASIC PROGRAMMING C SCP1103 (02)
Chapter 1: An Overview of Computers and Programming Languages
Chapter 1: An Overview of Computers and Programming Languages
BASIC PROGRAMMING C SCP1103 (02)
ICS103 Programming in C Lecture 1: Overview of Computers & Programming
Chapter 1. Introduction to Computers and Programming
Chapter 1: An Overview of Computers and Programming Languages
C++ Programming: From Problem Analysis to Program Design
08/28/06 parts of the computer.
Chapter 1: Introduction to Computers and Programming
Topics Introduction Hardware and Software How Computers Store Data
Chapter 2- Visual Basic Schneider
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
Chapter 2- Visual Basic Schneider
King Saud University College Of Applied Studies and Community Services CSC 1101 Computer Programming-1 Done By: Asmal Alosaimi Edited By: Fatimah Alakeel.
ICS103 Programming in C 1: Overview of Computers And Programming
Programming Logic and Design Eighth Edition
08/28/06 parts of the computer.
Chapter 1: Introduction to Computers and Programming
Presentation transcript:

DDC 1023 – Programming Technique REV00 DDC 1023 – Programming Technique Main Reference Hanly and Koffman, Problem Solving and Program Design in C, Fifth Edition, Addison Wesley Reference Joyce Farrell Thomson, Programming Logic and Design, Fifth Edition DDC1023 PROGRAMMING METHODOLOGY

Chapter 1: Overview of Computers and Programming REV00 Chapter 1: Overview of Computers and Programming Objectives Understand computer components and operations Learn about the steps involved in the programming process Learn about the data hierarchy and file input Use flowchart symbols and pseudocode statements Use and name variables Use a sentinel, or dummy value, to end a program Manage large flowcharts Assign values to variables Recognize the proper format of assignment statements Describe data types Understand the evolution of programming techniques DDC1023 PROGRAMMING METHODOLOGY 2

Chapter 1: Computer Components and Operations REV00 Chapter 1: Computer Components and Operations 2 major components of computer system: Hardware Software Hardware: equipment, or devices Software: programs that contain instructions for the computer 4 major operations in a computer: Input Processing Output Storage DDC1023 PROGRAMMING METHODOLOGY 3

Chapter 1: Computer Components and Operations REV00 Chapter 1: Computer Components and Operations Input devices: allow data to enter the computer Mouse, keyboard, scanner Processing: working on the data Organizing data Checking data for accuracy Mathematical or other manipulations on data Central Processing Unit (CPU): hardware that performs the tasks DDC1023 PROGRAMMING METHODOLOGY 4

Chapter 1: Computer Components and Operations REV00 Chapter 1: Computer Components and Operations Output devices: provide data to the user Printer, monitor, speakers Programming language: special language containing instructions for the computer Visual Basic, Java, C#, C++, COBOL Syntax: rules governing word usage and punctuation in the language DDC1023 PROGRAMMING METHODOLOGY 5

Chapter 1: Computer Components and Operations REV00 Chapter 1: Computer Components and Operations Machine language: controls the computer’s on/off circuitry Compiler or interpreter: software that translates programming languages to machine language Program must be free of syntax errors to be run, or executed, on a computer To function properly, the logic must be correct DDC1023 PROGRAMMING METHODOLOGY 6

Chapter 1: Computer Components and Operations REV00 Chapter 1: Computer Components and Operations What is wrong with this logic for making a cake? Stir Add two eggs Bake at 350 degrees for 45 minutes Add three cups of flour DDC1023 PROGRAMMING METHODOLOGY 7

Chapter 1: Computer Components and Operations REV00 Chapter 1: Computer Components and Operations Logic errors, or semantic errors, are more difficult to locate than syntax errors Logic for multiplying a number by 2 (includes input, processing, and output statements) Get input number. Compute calculated answer as inputNumber times 2. Print calculatedAnswer. DDC1023 PROGRAMMING METHODOLOGY 8

Chapter 1: Computer Components and Operations REV00 Chapter 1: Computer Components and Operations 2 storage categories: internal external DDC1023 PROGRAMMING METHODOLOGY 9

Chapter 1: Computer Components and Operations REV00 Chapter 1: Computer Components and Operations Internal storage: Main memory, random access memory (RAM) Located inside the computer system Volatile: contents are lost when power goes down External storage: Persistent: contents are relatively permanent Floppy drive, hard drive, flash media, magnetic tape Located outside the computer system Non-volatile: contents remain eventhough power goes down DDC1023 PROGRAMMING METHODOLOGY 10

Chapter 1: Steps Involved in the Programming Process REV00 Chapter 1: Steps Involved in the Programming Process 6 programming phases: Understand the problem Plan the logic Code the program Use software to translate the program to machine language Test the program Put the program into production DDC1023 PROGRAMMING METHODOLOGY 11

Chapter 1: Steps Involved in the Programming Process REV00 Chapter 1: Steps Involved in the Programming Process Understanding the Problem May be the most difficult phase Users may not be able to articulate their needs well User needs may be changing frequently Programmers may have to learn the user’s functional job tasks Failure to understand the problem is the major cause of most project failures DDC1023 PROGRAMMING METHODOLOGY 12

Chapter 1: Steps Involved in the Programming Process REV00 Chapter 1: Steps Involved in the Programming Process Planning the Logic Plan the steps that the program will take Use tools such as flowcharts and pseudocode Flowchart: a pictorial representation of the logic steps Pseudocode: Natural language representation of the logic Walk through the logic before coding by desk-checking the logic DDC1023 PROGRAMMING METHODOLOGY 13

Chapter 1: Steps Involved in the Programming Process REV00 Chapter 1: Steps Involved in the Programming Process Coding the Program Select the programming language Some languages more efficient for certain tasks All languages handle input, arithmetic processing, output, other standard functions Logic can be executed in any number of languages Write the instructions Planning generally more difficult than coding DDC1023 PROGRAMMING METHODOLOGY 14

Chapter 1: Steps Involved in the Programming Process REV00 Chapter 1: Steps Involved in the Programming Process Using Software to Translate the Program into Machine Language Programmers write instructions in high-level languages that resemble a natural language Compilers or interpreters change the programs into a low-level machine language that can be executed Syntax errors are identified by the compiler or interpreter DDC1023 PROGRAMMING METHODOLOGY

Chapter 1: Steps Involved in the Programming Process REV00 Chapter 1: Steps Involved in the Programming Process Using Software to Translate the Program into Machine Language Creating an executable program DDC1023 PROGRAMMING METHODOLOGY 16

Chapter 1: Steps Involved in the Programming Process REV00 Chapter 1: Steps Involved in the Programming Process Testing the Program Execute it with sample data and check results Identify logic errors and correct them Choose test data carefully to exercise all branches of the logic DDC1023 PROGRAMMING METHODOLOGY 17

Chapter 1: Steps Involved in the Programming Process REV00 Chapter 1: Steps Involved in the Programming Process Putting the Program into Production Might mean simply running the program once Process might take months if program is used on regular basis or is part of larger development Train data-entry people and users Change existing data Conversion: entire set of actions organization must take to switch over to new program(s) DDC1023 PROGRAMMING METHODOLOGY 18

Chapter 1: Steps Involved in the Programming Process REV00 Chapter 1: Steps Involved in the Programming Process Software Development Method 1 Planning 2 Analysis Identify data objects Goal to model properties Determine Input / Output data Constraints on the problem 3 Design Decompose into smaller problems Top-down design (divide and conquer) Develop algorithm (Desk check) 4 Implementation Writing the algorithm 5 Testing Verify the program meets requirements System and Unit test 6 Maintaining Maintain the system DDC1023 PROGRAMMING METHODOLOGY

Chapter 1: Interactive Input REV00 Chapter 1: Interactive Input Prompt: message displayed on a monitor Asks the user for a response Command prompt: location to type entries to communicate with the operating system Graphical User Interface (GUI): allows users to interact with a program in a graphical environment DDC1023 PROGRAMMING METHODOLOGY

Chapter 1: Interactive Input REV00 Chapter 1: Interactive Input A prompt, response, and output in a command line environment DDC1023 PROGRAMMING METHODOLOGY

Chapter 1: Interactive Input REV00 Chapter 1: Interactive Input A prompt, response, and output in a GUI environment DDC1023 PROGRAMMING METHODOLOGY

Chapter 1: Flowchart Symbols and Pseudocode Statements REV00 Chapter 1: Flowchart Symbols and Pseudocode Statements Input symbol Processing symbol Output symbol DDC1023 PROGRAMMING METHODOLOGY 23

Chapter 1: Flowchart Symbols and Pseudocode Statements REV00 Chapter 1: Flowchart Symbols and Pseudocode Statements Flowlines: Connect the steps Show the sequence of statements Have arrows to show the direction Terminal symbol (start/stop symbol): Shows the start and end points of the statements Lozenge shape DDC1023 PROGRAMMING METHODOLOGY 24

Chapter 1: Flowchart Symbols and Pseudocode Statements REV00 Chapter 1: Flowchart Symbols and Pseudocode Statements Flowchart and pseudocode of program that doubles a number DDC1023 PROGRAMMING METHODOLOGY 25

Chapter 1: Flowchart Symbols and Pseudocode Statements REV00 Chapter 1: Flowchart Symbols and Pseudocode Statements Inefficient pseudocode for program that doubles 10,000 numbers DDC1023 PROGRAMMING METHODOLOGY 26

Chapter 1: Flowchart Symbols and Pseudocode Statements REV00 Chapter 1: Flowchart Symbols and Pseudocode Statements Flowchart of infinite number-doubling program DDC1023 PROGRAMMING METHODOLOGY 27

DDC1023 PROGRAMMING METHODOLOGY REV00 Chapter 1: Summary 4 major computer operations: Input Processing Output Storage 6 programming phases: Understand the problem Plan the logic Code the program Translate the program to machine language Test the program Deploy the program DDC1023 PROGRAMMING METHODOLOGY 28

DDC1023 PROGRAMMING METHODOLOGY REV00 Chapter 1: Summary Software Development Method Planning Analysis Design Implementation Testing Maintaining DDC1023 PROGRAMMING METHODOLOGY