Where did God put his readonly variables?
I've got one more physics class and two math classes to finish my 11 year quest for a 4 year degree. As I was sitting in Physics yesterday we were talking about the Ideal Gas Constant and Avogadro's number and the thousand other constants that make It All Work. And I was thinking...in my programming I'm always trying to avoid superfluous constants when possible, and use enums to group related consts when possible.
But in the Universe, for It All To Work we seem to need a lot of very precise and specific Constants and learning physics for me has been as much learning another person's code and algorithms as it has been understanding the constants they needed to get the job done.
My real question is, did God put these constants as a readonly field in a static constructor or a singleton pattern, or assuming parallel universes, a factory pattern? Either way, it makes me think when I write C# code, how would God write this loop? :)
(and please note God's use of a modified Hungarian naming convention)
public Reality
{
public readonly double dblAvogadrosNumber = 6.022137*10^23....etc;
/* additional Reality Code removed for clarity... */
private static Reality singletonInstance;
private static int cReference;
public static Reality GetInstance()
{
if(singletonInstance== null)
{
singletonInstance= new Reality("Let there be light, etc");
}
cReference++;
return singletonInstance;
}
}
About Scott
Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.
About Newsletter
Comments are closed.