Creative Development and Error Types in Programming
Creative Development, Collaboration, and Programming
- Programming is a collaborative and creative process.
- It involves bringing ideas to life through software development.
- Software development processes in the industry often require teamwork.
- Collaboration occurs at various points and in several ways.
Computing Innovations
- A computing innovation uses a computer program to:
- Take in data.
- Transform data.
- Output data.
- Collaboration can occur during:
- Planning.
- Designing.
- Testing (debugging).
- Collaboration tools enable students and teachers to exchange resources.
- This exchange varies depending on the specific task.
- Collaborative learning can be:
- Peer-to-peer.
- In larger groups.
Peer Instruction
- Peer instruction involves students working in pairs or small groups.
- They discuss concepts to find solutions to problems.
Identifying and Correcting Errors
- There are four main types of errors in programming:
Syntax Error
- A syntax error occurs when the rules of the programming language are not followed.
- Example:
a ← expression- DISPLAY (A)
- A syntax error occurs because the second statement attempts to display the variable
A, which is not the defined variable. - Variable names are case sensitive.
- The variable
a (lowercase) is defined, but A (uppercase) is not.
Runtime Error
- A runtime error occurs during the execution of a program and causes it to cease execution.
- Example:
- There is no syntax error in this example.
- However, it causes a runtime error because division by zero is not allowed.
- The program's execution will halt at this line.
Logic Error
- A logic error is a mistake in the algorithm or program that causes it to behave unexpectedly or incorrectly.
- Example:
a ← 95- IF (a > 90) DISPLAY ("You got an A.")
- IF (a > 80) DISPLAY ("You got a B.")
- IF (a > 70) DISPLAY ("You got a C.")
- The code is intended to print the student's grade correctly.
- Since the student's score is 95 (greater than 90), the program should display "You got an A."
- However, the program prints:
- You got an A.
- You got a B.
- You got a C.
- This logic error occurs because the student's score is also greater than 80 and 70, with no restriction preventing multiple grades from being printed.
Overflow Error
- An overflow error occurs when a computer attempts to handle a number outside the defined range of values.
- For example
- x ← 2000 * 365
- DISPLAY (x)
- The result of the multiplication is a large number.
- If x is defined as a variable, and the product would be large enough to be outside the range of certain data types, the multiplication will cause an overflow error.
Debugging
- Debugging is the process of finding and fixing errors.
- Use test cases, extra output statements, examination for syntax errors, and other debugging tools.