Flatline Convention

A simple and effective solution to get over the null-pointer tragedy invented by Tony Hoare is to capture the type system deficiency by convention.

Postfixing each variable, field or property name with ‘_’ will make it obvious that a special “treatment” for null is required.

I simply called it the “flatline convention”.

For example:

var descriptor_ = File.Exists("myFile") ? new MyFileDescriptor() : null;

When used with discipline, it should be obvious when to handle null pointers.

yours
armin

Don’t just fix the mistakes — fix whatever permitted the mistake in the first place. – NASA