The null pointer is considered to be a “billion-dollar mistake” by Tony Hoare, but was he really saying that null pointer should never be used? After years of using languages both with null pointers (e.g. Java) and without them (e.g. Haskell), I found that null pointers are much easier and more natural to use than its … Continue reading
How to Reduce the Contagious Power of ‘const’
For the purpose of optimization, the C++ programming language decided that the users should manually specify ‘const’ annotations for variables that they know will never be modified. While I admit the possible usefulness of this annotation, I often see it misused in the code base I’m working on, and this often results in a contagious phenomenon where unnecessarily many … Continue reading
Back to the Future of Databases
Why do we need databases? What a stupid question. I already heard some people say. But it is a legitimate question, and here is an answer that not many people know. First of all, why can’t we just write programs that operate on objects? The answer is, obviously, we don’t have enough memory to hold all … Continue reading
Why is Indexing Faster Than Binary Search
We all know that indexing into an array takes only O(1) time, while searching for a number in a sorted array takes O(n) time with linear search, and O(log n) time with binary search. But why is indexing so fast? What is the secret sauce? The reason is really about the nature of indexing — … Continue reading
On Pureness
It is usually a pleasure to use a functional programming language, but it is doubtful whether we should care about the “pureness” of the language. To write programs in a purely functional programming language is much like living in a wired world. There are no electromagnetic waves nor sound waves in such a world, so … Continue reading
A Concise Solution to the P=NP? Problem
To solve P=NP? is to answer the following question: Can we solve strictly more problems with a computer that does not exist? Thus we have proved that this problem is nonsense. QED. Seriously, this blog took me years to conceive, and a week to write. Please don’t take it lightly. If you need a more “authoritative” … Continue reading