Problem Solving

Systematic Decomposition / Structured Programming A methodology that systematically breaks the larger tasks down into smaller ones. The process is also referred as stepwise refinement.

Three Constructs

:::warning Sequential consturct
Carry out the subtask sequentially, nerver going back. ::: :::warning Conditional construct
Do one of the two subtasks but not both, depending on some condition.
Either subtask may be vacuous. ::: :::warning Iterative construct
Do a subtask a number of times, but only as long as some condition is true. ::: Each of the three possible decompositions, there is exactly one entrance into the construct and exactly one exit out of the construct.
image.png
image.png

Debugging

The simplest way to keep track of where you are as compared to where you want to be is to trace the program.
When the behavior of the program as it is executing is different from what it should be doing, you know there is a bug.
A useful technique is to partition the program into parts, often referred to as modules, and examine the results that have been computed at the end of execution of each module. :::warning corner cases
For a program to work, it must work for all valid source operands, and a good test of the program is to set source operands to the unusual values, the ones the programmer may have failed to consider. These values are referred to colloquially as corner cases. :::

Debugging Operations

Set Values

Execute Sequences

  • Run command
  • Step command
  • Set Breakpoint command

    Display Values