zajkowskimarcin
mzajkowski
zajkowskimarcin
*Kittens killed by __ every time when you __ doesn't count!
(when software is a matter of life and death)
Source: 2005 Nail Report
I call it my billion-dollar mistake. It was the invention of the null reference in 1965. At that time, I was designing the first comprehensive type system for references in an object oriented language (ALGOL W). My goal was to ensure that all use of references should be absolutely safe, with checking performed automatically by the compiler. But I couldn't resist the temptation to put in a null reference, simply because it was so easy to implement. This has led to innumerable errors, vulnerabilities, and system crashes, which have probably caused a billion dollars of pain and damage in the last forty years.
int i = 0; // I can't be null
int? i = null; // I can be null!
string s;
string? t;
t = null;
int i = t.Length; // Warning
if(t != null) {
int j = t.Length; // No warning - smart compiler!
}
if(!t.IsNullOrWhiteSpace()) {
int l = t.Length; // Warning!
int m = t!.Length; // I'm smarter than compiler, and DAMNIT, I don't have null here for sure! :>
}
string s; // Should never be null
string? s1; // Can be null
s?.Length; // Check this one for null, please!
s!.Length; // Don't check this, I'm smarter than you :)
zajkowskimarcin
mzajkowski
zajkowskimarcin
*Kittens killed by __ every time when you __ doesn't count!
Umbraco MVP, Trainer & Certified Master @ The Cogworks
CTO / CKO @ WOW School
Marcin @ umbraCoffee (Friday's 12:30 on YT)
Blogger @ udfnd.pl
zajkowskimarcin
mzajkowski
zajkowskimarcin
socialmediaforbusyprogrammers.com