

Leveraging Static Typing to Manage Object State - gpoort
http://blog.rescale.com/?p=2082

======
fsloth
"...whose type indicates its state"

This is one of my favorite scenarios facilitated by static types. And one of
the reasons I like languages with ML-like syntax for algebraic datatypes and
pattern matching - this pattern is so easy to implement in them

[http://en.wikipedia.org/wiki/Algebraic_data_type](http://en.wikipedia.org/wiki/Algebraic_data_type)

An concise example of the usage can be found in
[http://queue.acm.org/detail.cfm?id=2038036](http://queue.acm.org/detail.cfm?id=2038036)

(Section starting with the sentence "Consider as an example the following
types for representing the state of a network connection:")

That's in Ocaml but the same syntax applies more or less to all languages with
ADT:s.

------
gsg
Ah, a clear instance of
[http://blogs.msdn.com/b/oldnewthing/archive/2011/01/26/10120...](http://blogs.msdn.com/b/oldnewthing/archive/2011/01/26/10120297.aspx)

~~~
kristianp
My pet piece of "Microspeak" is the word "Performant", although it isn't
mentioned in the oldnewthing blog tag of that name:

[http://blogs.msdn.com/b/oldnewthing/archive/tags/microspeak/](http://blogs.msdn.com/b/oldnewthing/archive/tags/microspeak/)

------
ENGNR
See also: Scala case classes

