Programming errors can be as small and subtle as an off-by-one error in a loop, or as large as a flaw in the implementation or design of an important algorithm. What should our code do when it runs into this type of error? In most cases, we shouldn’t be afraid just to make our program abort.
Tag: programming
Making Objects Immutable
This blog post describes what immutable objects are in object-oriented programming. After reading this post, you should be able to implement immutable objects, and understand how they can be used to prevent unintended side effects in our code.
Computing Power Sets
This blog post describes what power sets are and how to compute them recursively. After reading this post, you should understand how to derive the power set of a given set, and appreciate the immense computational expense of computing a power set.
Wrapping Multiline Macros in C With Do/While
This blog post describes logical errors that can occur with multiline macros in C programming, and demonstrates how to resolve them directly in the definition of the macro itself. After reading this post, you should understand why wrapping multiline C macros with a “do/while” statement is a best practice to avoid these logical errors.