Top Banner
Murphy’s Laws
14

Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,

Dec 16, 2015

Download

Documents

Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,

Murphy’s Laws

Page 2: Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,

Murphy’s Laws

• Things are more complex than they seem to be.

• Things take longer than expected.

• Things cost more than expected.

• If something can go wrong, it will.

Page 3: Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,
Page 4: Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,
Page 5: Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,
Page 6: Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,

Callahan’s Corollary to Murphy’s Laws

• Murphy was an Optimist !

Page 7: Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,

Programming Errors• Lexical errors – occur whenever

Karel reads a word that is not in his vocabulary.

Example in English: We are giving directions on how to get to Portland and we write:

“fadt jdhpy hqngrps ggssi sgr ghhgh grmplhms?”

In English these are spelling errors.

Example for Karel: We want Karel to turn left and we write TurnToTheLeft();

Page 8: Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,

• Syntactic error – when we use incorrect grammar or inaccurate punctuation.

Example in English: Suppose we are giving instructions to a lost motorist and we say “for keep hundred just miles going eight.” These errors are grammatical errors in English.

Example in Karel: Suppose we wish Karel to turn left and we write ()TurnLeft;

Page 9: Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,

• Execution errors – This is caused in a Karel program when Karel is unable to execute an instruction successfully and is forced to perform an error shutoff.

For example, we ask Karel to move and he is facing a wall.

Page 10: Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,

• Logic (or Intent) errors – This happens when Karel performs a different task than his assigned task. This means that the program is incorrect for the task, but not so incorrect that Karel can discover the error.

For example, we wish for Karel to go get his newspaper and come back to bed. However, we forget to issue a PickBeeper() command so when he gets back to bed, he has not completed his assigned task.

Page 11: Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,

All types of errors are known as bugs.

Debugging is the name that programmers give to the activity of removing errors from a

program.

(Origin of the term “debugging”.)

Page 12: Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,

More info

Page 13: Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,

Good Programming Style• A program that works perfectly is not

considered a good program; it is simply a working program. To write a good robot program you must follow these guidelines: – a program must be easy to read and

understand – a program must be easy to debug – a program must be easy to modify to solve a

variation of the original task

Page 14: Murphy’s Laws. Things are more complex than they seem to be. Things take longer than expected. Things cost more than expected. If something can go wrong,

Maintenance

• Maintenance occurs whenever we modify or change a program.

• Three types of maintenance:– Corrective– Adaptive– Perfective