An Overview of Programming Logic and Design

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.
Chapter 1 - An Introduction to Computers and Problem Solving
Introduction to Programming
Chapter 2- Visual Basic Schneider1 Chapter 2 Problem Solving.
Mathematics for Computing Lecture 4: Algorithms and flowcharts Dr Andrew Purkiss-Trew Cancer Research UK
زبانهای برنامه سازی برنامه سازی پیشرفته ارائه دهنده دکتر سيد امين حسيني E.mail: Home page:
Chapter 1 An Overview of Computers and Logic
Copyright © 2008 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Starting Out with Programming Logic & Design First Edition by Tony Gaddis.
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.
An Overview of Computers and Logic
Programming Logic and Design, Introductory, Fourth Edition1 Understanding Computer Components and Operations (continued) A program must be free of syntax.
Chapter 1 Program Design
About the Presentations The presentations cover the objectives found in the opening of each chapter. All chapter objectives are listed in the beginning.
Programming Logic and Design Fourth Edition, Introductory
The Program Design Phases
An Overview of Computers and Programming
PRE-PROGRAMMING PHASE
Copyright © 2012 Pearson Education, Inc. Chapter 1: Introduction to Computers and Programming.
Programming Logic and Design Fifth Edition, Comprehensive
CHAPTER 4: INTRODUCTION TO COMPUTER ORGANIZATION AND PROGRAMMING DESIGN Lec. Ghader Kurdi.
The University of Texas – Pan American
An Overview of Computers and Logic
Introduction to Programming Lecture Number:. What is Programming Programming is to instruct the computer on what it has to do in a language that the computer.
Fortran 1- Basics Chapters 1-2 in your Fortran book.
CIS Computer Programming Logic
สาขาวิชาเทคโนโลยี สารสนเทศ คณะเทคโนโลยีสารสนเทศ และการสื่อสาร.
Created by, Author Name, School Name—State FLUENCY WITH INFORMATION TECNOLOGY Skills, Concepts, and Capabilities.
Chapter 1: Introduction to Computers and Programming.
Design the program Create a detailed description of program –Use charts or ordinary language (pseudocode) Identify algorithms needed –Algorithm: a step-by-step.
Computer Science 101 Introduction to Programming.
PROGRAMMING LANGUAGES Prof. Lani Cantonjos. PROGRAM - set of step-by-step instructions that tells or directs the computer what to do. PROGRAMMING LANGUAGE.
TMF1013 : Introduction To Computing Lecture 1 : Fundamental of Computer ComputerFoudamentals.
© 2006 Pearson Education 1 Obj: cont 1.3 and 1.4, to become familiar with identifiers and to understand how programming languages work HW: p.51 #1.8 –
Input, Output, and Processing
Copyright 1999 by Larry Fuhrer. Pascal Programming Getting Started...
S2008Final_part1.ppt CS11 Introduction to Programming Final Exam Part 1 S A computer is a mechanical or electrical device which stores, retrieves,
CS CS Computing for Business Instructor:David Tucker GTA:Batul Mirza.
© 2011 Pearson Addison-Wesley. All rights reserved. Addison Wesley is an imprint of Stewart Venit ~ Elizabeth Drake Developing a Program.
Problem Solving Techniques. Compiler n Is a computer program whose purpose is to take a description of a desired program coded in a programming language.
INTRODUCTION TO COMPUTING CHAPTER NO. 04. Programming Languages Program Algorithms and Pseudo Code Properties and Advantages of Algorithms Flowchart (Symbols.
Property of Jack Wilson, Cerritos College1 CIS Computer Programming Logic Programming Concepts Overview prepared by Jack Wilson Cerritos College.
P ROGRAMMING L OGIC AND D ESIGN S IXTH E DITION Chapter 1 An Overview of Computers and Programming.
ALGORITHMS THIRD YEAR BANHA UNIVERSITY FACULTY OF COMPUTERS AND INFORMATIC LECTURE ONE.
An Object-Oriented Approach to Programming Logic and Design Chapter 1 An Overview of Computers and Logic.
C++ Basics C++ is a high-level, general purpose, object-oriented programming language.
Flowcharts. Problem Solving Computer programs are written to solve problems or perform tasks Programmers translate the solutions or tasks into a language.
Introduction to Computer Application (IC) MH Room 517 Time : 7:00-9:30pm.
What is Programming? A program is a list of instructions that is executed by a computer to accomplish a particular task. Creating those instructions is.
1 Program Planning and Design Important stages before actual program is written.
8-1 Compilers Compiler A program that translates a high-level language program into machine code High-level languages provide a richer set of instructions.
Submitted To: Rutvi sarang Submitted By: Kushal Bhagat.
Programming Fundamentals. Overview of Previous Lecture Phases of C++ Environment Program statement Vs Preprocessor directive Whitespaces Comments.
Programming Logic and Design Seventh Edition
P ROGRAMMING L OGIC GWDA123 Sharon Kaitner, M.Ed. Winter 2015: Week 1.
Alexandria University Faculty of Science Computer Science Department Introduction to Programming C++
Victoria Ibarra Mat:  Generally, Computer hardware is divided into four main functional areas. These are:  Input devices Input devices  Output.
 Problem Analysis  Coding  Debugging  Testing.
Programming Logic and Design Seventh Edition Chapter 1 An Overview of Computers and Programming.
Programming Languages
CSCI-235 Micro-Computer Applications
DDC 1023 – Programming Technique
Chapter Topics 2.1 Designing a Program 2.2 Output, Input, and Variables 2.3 Variable Assignment and Calculations 2.4 Variable Declarations and Data Types.
Unit# 9: Computer Program Development
CSC128 FUNDAMENTALS OF COMPUTER PROBLEM SOLVING
Chapter 2- Visual Basic Schneider
Basic Concepts of Algorithm
Programming Logic and Design Eighth Edition
Presentation transcript:

An Overview of Programming Logic and Design Yong Choi School of Business CSU, Bakersfield

Objectives Learning about Programming Describe the steps involved in the programming process Understand how to use flowchart Use Sentinel value to end a program Use a connector symbol Describe data types

Learning about Programming Program is a set of instructions that you write to tell a computer what to do A computer language has rules governing its word usage and punctuation These rules are called syntax Every computer operates on circuitry that consists of millions of on-off (0 and 1) switches (binary system) Data from “Star trek” speaks the machine (binary) language.

Learning about programming Each programming language uses a piece of software to translate the specific programming language into the computer’s on-off circuitry language (machine language) The language translation software is called a compiler (or translator). All instructions converted at once from high-level language to machine language. Syntax errors are relatively easy to locate and correct

The instruction “ADD 2 and 5 and assign the result to variable y” written in different programming languages

Learning about programming For each program to work properly, you must give the instructions to the computer in a specific sequence, you must not leave any instructions out, and you must not add extraneous instructions By doing this, you are developing the logic of the computer program Once instructions have been inputted into the computer and translated into machine language, a program can be run or executed

Understanding the Programming Process A programmer’s job involves writing instructions, and can be broken down into six programming steps: Understand the problem (analysis and design 1) Plan the logic (analysis and design 2) Code the program Translate the program into machine language Test the program Put the program into production

Understand the Problem Professional computer programmers write programs to satisfy the needs of users Because programmers are providing a service to users, programmers must first understand what the users want Understanding of business problems Computer Science vs. MIS

Plan the Logic The heart of the programming process lies in planning the program’s logic During this phase of the programming process, the programmer plans the steps to the program, deciding what steps to include and how to order them The programmer doesn’t worry about the syntax of any particular language at this point, just about figuring out what sequence of events will lead from the available input to the desired output

RELATIVE COSTS OF REPAIRING ERRORS (BASED ON CONSULTANT REPORTS & TRADE LITERATURE) 1 2 3 4 5 COSTS ANALYSIS AND DESIGN PROGRAMMING CONVERSION POSTIMPLELENTATION

Code the Program Some very experienced programmers can successfully combine the logic planning and the actual instruction writing, or coding of the program, in one step This may work for planning and writing a very simple program, just as you can plan and write a postcard to a friend using one step The planning step is actually more difficult than the spelling and grammar rules you must learn

Translate the Program into Machine Language Languages like Java are available for programmers to use because someone has written a translator program (a compiler or interpreter) that changes the English-like high-level language in which the programmer writes into the low-level machine language that the computer understands

Test the Program A program that is free of syntax errors is not necessarily free of logical errors Once a program is free from syntax errors, the programmer can test it—that is, execute it with some sample data to see whether or not the results are logically correct Programs should be tested with many sets of data

Put the Program into Production Once the program is tested adequately, it is ready for the organization to use However, the process might take months if the program will be run on a regular basis, or if it is one of a large system of programs being developed Conversion, the entire set of actions an organization must take to switch over to using a new program or set of programs, can sometimes take months or years to accomplish

Inherent Problems Uneven and thin spread application domain knowledge amongst developers Rare utilization of existing code (program) Users requirements can be fluctuated and conflicted Easy breakdown of communication and coordination Difficult to manage project scheduling – typical scheduling techniques such as (PERT/CPM) does not work properly in programming world

Using Flowchart Symbols When programmers plan the logic for a solution to a programming problem, they often use one of two tools, flowcharts or pseudocode A flowchart is a pictorial representation of the logical steps it takes to solve a problem – beginners Pseudocode (“sue-dough-code”) is an English-like representation of the same thing – experts Using pseudocode involves writing down all the steps you will use in a program (more similar to writing the final statements in the programming language)

Using Flowchart Symbols

Using Flowchart Symbols To show the correct sequence of these statements, you use arrows, or flowlines, to connect the steps

Flowchart of Infinite Number-Doubling Program

Ending a Program by Using Sentinel Values The diamond symbol usually contains a two mutually exclusive answers like yes and no or true and false or value zero to stop the program A preselected value that stops the execution of a program is often called a dummy value because it does not represent real data, but just a signal to stop Sometimes such a value is called a sentinel value because it represents an entry or exit point like a sentinel that guards a fortress Many programming languages use the term eof (for “end of file”) to stop the program

Flowchart for Number-Doubling Program with Sentinel Value of Zero

Flowchart Using EOF

Using the Connector By using just the input, processing, output, decision, and terminal symbols, you can represent the logic for many diverse applications Only one other symbol needed for a flow chart is the connector A connector will be used when limited page size forces you to continue the flowchart on the following page

Flowchart Using the Connector

Include at least two decisions and two loops. Flowcharting Example Draw a flowchart of your preparation to go to work or school in the morning. Include at least two decisions and two loops. Example figure

Understanding Data Types Computers deal with two basic types of data—character and numeric When you use a specific number value, like 43, within a program, you write it using the digits and no quotation marks A specific numeric value is often called a numeric constant, because it does not change When you use a specific character value, or string of characters, like “Chris,” you enclose the string or character constant within quotation marks

Understanding Data Types Similarly, most computer languages allow at least two distinct types of variables One type of variable can hold a number and is often called a numeric variable Most programming languages have a separate type of variable that can hold letters of the alphabet and other special characters such as punctuation marks Depending on the language, these variables are called character, text, or string variables

Understanding Data Types Some languages have different rules for naming the variables, but with others you must include a simple statement (called a declaration) telling the computer which type of data to expect Some languages allow for several types of numeric data Languages like Pascal, C++, C#, and Java distinguish between integer or whole number variables, and floating-point or fractional numeric variables that contain a decimal point

Summary You write computer instructions in a computer programming language that requires specific syntax A programmer’s job involves understanding the problem, planning the logic, coding the program, translating the program into machine language, testing the program, and putting the program into production When programmers plan the logic for a solution to a programming problem, they often use flowcharts or pseudocode

Summary You represent a decision in a flowchart by drawing a diamond-shaped decision symbol which contains a question A circular connector symbol is used to continue a flowchart that does not fit on a single page Most programming languages allow the equal sign to assign values to variables Programmers must distinguish between numeric and character variables because computers handle the two types of data differently A variable declaration tells the computer which type of data to expect