All about Errors - Types of Errors Found in Java, Python, and Visual Basic
Design errors are the highest level errors that occur. They result from an architectural failure of the application, usually where a programmer is presented with one problem, and the application created addresses another problem. If the car won't start, repainting it might be awesome in another circumstance, but it doesn't address the problem with the car not starting.
Syntax errors in programming are the analogues of syntax errors in English composition. They are instances where the rules of language have been violated. Tools to catch Syntax errors are usually available in the Interactive Development Environment (IDE) that is being used to build the application.
● In Java, syntax errors must be identified by looking between identification points where the syntax error has occurred to narrow down where the syntax error is.
● In Visual Basic, Microsoft will highlight the syntax error via a wavy red line, just as it does for a misspelled or misused word in Microsoft Word.
● In Python, explicit syntax error codes are returned for syntax errors at the point where the syntax error happens.
Semantic run time errors, usually just referred to as run-time errors, are errors that result of some type of program crash. Often these errors are non-specific, and often not the most helpful errors in the world. Exception statements can prevent a run-time error in an application from terminating the entire application. Different programming languages and environments handle these errors in different ways
● Java provides the ability to narrow down where a run-time error occurs through the use of markers that identify the point before and after the lines of code that caused the run-time error, just as it does with Syntax errors.
● Visual Basic gives exception objects at the point in the code where there is a run-time error, along with an error number and a message specific to the type of run-time error encountered.
● Python has what are called Built-in Exceptions, which are class objects that are generated by the interpreter and give specific error codes that convey the nature of the run-time error.
Often, one error in an application can cause follow-on errors due to dependencies between objects in the application. Often, Catch statements isolate portions of a program where some error that could cause the application to crash.
Another common error type in beginning programming is the use of reserved words used as variable names in an application.
In Python, some of the reserved words are obvious, such as while, import, and print. Others, may not be as obvious, such as raise, global, and return. A full list of Python reserved words can be found on the other side of this link.
Because Java is purely object oriented, there are no concerns about global variables causing problems. There is what is called primitive types in Java, which act as reserved words.
A common error that is seen in Java is a case-sensitive mismatch, where a variable like "Cupcake" points to a different memory location and value than "cupcake", resulting in hard to track down errors.
Java does not require line spacing to run properly, but instead uses a semi-colon to call the end of a line. Python relies on carriage returns and indentation to segment and format commands.
So there it is - a quick run-down of the most common beginning types of errors, and some ways to avoid them, as you start learning more programming. Stay tuned for part 3…
No comments:
Post a Comment