Matakuliah Tahun Versi : T0604-Pengantar Teknologi Informasi : 2008 : 2.0/0.0 Pertemuan 24 Pemrograman Sumber: Chapter 10. System Analysis & Programming: S/W Development, Programming, & Languages, p.463 Williams, B.K, Stacy C. Sawyer (2007). Using Information Technology: A Practical Introduction to Computers & Communications. Seventh Edition, McGraw-Hill, New York. ISBN-13: 978-007-110768-6 1 Learning Outcomes Pada akhir pertemuan ini, diharapkan mahasiswa akan mampu : • menjelaskan apa itu pemrograman dan langkah-langkah dalam pemrograman (C2) 2 Outline Materi • Programming: A Five-Step Procedure – Clarify/define the problem – Design the program – Code the program – Test the program – Document and maintain the program 3 Programming: A FiveStep Procedure • A program is a list of instructions that the computer must follow to process data into information • The five steps are 1. Clarify/define the problem a. Clarify the program objectives & users b. Clarify outputs c. Clarify inputs d. Clarify processing tasks e. Study the feasibility of the program f. Document the analysis 2. Design the program 3. Code the program 4. Test the program 10-4 Programming: A FiveStep Procedure • Step 2: Design the program – Create an algorithm or set of steps to solve the problem • Traditional structured programming approach – Determine program logic using top-down approach & modules – Design details using pseudocode or flow charts • Alternative object-oriented approach – Use “Use Case” approach to determine program objects, object inheritance, and actions or functions each object can perform – Identify major program components and organize related functions and associated data into object classes – This is the approach used by object-oriented languages such as Java, C#, Lisp, Visual Basic, and C++ – For more information on object-oriented programming, visit http://oopweb.com/ or http://java.sun.com/docs/books/tutorial/java/concepts/ 10-5 Programming: A Five-Step Procedure • A hierarchy chart 10-6 Programming: A Five-Step Procedure START • Panel 10.13 • Pseudocode DO WHILE (SO LONG AS) THERE ARE RECORDS Read a customer billing account record IF today’s date is greater than 30 days from date of last customer payment Calculate total amount due Calculate 5% interest on amount due Add interest to total amount due to calculate Grand total Print on invoice overdue amount ELSE Calculate total amount due ENDIF Print out invoice END DO END 10-7 Programming: A Five-Step Procedure ● PANEL 10.14 Example of a program flowchart and explanation of flowchart symbols This example represents a flowchart for a payroll program. 10-8 Programming: A Five-Step Procedure • Iteration and sequence control structures 10-9 Programming: A FiveStep Procedure • Step 3: Code the program – Translate the logic requirements into a programming language – Programming language is a set of rules that tells the computer what operations to do – Each programming language has a syntax, or set of grammatical rules to follow to write valid expressions • Syntax rules must be followed or there will be syntax errors • Computers don’t understand what you want, only what you type in 10-10 Programming: A FiveStep Procedure • Step 4: Test the program – Desk checking is done by the programmer who checks for syntax errors and logic errors – Debugging is the process of detecting, locating, and removing all errors in a computer program – Beta testing is the process of testing the program using real data • One phase of testing uses correct data • Once the program works, the next phase of testing uses invalid data and untrained users to root out hidden errors 10-11 Programming: A FiveStep Procedure • Step 5: Document & Maintain the program – Documentation is written descriptions of what a program is and how to fix it – There are several types of documentation that should be written • User documentation – for the people who will use your program • Operator documentation – for the people who run the large computers the program runs on – so they know what to do if the program or computer malfunctions • Programmer documentation – for the next programmer who must modify and maintain what you have written – Maintain the program • Fix any errors that are noticed once the program is in production • Update the program to reflect new requirements 10-12 Kesimpulan 13