Learning garbage collection theory?
I want to learn the theory behind garbage collection. How do i go about it? The obvious answer is - a compiler textbook... The question is, is it necessary to learn lexical analysis, parsing and...
Purpose of singletons in programming?
This is admittedly a rather loose question. My current understanding of singletons is that they are a class that you set up in such a way that only one instance is ever created.This sounds a lot...
Determine Whether Two Date Ranges Overlap?
Given two date ranges, what is the simplest or most efficient way to determine whether the two date ranges overlap?As an example, suppose we have ranges denoted by DateTime variables `StartDate1`...
What does it mean to "program to an interface"?
I have seen this mentioned a few times and I am not clear on what it means. When and why would you do this? I know what interfaces do, but the fact I am not clear on this makes me think I am...
Interface vs Base class?
When should I use an interface and when should I use a base class? Should it always be an interface if I don't want to actually define a base implementation of the methods?
XOR of three values?
What is the simplest way to do a three-way exclusive OR?
In other words, I have three values, and I want a statement that evaluates to true IFF only *one* of the three values is true.
C# logic order and compiler behavior?
In C#, (and feel free to answer for other languages), what order does the runtime evaluate a logic statement?
DataTable myDt = new DataTable();
if (myDt != null &&...
Should a function have only one return statement?
Are there good reasons why it's a better practice to have only one return statement in a function? Or is it okay to return from a function as soon as it is logically correct to do so, meaning there...
Learning to write a compiler?
*Preferred languages*: C/C++, Java, and Ruby.I am looking for some helpful books/tutorials on how to write your own compiler simply for educational purposes. I am most familiar with C/C++, Java,...
What is the fastest way to get the value of π?
I'm looking for the fastest way to obtain the value of π, as a personal challenge. More specifically, I'm using ways that don't involve using `#define` constants like `M_PI`, or hard-coding the...
Is floating point math broken?
Consider the following code:<!-- language: lang-js --> 0.1 + 0.2 == 0.3 -> false<!-- language: lang-js --> 0.1 + 0.2 -> 0.30000000000000004 Why do these...
What is tail recursion?
While learning lisp, I've come across the term *tail-recursive*. What does it mean exactly?
What does Exclusive in XOR really mean?
Maybe this is just obvious to everyone but can someone explain where XOR (or Exclusive-OR) got its name from? What does the word ***Exclusive*** really mean? Not that it matters, but its just stuck...