1 / 34

Programming Concepts

Programming Concepts. Chapter 3. Introduction. Computers are only as good as their hardware , their softwere and the people using them The programmer have three recourses needed to optimize for effectiveness : computer memory computer time programmer time. Introduction.

irisa
Download Presentation

Programming Concepts

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Programming Concepts Chapter 3

  2. Introduction • Computers are only as good as their hardware , their softwere and the people using them • The programmer have three recourses needed to optimize for effectiveness : • computer memory • computer time • programmer time

  3. Introduction • Old days programmers worked alone small memories and slow. • Programs hard to mountain and read • Over the years computers and programming methods changed • The instructions must be understand by the computer (syntax)

  4. Communicating with the computer • you have to learn its system of communication or language . • The meaning of an instruction is essentially the same in many computer language or application. • Syntax refers to the rules governing the computer operating system , the application, and the languages. • An errors is called a bug . • A process called debugging .

  5. Communicating with the computer • many bugs are result of syntax errors but some are logic errors . • All syntax errors must be corrected before you execute and test your program .

  6. Organizing the Problem • Certain organizational tools will help you learn to solve problems on the computer . • The tools include the: • Problem Analysis Chart (PAC) • Structure/Interactivity Charts • Input Processing Output (IPO) Chart • Algorithms. • Flowcharts

  7. Organizing the problem • To analyze a problem and set up the most efficient solution, a programmer organizes the solution by using all or some of these tools. • If not use these tools : • the solution takes longer to program . • the final program is less efficient . • lacks readability . • increases programmer frustration.

  8. Analyzing the problem • Understand the Problem • Analyze the Requirements of the Problem • A good way to analyze a problem is to separate it into four parts, problem analysis chart( PAC) : • The given data.(constant and variables) • The required results.(the out put) • The processing that is required in the problem .(equations and expressions) • A list of solution alternatives .

  9. Problem Analysis Chart (PAC)

  10. PAC Payroll Example Calculate the gross pay of an employee. The formula to be used is GrossPay=Hours*PayRate Develop PAC for a solution to this problem?

  11. PAC Payroll Example

  12. Interactivity (Structure) Chart • Divide processing into subtasks called modules • Then connect these modules together to show the interaction of processing between modules. • Each modules should contain the tasks to accomplish one function. • There will be one module that controls the flow to most of other modules called the Control or main module .

  13. Interactivity (Structure) Chart • Use the top down method. • Divide the problem into subtasks . • Illustrate them in the order in which they will be processed from the top to the bottom of the chart. • The module that encompasses the complete solution becomes what is called the control module because it controls the processing of all the data . • The subtasks of this module are then located below it in the structure chart .

  14. The Interactivity Chart

  15. The Interactivity Chart • Indicates duplicate modules by darkening the upper left-hand corner of each module. • The darkened circles indicate that the module is part of a set of modules that are processed many time – those in loop . • The diamond on the vertical line above the box indicates which modules are involved in a decision . • Annotation may be placed beside the circle or diamond to indicate the condition

  16. The Interactivity Chart for the Payroll Problem

  17. Developing Input Processing Output (IPO) Chart • IPO chart shows: • What data item are input • What processing takes place on that data • What information will be the end result, the output • Where in the solution the processing takes place.

  18. The IPO Chart for the Payroll Problem • The module references are show which will perform each step in the processing

  19. Writing the Algorithm • The next step of organizing a solution is to develop sets of instructions for the computer, called algorithms. • The programmer writes a separate set of instructions for each module in the structure chart . • The number of instruction is determined by the way the programmer chooses to solve the problem .

  20. The Form of an Algorithm The Control module uses an End since this is the end of the processing . The other modules use Exit because the processing continues .

  21. Drawing the Flowchart • Graphic representations of the algorithms. • The algorithms and flowcharts are the final steps in organizing a solution. • A flowcharts shows the flow of the processing from the beginning to the end of a solution. • Each block in a flowchart represents one instruction from an algorithm.

  22. Drawing the Flowchart • Flowlines indicate the direction of the data flow. • Most block have one or more entrances • Most block have only one exit . • Since ,in most cases , data can flow to only one other block . • Exception a block representing a decision instruction • A loop enables the computer to perform a task repeatedly during the processing of solution .

  23. Flowchart Symbols

  24. Flowchart Symbols

  25. The algorithms and Flowcharts for the Payroll Problem

  26. The algorithms and Flowcharts for the Payroll Problem

  27. Order of Execution of Instructions

  28. Algorithm and Flowchart Form

  29. Documentation • Internal documentation consists of remarks written with the instructions to explain what is being done in the program . • External documentation is made up of the manuals or help menus written about the solution .

  30. Internal Documentation • proper internal documentation ensures that the new programmer will be able to learn about the program in the least amount of time . • Include such things as : • People who worked on the program • Variable usage • Note about the development of the program

  31. External Documentation • For the user of the program . • Allow the end user to find the answers to questions . • Should include : • Tutorials . • Input definition . • Usage instruction. • Installation instruction . • Command explanations . • Include any thing that allow the user to learn to use the program in the least amount of time .

  32. Testing the solution • Test the a solution to make sure it meet the requirements of the user ,and to check for errors in logic or in the setup of the expressions and equations . • To test the solution : • Select the data • A set of value for the input data • Works them through every step in the solution . • If a bug is detected the solution has to be modified to correct it.

  33. Coding the solution • After determining that the solution is correct • Select the appropriate language • Code the program

More Related