<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet type="text/css" href="/stylesheets/rss.css"?>
<rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/">
  <channel>
    <title>ronin: Tiny Types</title>
    <link>http://blogs.divisibleprime.com/ronin/articles/2007/04/15/tiny-types</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Stuff</description>
    <item>
      <title>Tiny Types</title>
      <description>&lt;p&gt;&lt;a href="http://www.darrenhobbs.com/archives/2007/04/strong_typing_a.html"&gt;Darren Hobbs&lt;/a&gt;: Tiny Types&lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;I consider it playing to the strengths of a statically typed language.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I like this pattern, and have used it once on a large Java project.  Generally I prefer dynamic languages, Smalltalk and Ruby etc, but if you have types why not use them effectively.&lt;/p&gt;

&lt;p&gt;&lt;a href="http://blog.blainebuxton.com/2007/04/tiny-types-abstract-data-types-and.html"&gt;Blaine Buxton&lt;/a&gt; puts it in terms I like:&lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;Tiny objects make unit testing easier, aid in reuse, stop duplication dead, provide for better messages when things do break, puts functionality closer to where it is used, and I could go on all night.&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;I don&amp;#8217;t necessarily use this all the time, I find a lot of developers reject the idea because of the number of Types you end up with.  If I&amp;#8217;m working on something of mine, or from scratch then I&amp;#8217;ll use this approach, otherwise I tend to stick to the style of the original author.&lt;/p&gt;

&lt;p&gt;One thing I&amp;#8217;m not sure about is an example Darren wrote:&lt;/p&gt;

&lt;blockquote&gt;
    &lt;p&gt;It&amp;#8217;s much harder to accidentally pass dollars into a method that was expecting pounds sterling (but actually took a double so it could have been anything).&lt;/p&gt;
&lt;/blockquote&gt;

&lt;p&gt;Money is money is money, would some methods really only take Sterling and not Dollars?  Ever?  Maybe this was a passing comment or maybe I don&amp;#8217;t get this particular example.&lt;/p&gt;

&lt;p&gt;This is a good technique to learn and I&amp;#8217;d encourage anybody who hasn&amp;#8217;t used it to give it a go.  Maybe you&amp;#8217;ll like it or maybe not, at least you&amp;#8217;ll know.  One really good outcome that I find is behaviour finds itself in a Class where it belongs, not in some Manager/Helper class just because it&amp;#8217;s the first place the behaviour is needed.  Not only does this technique work for primitives, but it works equally well for collections, especially where you have some find/collect type methods.&lt;/p&gt;</description>
      <pubDate>Sun, 15 Apr 2007 14:14:00 +0100</pubDate>
      <guid isPermaLink="false">urn:uuid:f5d58682-105c-48ce-9f4c-c730006529c6</guid>
      <author>Kerry</author>
      <link>http://blogs.divisibleprime.com/ronin/articles/2007/04/15/tiny-types</link>
      <category>Tech</category>
      <category>Java</category>
      <category>java</category>
      <category>programming</category>
      <category>design</category>
      <category>types</category>
      <trackback:ping>http://blogs.divisibleprime.com/ronin/articles/trackback/858</trackback:ping>
    </item>
  </channel>
</rss>
