liveBook · Manning

Programmer error

As explained in The Art of Code

A programming error is a defect originating in code that causes an operation to behave incorrectly or fail and requires correction in the code.

A programmer error is a defect inside the code: incorrect logic, invalid assumptions, or broken invariants make an operation behave incorrectly or fail. Unlike technical problems, it requires correction in the code rather than routine recovery at runtime. section 7.1.3 section 7.1.4

Common manifestations include:

  • Java IllegalArgumentException, ArithmeticException, ArrayIndexOutOfBoundsException, and ClassCastException. section 7.1.3
  • C# InvalidOperationException and ArgumentException, or Python TypeError, ValueError, and IndexError. section 7.1.3
  • Some programming mistakes escalate into fatal errors, such as OutOfMemoryError or StackOverflowError, where the failing process cannot recover normally. section 7.1.4

Unchecked exceptions are intentionally not permanent recovery cases. Detect them through thorough manual or automated testing, then fix the underlying defect directly. Catching them generically can conceal the failure instead of correcting it. section 7.1.3 section 7.3

Table 7.1 Summary of failure types and handling strategies
Type of failure
Description
Business logic errors
Violations of business rules or expected usage constraints that the system must anticipate and communicate clearly
Technical problems
Failures caused by external systems, infrastructure, configuration, or unavailable technical dependencies
Programming errors
Defects in the code itself caused by incorrect logic, invalid assumptions, or broken invariants
Fatal errors
Critical runtime failures that compromise process stability and usually prevent normal recovery

Compare programmer errors with business logic errors, technical problems, and fatal errors to choose an appropriate handling strategy. section 7.1 section 7.1.4

How The Art of Code covers it

How deep it goes
Defines causes, names language-specific exceptions, distinguishes fatal escalation, and specifies testing and direct correction without detailing debugging procedures.
Examples
Uses invalid arguments, division by zero, out-of-bounds access, incompatible casts, wrong types, invalid values, and excessive recursion.
What you can do after
Diagnose programmer errors through testing and correct their underlying code defects instead of treating them as permanent runtime conditions.
How it connects
Connects programming errors with business logic errors, technical problems, fatal errors, unchecked exceptions, testing, and error handling.

Related concepts

This explainer was generated by Manning's knowledge graph from the text of The Art of Code. The section links point to the parts of the book it draws on.