{"id":171,"date":"2009-07-02T12:29:32","date_gmt":"2009-07-02T12:29:32","guid":{"rendered":"http:\/\/andypalmer.com\/?p=171"},"modified":"2009-07-02T15:32:43","modified_gmt":"2009-07-02T15:32:43","slug":"tiny-types","status":"publish","type":"post","link":"https:\/\/andypalmer.com\/2009\/07\/tiny-types\/","title":{"rendered":"Tiny Types"},"content":{"rendered":"

Mark Needham’s post on micro types<\/a> sparked an idea in my head that recently came to fruition.
\nI was pondering on the
Narrative Fixture<\/a> code, and the fact that, although most of the internals are sensibly typed objects, at the FitNesse<\/a> layer, we do a lot of passing of strings.
\nThe idea (at least, my interpretation) with Tiny Types is that the string obviously means something, and that we can probably classify what that meaning is (we have a sensibly named variable for it, after all) , and so why not convert it to that meaningful thing as soon as possible.
\nThis has the nice effect of making some vague things (such as typing on collections) much more explicit.<\/p>\n

As an example, in the Casting Director<\/a> we have:<\/p>\n

\r\nMap<String, ActorPlayingThe<?>> dressingRoom = new HashMap<String, ActorPlayingThe<?>>();\r\n<\/pre>\n

and, after a little bit of refactoring, we end up with:<\/p>\n

\r\nMap<CharacterName, ActorPlayingThe<?>> dressingRoom = new HashMap<CharacterName, ActorPlayingThe<?>>();\r\n<\/pre>\n

Personally, I’m a fan of low ceremony, high essence languages<\/a>, but while working in a high ceremony environment, we can leverage that ceremony to provide us with a nice summary of our thinking, ready for the next time we return to the code.<\/p>\n","protected":false},"excerpt":{"rendered":"

Mark Needham’s post on micro types sparked an idea in my head that recently came to fruition. I was pondering on the Narrative Fixture code, and the fact that, although most of the internals are sensibly typed objects, at the FitNesse layer, we do a lot of passing of strings. The idea (at least, my […]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[26,8,25,27,28,29],"_links":{"self":[{"href":"https:\/\/andypalmer.com\/wp-json\/wp\/v2\/posts\/171"}],"collection":[{"href":"https:\/\/andypalmer.com\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/andypalmer.com\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/andypalmer.com\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/andypalmer.com\/wp-json\/wp\/v2\/comments?post=171"}],"version-history":[{"count":14,"href":"https:\/\/andypalmer.com\/wp-json\/wp\/v2\/posts\/171\/revisions"}],"predecessor-version":[{"id":198,"href":"https:\/\/andypalmer.com\/wp-json\/wp\/v2\/posts\/171\/revisions\/198"}],"wp:attachment":[{"href":"https:\/\/andypalmer.com\/wp-json\/wp\/v2\/media?parent=171"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/andypalmer.com\/wp-json\/wp\/v2\/categories?post=171"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/andypalmer.com\/wp-json\/wp\/v2\/tags?post=171"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}