90 likes | 125 Views
Learn how to define, plan, code, debug, and document programs effectively. Understand abstraction for generalization and stepwise refinement for detailed solutions easily translatable into programming languages.
E N D
Chapter 2Problem Solving, Abstraction, and Stepwise Refinement
Chapter 2 • The Programmer’s AlgorithmDefine the problem.Plan the problem solution.Code the program.Test and debug the program.Document the program.
Chapter 2 • Define the ProblemThe problem must defined in terms of output, input, and processing. Look for nouns in the problem statement that suggest output and input. Look for verbs to suggest processing steps.
Chapter 2 • Plan the SolutionWhen planning computer programs, algorithms are used to outline the solution steps using Englishlike statements, called pseudocode. A good pseudocode algorithm should be independent of, but easily translated into, any formal procedural programming language.
Chapter 2 • Code the ProgramCoding involves the actual writing of the program in a formal programming language. Once a language is chosen, the program is written, or coded, by translating your algorithm steps into the formal language code.
Chapter 2 • Debug the ProgramRealize that you have an error.Locate and determine the cause of the error.Fix the error. • Desk-check the program, • Compile the program. • Run the program. • Debug the program using a debugger.
Chapter 2 • Document the ProgramThe final program documentation is simply the recorded result of the problem definition, solution planning, coding, testing results, debugging results, and user instructions.
Chapter 2 • Problem AbstractionAbstraction provides for generalization in problem solving by allowing you to view a problem in general terms, without worrying about the details of the problem solution.
Chapter 2 • Stepwise RefinementStepwiserefinement is the process of gradually adding detail to a general problem solution until it can be easily coded in a computer language.