Tag: programming

Rewinding Time with Git

“It was working ten minutes ago”. I remember saying that numerous times as a student, and now many of my students say something similar. If only there were a way to rewind our code by ten minutes, or to see what’s changed about our code in the last ten minutes. This blog post demonstrates how we can do both of these things with Git.

Constant Pointers in C: Reading Right to Left

The “const” keyword in the C programming language, when applied to pointers, can be quite confusing to read. How do you read a variable declaration like “const char *const *const p”? This blog post explains how to read these declarations, and demonstrates the technique of reading them from right to left.

Singletons with Initialization Methods

The singleton design pattern guarantees that only one instance of a given class will be constructed. But, how can we address any exceptions that get thrown while this instance is being created? In today’s post, we’ll show how this issue can be solved using a special singleton initialization method, along with Java’s standard IllegalStateException class.

Helper Methods and Code Readability

Helper methods, or helper functions, are smaller pieces of code that perform part of an overall task. Often, when we write helper methods, it’s because we want to factor out a piece of code that’s common across multiple higher-level methods. But, we shouldn’t be afraid to write helper methods just for the sake of improved readability in a single algorithm as well.