thinking procedurally Flashcards
procedural abstraction
using a procedure to carry out a sequence of steps for achieving some task eg calculating grade across 3 papers, buying groceries online
procedure interface
programmer doesn't need to know how procedure works, only: what procedure is called arguments required data types of arguments order written in documentation: I/O and preconditions
eg if need to change one property of all objects
don’t need to change procedure, only call with different arguments
problem decomposition
computational problems needed to be broken down into subproblems before solved. eg menu of choices, each choice results in different self contained module
top down design (decomposition)
breaking down a problem into major tasks to be performed. These are broken down into separate subtasks repeatedly until each subtask is sufficiently simple to be written as a self contained module/subroutine. Useful for breaking down into small, manageable tasks
advantages of problem decomposition
- easier to write
- simpler to debug and maintain
- easy to make changes (easy to find where to make changes) without affecting rest of program if self contained and well documented I/O/preconditions
hierarchy chart
tool for representing the structure of a program, showing how modules relate to each other to form a complete solution