go to previous page   go to home page   go to next page

Answer:

Yes.


Bug-free Blocks

program block

Bugs happen when control jumps out of (or into) a block of code. The block can no longer be regarded as a module that performs a particular function, but must be examined statement by statement.

Some (mostly ancient) programming languages let you jump directly into the middle of a block of code using the notorious GOTO statement. This is particularly deadly and strongly discouraged in modern programming. In assembly language it is easily possible to send control directly to nearly any point in a program. Writing assembly programs that work takes careful discipline.

You would like to think of a code block as a "black box" that performs some particular operation. Just before control enters the block everything is ready for the operation, and when control leaves the block the operation has been done correctly. In our fragment, you would like the code block to add count to sum and to increment count.

This is a prime idea of structured programming. A block of code is a module that has one entry point (where execution enters the block) and one exit point (where execution leaves the block). The entry point has well defined entry conditions. The exit point has well defined exit conditions.

For the block to execute correctly, execution must start at the entry point, and the entry conditions must be met. When execution leaves the block, the exit conditions are true (if the block itself is bug free).


QUESTION 5:

Do you completely understand the internal mechanism of your microwave oven? What gigahertz radiation does it produce?