Debugging Tips

What is a software bug?

  • A bug is a defect or error in a computer program that results in unexpected and unintended results.
  • The results of a bug can vary widely from impactful (e.g., a crash, a spin, or corrupt data) or subtle (e.g., invalid output, UI inconsistency, rarely encountered program state).
  • bug is generally more than a simple syntax error that can be caught immediately by your development environment (IDE), but what can be caught by an IDE or compiler varies widely by language. For example, ...
    • A statically typed languages (C, Java, Swift, etc.) will highlight any attempt to assign a string to a floating point variable, while a dynamically typed language (Python, Ruby, JavaScript, etc.) will allow it.
    • Objective C will allow you to send a method to a nil object pointer and not complain. Swift requires you to specifically indicate that you know the variable could be nil.
  • Bugs can always creep into code, but you're more likely to create or find them in code that...
    • Was written over a long period of time
    • Is larger and more complex
    • Was written by less experienced programmers
    • Was written by a larger number of programmers
    • Was written in higher level languages with fewer safeguards
    • Was written without using more defensive programming techniques (readable code, code reviews, writing tests, etc.) 
More Coming Soon

© 2024 Code..Begin!