Parse, Don’t Validate
This is describing what I&#x27;ve known as &quot;Typed Hungarian notation&quot;, and have seen a few times before, though I can&#x27;t seem to find now.<p>The original intent of Hungarian notation was to encode metadata into the variable name - for example, &quot;validData = validate(rawData); showValidData(validData)&quot;.  The idea was that the prefixes would make it just look wrong to the programmer if someone accidentally used mismatched names, such as &quot;showValidData(rawData)&quot;, indicating a likely bug.<p>This notation mutated into the far more simplistic and arguably less useful &quot;prefix with the datatype&quot;, such as iFoo indicating Foo is an integer.  This mutation became known as Systems Hungarian, while the original became Apps Hungarian.<p>The suggestion in this post is taking Apps Hungarian, and instead of relying on variable names, encoding it into the type system itself.<p>The first time I recall seeing something like this suggested was actually in Java, with examples in that blog post involving class attributes:<p><pre><code>  public String Name;
  public String Address;
</code></pre>
And creating classes to represent these values, preventing them from being used the wrong way:<p><pre><code>  public NameType Name;
  public AddressType Address;
</code></pre>
...which is why I remember this as &quot;Typed Hungarian&quot; - making the language&#x27;s type system handle the work that a person would normally have to think about in Apps Hungarian.