Presentation is loading. Please wait.

Presentation is loading. Please wait.

DDC 1023 – Programming Technique

Similar presentations


Presentation on theme: "DDC 1023 – Programming Technique"— Presentation transcript:

1 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

2 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

3 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

4 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

5 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

6 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

7 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

8 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

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

10 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

11 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

12 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

13 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

14 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

15 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

16 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

17 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

18 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

19 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

20 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

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

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

23 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

24 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

25 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

26 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

27 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

28 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

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


Download ppt "DDC 1023 – Programming Technique"

Similar presentations


Ads by Google