CPSC 110-08: Computing on Mobile Phones
Spring 2011

Debugging Tips

An important part of developing an app is finding and fixing bugs that may come up during the development process. Generally, there are two types of errors that can occur, syntax and semantic errors.

Syntax errors are like grammatical mistakes in a language. In a typical programming language a syntax error would be something like spelling the name of a variable wrong or using an operator in the wrong way. For example, it would be a syntax error to try and divide two strings with an expression like "hello / 2". In App Inventor it is very difficult to create these kinds of error because the blocks editor constrains the type of expressions and statements you can write to those that are syntacticaly legal.

Semantic errors occur when you construct syntactically correct code that doesn't do what you intend it to do. And there are an infinite ways to make these kinds of errors. For example, suppose you wanted to add two numbers and you construc the expression "num1 * num2". This would cause your app to work incorrectly.

Investigating Bugs

Fixing a semantic error in your code requires something like a criminal investigation employing all of the logic and reasoning and evidence gathering skills you can marshall. Start investigating!