1/17
Vocabulary flashcards covering core concepts of defensive programming, input validation strategies, error-handling methods, exceptions, runtime AI safety, and production code practices.
Defensive Programming
A programming methodology based on the recognition that programs will encounter problems and modifications, structuring code so that a routine is protected from damage even if invalid data is passed due to another routine's fault.
Garbage In, Nothing Out
An input protection approach where invalid data passed into a routine is silently ignored without crashing the application or returning invalid results.
Garbage In, Error Message Out
An input protection approach where receiving invalid data causes the software to suppress execution and emit an explicit error message.
No Garbage Allowed In
An input protection approach where inputs are screened and re-prompted in a validation loop until they strictly meet required criteria before any processing can occur.
Returning a Neutral Value
An error-handling technique where bad data is countered by continuing execution and returning a known harmless value, such as 0 for a numeric calculation, an empty string, or an empty pointer.
Substituting the Next Piece of Valid Data
An error-handling technique used during stream or database processing where corrupted records are skipped to continue reading until the next valid record is found.
Returning the Same Answer as the Previous Time
An error-handling technique where the system handles missing or invalid data by repeating its previous valid result, such as repeating the last temperature reading or maintaining the previously used screen color.
Substituting the Closest Legal Value
An error-handling technique where an out-of-range value is clamped to the nearest allowable boundary, such as substituting 0 when a string length is reported as less than 0.
Correctness
A software quality goal where a system never returns an inaccurate result, preferring to return no result at all rather than a wrong result; favored in safety-critical applications.
Robustness
A software quality goal where a system always attempts to keep operating even if it sometimes produces inaccurate results; favored in consumer applications.
Exceptions
A specialized mechanism by which a routine passes along errors or exceptional events to the calling code when it encounters an unexpected condition it cannot handle locally.
Level of Abstraction (in Exceptions)
The architectural guideline stating that thrown exceptions should match the conceptual layer of the routine (e.g., avoiding throwing an EOFException from an Employee.GetTaxId() method).
Empty Catch Block
A bad programming practice where an exception is caught but contains no handling or logging code, improperly ignoring errors that should not be overlooked.
Runtime AI Components
System dependencies such as LLM APIs, agentic tool-calling systems, classical ML models, and RL policies that introduce stochastic outputs, variability across runs, and non-deterministic behavior.
Out-of-Distribution (OOD)
A failure mode in classical machine learning and reinforcement learning where input data lies outside the model's training distribution, resulting in poor or unreliable predictions.
Core Defense Strategy for AI Components
A defensive approach that involves defining strict boundary preconditions and postconditions, rigorously validating both inputs and outputs, and degrading gracefully with clear fallbacks.
Practical Confidence Thresholds (for AI)
A operational decision model where high confidence leads to auto-applying results, medium confidence triggers a request for user confirmation, and low confidence initiates a fallback or human review.
Removal of Debugging Aids
The practice of using build tools (such as Gradle, Ant, or Make) or preprocessor conditionals (such as #if defined(DEBUG)) to exclude internal diagnostic code prior to deploying production software.