Presentation is loading. Please wait.

Presentation is loading. Please wait.

An Overview of Programming Logic and Design

Similar presentations

Presentation on theme: "An Overview of Programming Logic and Design"— Presentation transcript:

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

2 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

3 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.

4 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

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

6 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

7 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

8 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

9 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


11 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

12 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

13 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

14 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


16 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

17 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)

18 Using Flowchart Symbols

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

20 Flowchart of Infinite Number-Doubling Program

21 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

22 Flowchart for Number-Doubling Program with Sentinel Value of Zero

23 Flowchart Using EOF

24 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

25 Flowchart Using the Connector

26 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

27 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

28 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

29 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

30 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

31 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

Download ppt "An Overview of Programming Logic and Design"

Similar presentations

Ads by Google