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,

Slides:



Advertisements
Similar presentations
Karel – Making More Complex Decisions IF / THEN / ELSE IF THEN BEGIN Instructions END ELSE BEGIN Instructions END Do these when test = False Do these when.
Advertisements

1 Note: Original slides provided by and modified for Mr. Smith’s AP Computer Science A classwww.apComputerScience.com.
Nested If Statements While Loops
Chapter 3 Extending the Robot Programming Language.
The Terrible Odds If there is a wrong way to do something, that is the way it will be done and Murphy’s Law.
Karel The Robot Nested If Statements While Loops Copyright © 2008 by Helene G. Kershner.
Karel the Robot -- ITERATE Problem Statement: Karel is told to “take a walk around the block!” Revise Algorithm: Define move ahead 5 streets Define turnright.
Karel The Robot In the beginning… software. Karel the Robot  All robots are controlled by software  Artificially intelligent robots that can “think”
Conditionals How do we solve tasks in which every particular of a task is not specifically known? – A robot needs the ability to survey its immediate environment.
Introduction to Computer Science Extending Robots’ Vocabularies –New Methods –Top-Down Design –Multiple Robots Unit 2.
Class 1: What this course is about. Assignments Reading: Chapter 1, pp 1-33 Do in Class 1: –Exercises on pages 13, 14, 22, 28 To hand in in Class 2: –Exercises.
Programming Fundamentals (750113) Ch1. Problem Solving
Robot? What’s a Robot? Introducing Karel-the-Robot.
BPC.1 Basic Programming Concepts
Extending the Robot Programming Language In the Robot world 1 mile = 8 blocks Suppose we want a robot to run a marathon (26+ miles)? Does our program have.
CSC 395 – Software Engineering Lecture 34: Post-delivery Maintenance -or- What’s Worse than Being a Code Monkey?
© Janice Regan, CMPT 128, Jan CMPT 128 Introduction to Computing Science for Engineering Students Creating a program.
Chapter 5 Conditionally Executing Instructions
1 karel_part5_loops Iteration (Loops) Loops repeat a set of instructions Two types of loops: –Definite loops ( for ) perform instructions explicit (known)
Ch. 2 1 Karel – Primitive Instructions Basic tools with which all problems are solved (analogies: LeftSpinngingRobot, RightSpinningRobot, GuardRobot, etc)
Karel J Robot An introduction to BlueJ and Object- Oriented Programming.
1 Classes begin with capital letters (i.e. UrRobot). Methods, objects, and variable names begin with lower case (camelCase) Use indentation to line up.
1 Note: Original slides provided by and modified for Mr. Smith’s AP Computer Science A classwww.apComputerScience.com.
1 Ch. 7 Recursion similar to iteration in that you repeatedly do a little bit of the task and then “loop” again and work on a smaller piece - eventually.
Program Development Life Cycle (PDLC)
Karel J. Robot A Gentle Introduction to the Art of Object Oriented Programming.
Karel the Robot A Gentle Introduction to the Art of Programming.
The Software Development Life Cycle. Software Development SDLC The Software Development Life-Cycle Sometimes called the program development lifecycle.
Programming Errors Lexical errors – occur whenever Karel reads a word that is not in his vocabulary. Example in English: We are asking directions and instead.
Thanks to Dr. Kris Schindler for this (and all Karel the Robot slides)
Software Engineering Chapter 3 CPSC Pascal Brent M. Dingle Texas A&M University.
Karel J. Robot Tool for learning OOP (Lecture covers Ch. 1 and 2)
1 Karel – Chapter 5 Conditionally Executing Instructions Note: Original slides provided by and modified for Mr. Smith’s AP Computer.
Basic Programming Lingo. A program is also known as a  Sequence of instructions  Application  App  Binary  Executable.
15-100: Introduction to Programming w/ Java * Ananda Gunawardena -- Lecture – School of Computer Science – Phone : (x81559) – Office: Wean Hall.
Extending Karel’s Vocabulary This PPT originated with Dr. Judy Hankins Modifications have been done by Dr. Untch & Dr. Cripps.
1 Note: Original slides provided by and modified for Mr. Smith’s AP Computer Science A classwww.apComputerScience.com.
Introduction to Computer Science
Ch. 2 1 Karel – Primitive Instructions Basic tools with which all problems are solved (analogies: carpentry, geometry) –move() –turnLeft() –putBeeper()
Karel J. Robot Chapter 6 Instructions That Repeat.
Mile-long hurdle race Suppose that we want to program Karel to run a one-mile long hurdle race, where vertical wall sections represent hurdles. The hurdles.
Karel the Robot – Review Primitive Commands move pickbeeper putbeeper turnleft turnoff Karel’s program statements are separated by a semicolon (;) Copyright.
Compiler Errors Syntax error Lexical Can not resolve/find symbol Can not be applied Execution error Oh wait, a run time error Intent error It ran, but.
For Monday Read pages Do exercise 1.1 on page 46 (to hand in – may be done in groups of up to 4) Complete WebCT quiz.
1 Karel J. Robot Chapter 5 Conditionally Executing Instructions.
Karel J. Robot Chapter 6 Instructions That Repeat.
Chapter 3 Extending the Robot Programming Language.
Karel – Primitive Instructions
Mile-long hurdle race Suppose that we want to program Karel to run a one-mile long hurdle race, where vertical wall sections represent hurdles. The hurdles.
The Art of Programming --
In the beginning… software
Copyright © 2008 by Helene G. Kershner
Loops We have already seen instances where a robot needs to repeat instructions to perform a task turnRight(); moveMile(); Harvesting beepers in a field.
Copyright © 2008 by Helene G. Kershner
karel_part4_functions_2
Karel – Primitive Instructions
Karel J Robot.
G7 programing language Teacher / Shamsa Hassan Alhassouni.
Understand the Programming Process
Problem Solving Techniques
Karel the Robot – Making Decisions
Programming Fundamentals (750113) Ch1. Problem Solving
A Gentle Introduction to the Art of Object Oriented Programming
Understand the Programming Process
Nested If Statements While Loops
Scratch Programming Lesson 7 Debugging.
CSE 111 Karel the Robot.
Karel – Primitive Instructions
Debugging 101 Exterminating Vermin.
Presentation transcript:

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.

Callahan’s Corollary to Murphy’s Laws Murphy was an Optimist !

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();

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;

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.

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.

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”.)debugging

More info

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

Maintenance Maintenance occurs whenever we modify or change a program. Three types of maintenance: –Corrective –Adaptive –Perfective