<?xml version="1.0" encoding="utf-8"?>
<rss xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:trackback="http://madskills.com/public/xml/rss/module/trackback/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:pingback="http://madskills.com/public/xml/rss/module/pingback/" version="2.0">
  <channel>
    <title>Agile Developer Venkat's Blog</title>
    <link>http://www.agiledeveloper.com/blog/</link>
    <description>Agile Developer: Venkat Subramaniam</description>
    <copyright>Agile Developer, Inc.</copyright>
    <lastBuildDate>Mon, 18 May 2009 19:50:57 GMT</lastBuildDate>
    <generator>newtelligence dasBlog 1.7.5016.2</generator>
    <managingEditor>venkats@agiledeveloper.com</managingEditor>
    <webMaster>venkats@agiledeveloper.com</webMaster>
    <item>
      <trackback:ping>http://www.agiledeveloper.com/blog/Trackback.aspx?guid=8a745e85-2a34-4d9c-8c25-ca371530e281</trackback:ping>
      <pingback:server>http://www.agiledeveloper.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=8a745e85-2a34-4d9c-8c25-ca371530e281</pingback:target>
      <wfw:comment>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=8a745e85-2a34-4d9c-8c25-ca371530e281</wfw:comment>
      <wfw:commentRss>http://www.agiledeveloper.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=8a745e85-2a34-4d9c-8c25-ca371530e281</wfw:commentRss>
      <slash:comments>7</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <p>
      I'm sure you've seen your share of long methods—methods that run several hundred lines.<br />
      Some of us may have even written them, probably in those days before we gained our<br />
      wisdom to write better quality code. 
   </p>
        <p>
      Long methods are evil on several grounds: 
   </p>
        <ul>
          <li>
         They're hard to understand</li>
          <li>
         They're hard to change</li>
          <li>
         They're hard to reuse</li>
          <li>
         They're hard to test</li>
          <li>
         They have low cohesion</li>
          <li>
         They may have high coupling</li>
          <li>
         They ten to be overly complex</li>
        </ul>
        <p>
        </p>
        <p>
      Often programmers ask, how "long" is a long method? A method is too long if 
   </p>
        <ul>
          <li>
         you have to scroll down to look at the complete method</li>
          <li>
         it takes several minutes to understand</li>
          <li>
         you can't easily write an automated test for it</li>
          <li>
         you can't state the one prominent purpose for the method</li>
        </ul>
        <p>
        </p>
        <p>
      One easy way to address long methods is to use the so called <a href="http://c2.com/ppr/wiki/WikiPagesAboutRefactoring/ComposedMethod.html" target="_blank">Compose
      Method Patter.</a><br />
      Your methods then focuses on doing one thing and invokes other methods, all of which<br />
      are at the same level of abstraction. The result is shorter, easier to understand
      methods<br />
      in your application. 
   </p>
        <p>
      You say, "OK, I get it, but what about my colleague who has a compulsive disorder
      to 
      <br />
      write very long methods, how do I convince that colleague?" 
   </p>
        <p>
      So you have tried to state the benefits, showed examples, and your colleague still
      does not get it.<br />
      OK, I can suggest one final drastic measure. 
   </p>
        <p>
      On a Monday morning, when you go to work, your colleague asks how your weekend was.<br />
      You could say, "It was good, I took the kids to the movie on Saturday and went to
      the park<br />
      on Sunday." That would be like using compose method pattern. You have stated your
      activities<br />
      at one level of abstraction. If your colleague is interested in more details about
      the movie or the 
      <br />
      park, he or she can drill down into the details further asking you how the movie was,
      and so on. 
   </p>
        <p>
      But, do not reply to that question that way. Instead say, "Over the weekend I got
      into my car, started it,<br />
      drove 5 miles West, took a right turn, then a left turn, then drove another 10 miles,
      ..." Go at it for 
      <br />
      several minutes until your colleague gets frustrated and interrupts you with "What's
      wrong with you."<br />
      Now simply reply, "oh, I though I'll tell you how my weekend way like you write your
      methods." 
   </p>
        <img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=8a745e85-2a34-4d9c-8c25-ca371530e281" />
      </body>
      <title>How to convince your fellow developer to write short methods?</title>
      <guid>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=8a745e85-2a34-4d9c-8c25-ca371530e281</guid>
      <link>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=8a745e85-2a34-4d9c-8c25-ca371530e281</link>
      <pubDate>Mon, 18 May 2009 19:50:57 GMT</pubDate>
      <description>&lt;p&gt;
   I'm sure you've seen your share of long methods—methods that run several hundred lines.&lt;br&gt;
   Some of us may have even written them, probably in those days before we gained our&lt;br&gt;
   wisdom to write better quality code. 
&lt;/p&gt;
&lt;p&gt;
   Long methods are evil on several grounds: 
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      They're hard to understand&lt;/li&gt;
   &lt;li&gt;
      They're hard to change&lt;/li&gt;
   &lt;li&gt;
      They're hard to reuse&lt;/li&gt;
   &lt;li&gt;
      They're hard to test&lt;/li&gt;
   &lt;li&gt;
      They have low cohesion&lt;/li&gt;
   &lt;li&gt;
      They may have high coupling&lt;/li&gt;
   &lt;li&gt;
      They ten to be overly complex&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   Often programmers ask, how "long" is a long method? A method is too long if 
&lt;/p&gt;
&lt;ul&gt;
   &lt;li&gt;
      you have to scroll down to look at the complete method&lt;/li&gt;
   &lt;li&gt;
      it takes several minutes to understand&lt;/li&gt;
   &lt;li&gt;
      you can't easily write an automated test for it&lt;/li&gt;
   &lt;li&gt;
      you can't state the one prominent purpose for the method&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;
&lt;/p&gt;
&lt;p&gt;
   One easy way to address long methods is to use the so called &lt;a href="http://c2.com/ppr/wiki/WikiPagesAboutRefactoring/ComposedMethod.html" target="_blank"&gt;Compose
   Method Patter.&lt;/a&gt;
   &lt;br&gt;
   Your methods then focuses on doing one thing and invokes other methods, all of which&lt;br&gt;
   are at the same level of abstraction. The result is shorter, easier to understand
   methods&lt;br&gt;
   in your application. 
&lt;/p&gt;
&lt;p&gt;
   You say, "OK, I get it, but what about my colleague who has a compulsive disorder
   to 
   &lt;br&gt;
   write very long methods, how do I convince that colleague?" 
&lt;/p&gt;
&lt;p&gt;
   So you have tried to state the benefits, showed examples, and your colleague still
   does not get it.&lt;br&gt;
   OK, I can suggest one final drastic measure. 
&lt;/p&gt;
&lt;p&gt;
   On a Monday morning, when you go to work, your colleague asks how your weekend was.&lt;br&gt;
   You could say, "It was good, I took the kids to the movie on Saturday and went to
   the park&lt;br&gt;
   on Sunday." That would be like using compose method pattern. You have stated your
   activities&lt;br&gt;
   at one level of abstraction. If your colleague is interested in more details about
   the movie or the 
   &lt;br&gt;
   park, he or she can drill down into the details further asking you how the movie was,
   and so on. 
&lt;/p&gt;
&lt;p&gt;
   But, do not reply to that question that way. Instead say, "Over the weekend I got
   into my car, started it,&lt;br&gt;
   drove 5 miles West, took a right turn, then a left turn, then drove another 10 miles,
   ..." Go at it for 
   &lt;br&gt;
   several minutes until your colleague gets frustrated and interrupts you with "What's
   wrong with you."&lt;br&gt;
   Now simply reply, "oh, I though I'll tell you how my weekend way like you write your
   methods." 
&lt;/p&gt;
&lt;img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=8a745e85-2a34-4d9c-8c25-ca371530e281"&gt;</description>
      <comments>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=8a745e85-2a34-4d9c-8c25-ca371530e281</comments>
      <category>Applications</category>
    </item>
    <item>
      <trackback:ping>http://www.agiledeveloper.com/blog/Trackback.aspx?guid=462d366e-209e-4c5b-a04a-e3b7749cf1f5</trackback:ping>
      <pingback:server>http://www.agiledeveloper.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=462d366e-209e-4c5b-a04a-e3b7749cf1f5</pingback:target>
      <wfw:comment>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=462d366e-209e-4c5b-a04a-e3b7749cf1f5</wfw:comment>
      <wfw:commentRss>http://www.agiledeveloper.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=462d366e-209e-4c5b-a04a-e3b7749cf1f5</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">
        <table>
          <tbody>
            <tr>
              <td>
               I'm delighted to announce the Beta Release of the <a href="http://pragprog.com/titles/vsscala" target="_blank">Programming
               Scala</a> book. 
               <br />
               The topics covered in the book are: 
               <ul><li>
                     Introduction</li><li>
                     Getting Started</li><li>
                     Getting up to speed in Scala <i>excerpt</i></li><li>
                     Classes in Scala</li><li>
                     Sensible Typing <i>excerpt</i></li><li>
                     Function Values and Closures</li><li>
                     Traits and Type Conversions <i>excerpt</i></li><li>
                     Using Collections</li><li>
                     Pattern Matching and Regular Expressions</li><li>
                     Concurrent Programming</li><li>
                     Intermixing with Java</li><li>
                     Unit Testing With Scala</li><li>
                     Exception Handling</li><li>
                     Using Scala</li><li>
                     Web Resources</li></ul>
               The Beta release includes the first seven chapters. To download the excerpts from
               the book or for more information, please visit the <a href="http://pragprog.com/titles/vsscala" target="_blank">book
               web page at The Pragmatic Programmers</a>. I want to thank each and everyone who contributed
               into the making of this book, <a href="http://dimsumthinking.com" target="_blank">Dan
               Steinberg</a>, in particular, for editing this book, and the <a href="http://www.pragprog.com" target="_blank">Pragmatic
               Programmers</a> for publishing it. 
            </td>
              <td>
                <a href="http://pragprog.com/titles/vsscala" target="_blank">
                  <img src="http://assets0.pragprog.com/images/covers/190x228/betas/vsscala.jpg?1236205317" />
                </a>
              </td>
            </tr>
          </tbody>
        </table>
        <img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=462d366e-209e-4c5b-a04a-e3b7749cf1f5" />
      </body>
      <title>Programming Scala Beta Release</title>
      <guid>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=462d366e-209e-4c5b-a04a-e3b7749cf1f5</guid>
      <link>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=462d366e-209e-4c5b-a04a-e3b7749cf1f5</link>
      <pubDate>Sat, 04 Apr 2009 18:01:14 GMT</pubDate>
      <description>&lt;table&gt;
   &lt;tbody&gt;
      &lt;tr&gt;
         &lt;td&gt;
            I'm delighted to announce the Beta Release of the &lt;a href="http://pragprog.com/titles/vsscala" target="_blank"&gt;Programming
            Scala&lt;/a&gt; book. 
            &lt;br&gt;
            The topics covered in the book are: 
            &lt;ul&gt;
               &lt;li&gt;
                  Introduction&lt;/li&gt;
               &lt;li&gt;
                  Getting Started&lt;/li&gt;
               &lt;li&gt;
                  Getting up to speed in Scala &lt;i&gt;excerpt&lt;/i&gt;
               &lt;/li&gt;
               &lt;li&gt;
                  Classes in Scala&lt;/li&gt;
               &lt;li&gt;
                  Sensible Typing &lt;i&gt;excerpt&lt;/i&gt;
               &lt;/li&gt;
               &lt;li&gt;
                  Function Values and Closures&lt;/li&gt;
               &lt;li&gt;
                  Traits and Type Conversions &lt;i&gt;excerpt&lt;/i&gt;
               &lt;/li&gt;
               &lt;li&gt;
                  Using Collections&lt;/li&gt;
               &lt;li&gt;
                  Pattern Matching and Regular Expressions&lt;/li&gt;
               &lt;li&gt;
                  Concurrent Programming&lt;/li&gt;
               &lt;li&gt;
                  Intermixing with Java&lt;/li&gt;
               &lt;li&gt;
                  Unit Testing With Scala&lt;/li&gt;
               &lt;li&gt;
                  Exception Handling&lt;/li&gt;
               &lt;li&gt;
                  Using Scala&lt;/li&gt;
               &lt;li&gt;
                  Web Resources&lt;/li&gt;
            &lt;/ul&gt;
            The Beta release includes the first seven chapters. To download the excerpts from
            the book or for more information, please visit the &lt;a href="http://pragprog.com/titles/vsscala" target="_blank"&gt;book
            web page at The Pragmatic Programmers&lt;/a&gt;. I want to thank each and everyone who contributed
            into the making of this book, &lt;a href="http://dimsumthinking.com" target="_blank"&gt;Dan
            Steinberg&lt;/a&gt;, in particular, for editing this book, and the &lt;a href="http://www.pragprog.com" target="_blank"&gt;Pragmatic
            Programmers&lt;/a&gt; for publishing it. 
         &lt;/td&gt;
         &lt;td&gt;
            &lt;a href="http://pragprog.com/titles/vsscala" target="_blank"&gt; &lt;img src="http://assets0.pragprog.com/images/covers/190x228/betas/vsscala.jpg?1236205317"&gt;&lt;/a&gt; 
         &lt;/td&gt;
      &lt;/tr&gt;
   &lt;/tbody&gt;
&lt;/table&gt;
&lt;img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=462d366e-209e-4c5b-a04a-e3b7749cf1f5"&gt;</description>
      <comments>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=462d366e-209e-4c5b-a04a-e3b7749cf1f5</comments>
      <category>Java</category>
    </item>
    <item>
      <trackback:ping>http://www.agiledeveloper.com/blog/Trackback.aspx?guid=b054717e-d8d2-4b4b-8f67-14d64f3e9f97</trackback:ping>
      <pingback:server>http://www.agiledeveloper.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=b054717e-d8d2-4b4b-8f67-14d64f3e9f97</pingback:target>
      <wfw:comment>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=b054717e-d8d2-4b4b-8f67-14d64f3e9f97</wfw:comment>
      <wfw:commentRss>http://www.agiledeveloper.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=b054717e-d8d2-4b4b-8f67-14d64f3e9f97</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I am delighted that the <a href="http://www.nofluffjuststuff.com" target="_blank">NFJS
   2009 Tour starts next week!</a><br /><br /><a href="http://www.nofluffjuststuff.com" target="_blank"><img src="http://www.agiledeveloper.com/blog/content/binary/NFJS_125x125_spkr.jpg" border="0" /></a><br /><br />
   I will be in Milwaukee next weekend and several other cities though the year.<br />
   I can't wait to interact with the smart developers, attendees and speakers, at the<br />
   shows this year.<br /><img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=b054717e-d8d2-4b4b-8f67-14d64f3e9f97" /></body>
      <title>NFJS 2009 Tour Starts Next Week!</title>
      <guid>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=b054717e-d8d2-4b4b-8f67-14d64f3e9f97</guid>
      <link>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=b054717e-d8d2-4b4b-8f67-14d64f3e9f97</link>
      <pubDate>Thu, 19 Feb 2009 21:35:49 GMT</pubDate>
      <description>I am delighted that the &lt;a href="http://www.nofluffjuststuff.com" target="_blank"&gt;NFJS
2009 Tour starts next week!&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://www.nofluffjuststuff.com" target=_blank&gt;&lt;img src="http://www.agiledeveloper.com/blog/content/binary/NFJS_125x125_spkr.jpg" border="0"&gt;&lt;/a&gt;
&lt;br&gt;
&lt;br&gt;
I will be in Milwaukee next weekend and several other cities though the year.&lt;br&gt;
I can't wait to interact with the smart developers, attendees and speakers, at the&lt;br&gt;
shows this year.&lt;br&gt;
&lt;img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=b054717e-d8d2-4b4b-8f67-14d64f3e9f97"&gt;</description>
      <comments>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=b054717e-d8d2-4b4b-8f67-14d64f3e9f97</comments>
      <category>General</category>
    </item>
    <item>
      <trackback:ping>http://www.agiledeveloper.com/blog/Trackback.aspx?guid=3ac56439-566d-4d5b-9b4a-cc9a845323f6</trackback:ping>
      <pingback:server>http://www.agiledeveloper.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=3ac56439-566d-4d5b-9b4a-cc9a845323f6</pingback:target>
      <wfw:comment>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=3ac56439-566d-4d5b-9b4a-cc9a845323f6</wfw:comment>
      <wfw:commentRss>http://www.agiledeveloper.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=3ac56439-566d-4d5b-9b4a-cc9a845323f6</wfw:commentRss>
      <slash:comments>1</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">My son's teacher, Mr. A, has a great idea.
   He invites parents to spend a day in school in their kid's classroom.<br /><br />
   Since I travel so much (last year I travelled 41 weeks) any opportunity to spend time
   with my children is great. My wife suggested that I be the parent to spend a day at
   school. Of course, I kindly accepted. When the day arrived, my wife was nervous. I
   told her I will be myself, and she said "Exactly why I'm worried. Please be quiet."<br />
    <br />
   I attended University and have been teaching at the University for over 16 years and
   so I know what a classroom looks like at a University. However, I've never stepped
   into a school in this country. So, I had no idea what to expect.<br />
           <br />
   "May be Mr. A was pulling a version of 'I am not smarter than a 5th grader' on me,"
   I thought. (He did not, but in the end, that was my  conclusion, even though
   this was one level below the 5th grade).<br /><br />
   The morning started out with students jumping into solving a set of problems for about
   10 minutes. I think this helps to get the students settle down and focus. Mr. M was
   teaching the class this particular day and Mr. A participated in some activities through
   out the day, while attending to some other events that are in the works.<br />
                     
    <br />
   The class plan is very agile. There are three sets of students in the class. Those
   who are at an advance level (they are at a grade or two higher in select areas like
   Math, reading, writing, etc.). Then there are students who at the right level (some
   students at advance level in one area may be at the grade level in other areas). And
   then there are students not quite at the level where they need to be.<br /><br />
   If all of these children were grouped together at all time, the advanced  students
   would feel frustrated and the students catching up would feel overwhelmed. So, a few
   times during the day, the advanced students go to targeted sessions for their area.
   The students who need extra help go to spend time with some volunteers who assist
   them with further coaching. There is still good part of the day when the class spends
   time together.<br /><br />
   The time in class is divided into individual activities and group activities. The
   group activity gives a nice focus. It reminded me of an agile project with collaborative
   development. The kids who are advanced help mentor the other kids. The distracted
   kids are redirected by kids who are focused (I saw kids go through cycles of staying
   focused and being distracted, but the group overall was much more focused most of
   the time).<br /><br />
   One other observation I had (which I think I should do more in my classes) was they
   spend a few minutes on concepts and a lot of time on exercises. The exercises again
   are done in group and then individually as well.<br /><br />
   One thing that I really liked (but needs a lot of effort on the part of the teacher)
   was the variable pace of classwork. The students were working on writing organization.
   Again students were in three groups, ahead, in pace, and slow. The students ahead
   were given an additional exercise to work while the rest of the class was catching
   up. This additional work was a bit more challenging but the kids working on it seem
   to really enjoy it. The kids who are slow are given extra help and time.<br />
               <br />
   Several times during the day I got to evidence the sheer amount of creativity these
   kids have. For almost every problem they solved, students suggested different approaches.
   Some of the approaches surprised me as they were not intuitive or straightforward,
   but they sure were quite good.<br /><br />
   Since they were learning about probability, Mr. M used a spinner to select randomly
   who will answer certain questions. This was giving equal chance for students to participate
   in various activities and answer questions. In the process, the theory of probability
   was being reemphasized.<br /><br />
   I have to say teaching at the school level is a Herculean task. It is fun to work
   with these creative students on one hand, but it is so hard to mange these kids. Their
   attention span is so short and they do silly things all day long. It takes an enormous
   amount of patience (hint: I should never try to apply to teach at an elementary school).<br /><br />
   It so happened that my son gave a 10 minutes presentation on "How the Universe for
   Formed" as an independent study project. I wish I had helped him more on this project,
   but I think he did pretty well without it. Given this was the first time he gave a
   talk in front of people, he did really well. He did make some of the common mistakes
   people make when presenting, but he's learning quick. He identified things he did
   wrong and how he can improve. I have to admit, his first talk was much better than
   my first talk (I apologize to the poor victims of my first talk. No apologies to the
   current victims of my talks, that will have to wait for another blog!).<br /><br />
   What impressed me the most was the questions and answers that followed his presentation.
   As soon as they were given an opportunity to ask questions, they fired with great
   speed and impressive quality. Their questions were quite thought provoking. I said
   to myself, "How old are you kids, again?" The Q &amp; A went almost 10 minutes.<br /><br />
   Overall, I think it was a great opportunity for me to spend the time with my son in
   the class. I learned quite a bit about what it is to be a kid and what it is to be
   their teacher. I am thankful for this opportunity. I hope I will have the privilege
   of visiting and spending a day in class sometime in the future.<img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=3ac56439-566d-4d5b-9b4a-cc9a845323f6" /></body>
      <title>Career Day in Reverse</title>
      <guid>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=3ac56439-566d-4d5b-9b4a-cc9a845323f6</guid>
      <link>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=3ac56439-566d-4d5b-9b4a-cc9a845323f6</link>
      <pubDate>Tue, 10 Feb 2009 18:45:58 GMT</pubDate>
      <description>My son's teacher, Mr. A, has a great idea. He invites parents to spend a day in school in their kid's classroom.&lt;br&gt;
&lt;br&gt;
Since I travel so much (last year I travelled 41 weeks) any opportunity to spend time
with my children is great. My wife suggested that I be the parent to spend a day at
school. Of course, I kindly accepted. When the day arrived, my wife was nervous. I
told her I will be myself, and she said "Exactly why I'm worried. Please be quiet."&lt;br&gt;
&amp;nbsp;&lt;br&gt;
I attended University and have been teaching at the University for over 16 years and
so I know what a classroom looks like at a University. However, I've never stepped
into a school in this country. So, I had no idea what to expect.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br&gt;
"May be Mr. A was pulling a version of 'I am not smarter than a 5th grader' on me,"
I thought. (He did not, but in the end, that was my&amp;nbsp; conclusion, even though
this was one level below the 5th grade).&lt;br&gt;
&lt;br&gt;
The morning started out with students jumping into solving a set of problems for about
10 minutes. I think this helps to get the students settle down and focus. Mr. M was
teaching the class this particular day and Mr. A participated in some activities through
out the day, while attending to some other events that are in the works.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;
&amp;nbsp;&lt;br&gt;
The class plan is very agile. There are three sets of students in the class. Those
who are at an advance level (they are at a grade or two higher in select areas like
Math, reading, writing, etc.). Then there are students who at the right level (some
students at advance level in one area may be at the grade level in other areas). And
then there are students not quite at the level where they need to be.&lt;br&gt;
&lt;br&gt;
If all of these children were grouped together at all time, the advanced&amp;nbsp; students
would feel frustrated and the students catching up would feel overwhelmed. So, a few
times during the day, the advanced students go to targeted sessions for their area.
The students who need extra help go to spend time with some volunteers who assist
them with further coaching. There is still good part of the day when the class spends
time together.&lt;br&gt;
&lt;br&gt;
The time in class is divided into individual activities and group activities. The
group activity gives a nice focus. It reminded me of an agile project with collaborative
development. The kids who are advanced help mentor the other kids. The distracted
kids are redirected by kids who are focused (I saw kids go through cycles of staying
focused and being distracted, but the group overall was much more focused most of
the time).&lt;br&gt;
&lt;br&gt;
One other observation I had (which I think I should do more in my classes) was they
spend a few minutes on concepts and a lot of time on exercises. The exercises again
are done in group and then individually as well.&lt;br&gt;
&lt;br&gt;
One thing that I really liked (but needs a lot of effort on the part of the teacher)
was the variable pace of classwork. The students were working on writing organization.
Again students were in three groups, ahead, in pace, and slow. The students ahead
were given an additional exercise to work while the rest of the class was catching
up. This additional work was a bit more challenging but the kids working on it seem
to really enjoy it. The kids who are slow are given extra help and time.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;br&gt;
Several times during the day I got to evidence the sheer amount of creativity these
kids have. For almost every problem they solved, students suggested different approaches.
Some of the approaches surprised me as they were not intuitive or straightforward,
but they sure were quite good.&lt;br&gt;
&lt;br&gt;
Since they were learning about probability, Mr. M used a spinner to select randomly
who will answer certain questions. This was giving equal chance for students to participate
in various activities and answer questions. In the process, the theory of probability
was being reemphasized.&lt;br&gt;
&lt;br&gt;
I have to say teaching at the school level is a Herculean task. It is fun to work
with these creative students on one hand, but it is so hard to mange these kids. Their
attention span is so short and they do silly things all day long. It takes an enormous
amount of patience (hint: I should never try to apply to teach at an elementary school).&lt;br&gt;
&lt;br&gt;
It so happened that my son gave a 10 minutes presentation on "How the Universe for
Formed" as an independent study project. I wish I had helped him more on this project,
but I think he did pretty well without it. Given this was the first time he gave a
talk in front of people, he did really well. He did make some of the common mistakes
people make when presenting, but he's learning quick. He identified things he did
wrong and how he can improve. I have to admit, his first talk was much better than
my first talk (I apologize to the poor victims of my first talk. No apologies to the
current victims of my talks, that will have to wait for another blog!).&lt;br&gt;
&lt;br&gt;
What impressed me the most was the questions and answers that followed his presentation.
As soon as they were given an opportunity to ask questions, they fired with great
speed and impressive quality. Their questions were quite thought provoking. I said
to myself, "How old are you kids, again?" The Q &amp;amp; A went almost 10 minutes.&lt;br&gt;
&lt;br&gt;
Overall, I think it was a great opportunity for me to spend the time with my son in
the class. I learned quite a bit about what it is to be a kid and what it is to be
their teacher. I am thankful for this opportunity. I hope I will have the privilege
of visiting and spending a day in class sometime in the future.&lt;img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=3ac56439-566d-4d5b-9b4a-cc9a845323f6"&gt;</description>
      <comments>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=3ac56439-566d-4d5b-9b4a-cc9a845323f6</comments>
      <category>General</category>
    </item>
    <item>
      <trackback:ping>http://www.agiledeveloper.com/blog/Trackback.aspx?guid=4b0f3cd1-cee6-467e-b6a1-be0e6c7b815e</trackback:ping>
      <pingback:server>http://www.agiledeveloper.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=4b0f3cd1-cee6-467e-b6a1-be0e6c7b815e</pingback:target>
      <wfw:comment>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=4b0f3cd1-cee6-467e-b6a1-be0e6c7b815e</wfw:comment>
      <wfw:commentRss>http://www.agiledeveloper.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=4b0f3cd1-cee6-467e-b6a1-be0e6c7b815e</wfw:commentRss>
      <slash:comments>0</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">The Houston TechFest was delayed due to
   Hurricane Ike back in September.<br />
   The rescheduled event is happening on January 24th. You can find details about<br />
   the event at <a href="http://www.houstontechfest.com" target="_blank">http://www.houstontechfest.com</a>.<br /><img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=4b0f3cd1-cee6-467e-b6a1-be0e6c7b815e" /></body>
      <title>Houston TechFest</title>
      <guid>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=4b0f3cd1-cee6-467e-b6a1-be0e6c7b815e</guid>
      <link>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=4b0f3cd1-cee6-467e-b6a1-be0e6c7b815e</link>
      <pubDate>Sat, 10 Jan 2009 15:36:30 GMT</pubDate>
      <description>The Houston TechFest was delayed due to Hurricane Ike back in September.&lt;br&gt;
The rescheduled event is happening on January 24th. You can find details about&lt;br&gt;
the event at &lt;a href="http://www.houstontechfest.com" target="_blank"&gt;http://www.houstontechfest.com&lt;/a&gt;.&lt;br&gt;
&lt;img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=4b0f3cd1-cee6-467e-b6a1-be0e6c7b815e"&gt;</description>
      <comments>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=4b0f3cd1-cee6-467e-b6a1-be0e6c7b815e</comments>
      <category>Software Practices</category>
    </item>
    <item>
      <trackback:ping>http://www.agiledeveloper.com/blog/Trackback.aspx?guid=ce021e6d-b0c2-4d83-8b69-c163c290983d</trackback:ping>
      <pingback:server>http://www.agiledeveloper.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=ce021e6d-b0c2-4d83-8b69-c163c290983d</pingback:target>
      <wfw:comment>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=ce021e6d-b0c2-4d83-8b69-c163c290983d</wfw:comment>
      <wfw:commentRss>http://www.agiledeveloper.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=ce021e6d-b0c2-4d83-8b69-c163c290983d</wfw:commentRss>
      <slash:comments>0</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I wrote a four part article for Java World
   on creating DSLs in Java and Groovy.<br />
   For your convenience, I decided to list the links to those parts here:<br /><br /><br /><br /><a href="http://www.javaworld.com/javaworld/jw-06-2008/jw-06-dsls-in-java-1.html" target="_blank">Creating
   DSLs in Java, Part 1: What is a domain-specific language?</a><br /><a href="http://www.javaworld.com/javaworld/jw-07-2008/jw-07-dsls-in-java-2.html" target="_blank">Creating
   DSLs in Java, Part 2: Fluency and context</a><br /><a href="http://www.javaworld.com/javaworld/jw-08-2008/jw-08-dsls-in-java-3.html" target="_blank">Creating
   DSLs in Java, Part 3: Internal and external DSLs</a><br /><a href="http://www.javaworld.com/javaworld/jw-09-2008/jw-09-dsls-in-java-4.html?page=4" target="_blank">Creating
   DSLs in Java, Part 4: Where metaprogramming matters</a><img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=ce021e6d-b0c2-4d83-8b69-c163c290983d" /></body>
      <title>Article: DSL in Java and Groovy</title>
      <guid>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=ce021e6d-b0c2-4d83-8b69-c163c290983d</guid>
      <link>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=ce021e6d-b0c2-4d83-8b69-c163c290983d</link>
      <pubDate>Thu, 25 Sep 2008 22:50:00 GMT</pubDate>
      <description>I wrote a four part article for Java World on creating DSLs in Java and Groovy.&lt;br&gt;
For your convenience, I decided to list the links to those parts here:&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;br&gt;
&lt;a href="http://www.javaworld.com/javaworld/jw-06-2008/jw-06-dsls-in-java-1.html" target=_blank&gt;Creating
DSLs in Java, Part 1: What is a domain-specific language?&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://www.javaworld.com/javaworld/jw-07-2008/jw-07-dsls-in-java-2.html" target=_blank&gt;Creating
DSLs in Java, Part 2: Fluency and context&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://www.javaworld.com/javaworld/jw-08-2008/jw-08-dsls-in-java-3.html" target=_blank&gt;Creating
DSLs in Java, Part 3: Internal and external DSLs&lt;/a&gt;
&lt;br&gt;
&lt;a href="http://www.javaworld.com/javaworld/jw-09-2008/jw-09-dsls-in-java-4.html?page=4" target=_blank&gt;Creating
DSLs in Java, Part 4: Where metaprogramming matters&lt;/a&gt; &lt;img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=ce021e6d-b0c2-4d83-8b69-c163c290983d"&gt;</description>
      <comments>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=ce021e6d-b0c2-4d83-8b69-c163c290983d</comments>
      <category>Groovy</category>
    </item>
    <item>
      <trackback:ping>http://www.agiledeveloper.com/blog/Trackback.aspx?guid=f2144324-8835-41b4-bea1-cdf7e5a47a82</trackback:ping>
      <pingback:server>http://www.agiledeveloper.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=f2144324-8835-41b4-bea1-cdf7e5a47a82</pingback:target>
      <wfw:comment>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=f2144324-8835-41b4-bea1-cdf7e5a47a82</wfw:comment>
      <wfw:commentRss>http://www.agiledeveloper.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=f2144324-8835-41b4-bea1-cdf7e5a47a82</wfw:commentRss>
      <slash:comments>7</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">As programmers, we prefer languages, frameworks,
   and APIs that allow us to express ourselves<br />
   in fewer lines of code than in several lines of code. We have sung the praises for
   those that promote<br />
   fluency and ease.<br /><br />
   However, aiming for fewer lines of code is not a good thing always. The question to<br />
   ask is, if the code is merely terse or is it concise.<br /><br />
   Terse code, just like concise code, is small. But, terse code is treacherous.<br />
   It can easily elude you by either making it hard to follow and/or make it incorrect.<br /><br />
   Consider the following Java/JUnit test example (you can use similar example with C#
   and NUnit<br />
   as well—the problem is the same).<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">@Test<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">void</span> convertCtoF()<br />
      {<br />
        _converter.from(TemperatureUnit.C);<br />
        _converter.to(TemperatureUnit.F);<br />
        Assert.assertEquals(50.0, _converter.convert(10), 0);<br />
      }<br /></span></p>
   In JUnit 4.0, instead of declaring<span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"> public</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">void</span> testConvertCtoF()</span>you
   are able to use annotation to indicate that<span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"><br />
   ConvertCtoF()</span> is a test method. JUnit 4.0 promotes conciseness—you did
   not have to inherit the test class from<br />
   a<span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"> TestCase</span> base
   class and that is good. The above code tests the<span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"> convert()</span> method
   of a<span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"> TemperatureConverter</span> class.<br /><br />
   Now, suppose I want to write an exception test to indicate that the convert() method
   of<br />
   the <span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">TemperatureConverter</span> will
   fail if input value if too large. Here is test for that:<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">@Test<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">void</span> convertCtoFFailureForLargeValue()<br />
      {<br />
        _converter.from(TemperatureUnit.C);<br />
        _converter.to(TemperatureUnit.F);<br />
        <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">try</span><br />
        {<br />
          _converter.convert(Double.MAX_VALUE);<br />
          Assert.fail(<span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;">"Expected
      exception due to overflow"</span>);<br />
        }<br />
        <span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">catch</span>(ConverterException
      ex)<br />
        {<br />
          Assert.assertTrue(<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">true</span>); <span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;">//
      :) Success</span><br />
        }<br />
      }<br /></span></p>
   The above exception test passes because the expected exception was thrown by the <span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">convert()</span> method.<br /><br />
   As an astute reader familiar with JUnit 4.0, you'd point out that I have not taken
   advantage of expressive<br />
   syntax to perform exception test. Rather than writing the clumsy <span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">try/catch</span> block
   with a call to the <span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">fail()<br /></span>method, I should've used the annotation that indicates the desired exception?
   Let's see how that would look:<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">@Test(expected=ConverterException.<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">class</span>)<br /><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">public</span><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">void</span> convertCtoFFailureForLargeValueLite()<br />
      {<br />
         _converter.from(TemperatureUnit.C);<br />
        _converter.to(TemperatureUnit.C);<br />
        _converter.convert(Double.MAX_VALUE);<br />
      }<br /></span></p>
   If you run this test, just like the previous test, this test would pass as well since
   the<br /><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">ConverterException </span>was
   thrown. The code size is certainly smaller, but this is an example<br />
   of terse code and it is wrong—it is not equivalent to the previous longer version.
   Sadly, 
   <br />
   JUnit 4.0 also promotes terseness.<br /><br />
   This example illustrates why I am not a big fan of annotation based exception testing
   and<br />
   why I consider it to be terse rather than being concise.<br />
                        
   <br />
   Even though the test passed, it passed for the wrong reason. It passed because the
   method<br /><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">to()</span> threw
   the exception in this case (because I inadvertently set the same unit for conversion<br />
   for from and to), and the test did not even reach the <span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">convert()</span>method.<br /><br /><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">@Test(expected=ConverterException.<span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">class</span>)</span> is
   terse and lacks the granularity that the <span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">try/catch</span> block<br />
   provides. It does not tell you which method within the test actually threw the exception
   you're<br />
   expecting. This is the same problem with the <span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">[ExpectedException(...)] </span>attribute
   in C# (NUnit and<br />
   VS testing tool)—it is terse and lacks graularity.<br /><br />
   If you are using Java or C# to test your code, I say the longer verbose version is
   actually better<br />
   than the terse version.<br /><br />
   If you are using Groovy or JRuby to test your Java code (or plan to use IronRuby to
   test<br />
   your C# code), you can enjoy a concise syntax to write this test.<br /><br />
   Here is a Groovy example to test the <span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">TemperatureConverter</span>:<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"><span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;">void</span> testConvertCtoFFailureForLargeValueConcise()<br />
      {<br />
        _converter.from(TemperatureUnit.C);<br />
        _converter.to(TemperatureUnit.F);<br />
        shouldFail {_converter.convert(Double.MAX_VALUE);}<br />
      }<br /></span></p>
   The call to <span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">convert()</span> method
   is placed in a closure block that is provided as parameter to the<br /><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">shouldFail()</span> method.
   If the <span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">from()</span> or
   the <span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">to()</span> method
   were to thrown an exception, the test will<br />
   fail. Also, if the <span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">convert()</span> method
   does not throw an exception, the test will fail. The way this test<br />
   is written, you are expecting the <span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">convert()</span> method
   to throw an exception. You can be precise about<br />
   which exception you expect as follows:<br /><p><span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">shouldFail
      ConverterException, {_converter.convert(Double.MAX_VALUE);}<br /></span></p>
   The <span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;">shouldFail()</span> method
   can take two parameters, the first parameter is the name/type of the<br />
   exception it expects, and the second is the closure block that contains the code that
   is expected to<br />
   throw the mentioned exception.<br /><br />
   While the annotation based exception testing illustrates <i>terseness</i>, the closure
   based approach<br />
   shows <b><i>conciseness</i></b>. Both let you type fewer lines of code, but one is
   elusive while the other is expressive.<br />
   When you come across APIs, evaluate whether they are terse or concise. Prefer conciseness
   over terseness.<br /><img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=f2144324-8835-41b4-bea1-cdf7e5a47a82" /></body>
      <title>Prefer Conciseness over Terseness</title>
      <guid>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=f2144324-8835-41b4-bea1-cdf7e5a47a82</guid>
      <link>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=f2144324-8835-41b4-bea1-cdf7e5a47a82</link>
      <pubDate>Mon, 08 Sep 2008 03:30:02 GMT</pubDate>
      <description>As programmers, we prefer languages, frameworks, and APIs that allow us to express ourselves&lt;br&gt;
in fewer lines of code than in several lines of code. We have sung the praises for
those that promote&lt;br&gt;
fluency and ease.&lt;br&gt;
&lt;br&gt;
However, aiming for fewer lines of code is not a good thing always. The question to&lt;br&gt;
ask is, if the code is merely terse or is it concise.&lt;br&gt;
&lt;br&gt;
Terse code, just like concise code, is small. But, terse code is treacherous.&lt;br&gt;
It can easily elude you by either making it hard to follow and/or make it incorrect.&lt;br&gt;
&lt;br&gt;
Consider the following Java/JUnit test example (you can use similar example with C#
and NUnit&lt;br&gt;
as well—the problem is the same).&lt;br&gt;
&lt;p&gt;
   &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;@Test&lt;br&gt;
   &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; convertCtoF()&lt;br&gt;
   {&lt;br&gt;
   &amp;nbsp; _converter.from(TemperatureUnit.C);&lt;br&gt;
   &amp;nbsp; _converter.to(TemperatureUnit.F);&lt;br&gt;
   &amp;nbsp; Assert.assertEquals(50.0, _converter.convert(10), 0);&lt;br&gt;
   }&lt;br&gt;
   &lt;/span&gt;
&lt;/p&gt;
In JUnit 4.0, instead of declaring&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt; public&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; testConvertCtoF()&lt;/span&gt;you
are able to use annotation to indicate that&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;
&lt;br&gt;
ConvertCtoF()&lt;/span&gt;&amp;nbsp;is a test method. JUnit 4.0 promotes conciseness—you did
not have to inherit the test class from&lt;br&gt;
a&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt; TestCase&lt;/span&gt; base
class and that is good. The above code tests the&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt; convert()&lt;/span&gt; method
of a&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt; TemperatureConverter&lt;/span&gt; class.&lt;br&gt;
&lt;br&gt;
Now, suppose I want to write an exception test to indicate that the convert() method
of&lt;br&gt;
the &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;TemperatureConverter&lt;/span&gt; will
fail if input value if too large. Here is test for that:&lt;br&gt;
&lt;p&gt;
   &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;@Test&lt;br&gt;
   &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; convertCtoFFailureForLargeValue()&lt;br&gt;
   {&lt;br&gt;
   &amp;nbsp; _converter.from(TemperatureUnit.C);&lt;br&gt;
   &amp;nbsp; _converter.to(TemperatureUnit.F);&lt;br&gt;
   &amp;nbsp; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;try&lt;/span&gt;
   &lt;br&gt;
   &amp;nbsp; {&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp; _converter.convert(Double.MAX_VALUE);&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.fail(&lt;span style="color: rgb(102, 102, 102); background-color: rgb(228, 228, 228); font-family: Courier New; font-size: 11px;"&gt;"Expected
   exception due to overflow"&lt;/span&gt;);&lt;br&gt;
   &amp;nbsp; }&lt;br&gt;
   &amp;nbsp; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;catch&lt;/span&gt;(ConverterException
   ex)&lt;br&gt;
   &amp;nbsp; {&lt;br&gt;
   &amp;nbsp;&amp;nbsp;&amp;nbsp; Assert.assertTrue(&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;true&lt;/span&gt;); &lt;span style="color: Green; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;//
   :) Success&lt;/span&gt;
   &lt;br&gt;
   &amp;nbsp; }&lt;br&gt;
   }&lt;br&gt;
   &lt;/span&gt;
&lt;/p&gt;
The above exception test passes because the expected exception was thrown by the &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;convert()&lt;/span&gt; method.&lt;br&gt;
&lt;br&gt;
As an astute reader familiar with JUnit 4.0, you'd point out that I have not taken
advantage of expressive&lt;br&gt;
syntax to perform exception test. Rather than writing the clumsy &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;try/catch&lt;/span&gt; block
with a call to the &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;fail()&lt;br&gt;
&lt;/span&gt;method, I should've used the annotation that indicates the desired exception?
Let's see how that would look:&lt;br&gt;
&lt;p&gt;
   &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;@Test(expected=ConverterException.&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;class&lt;/span&gt;)&lt;br&gt;
   &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;public&lt;/span&gt; &lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; convertCtoFFailureForLargeValueLite()&lt;br&gt;
   {&lt;br&gt;
   &amp;nbsp;&amp;nbsp; _converter.from(TemperatureUnit.C);&lt;br&gt;
   &amp;nbsp; _converter.to(TemperatureUnit.C);&lt;br&gt;
   &amp;nbsp; _converter.convert(Double.MAX_VALUE);&lt;br&gt;
   }&lt;br&gt;
   &lt;/span&gt;
&lt;/p&gt;
If you run this test, just like the previous test, this test would pass as well since
the&lt;br&gt;
&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;ConverterException &lt;/span&gt;was
thrown. The code size is certainly smaller, but this is an example&lt;br&gt;
of terse code and it is wrong—it is not equivalent to the previous longer version.
Sadly, 
&lt;br&gt;
JUnit 4.0 also promotes terseness.&lt;br&gt;
&lt;br&gt;
This example illustrates why I am not a big fan of annotation based exception testing
and&lt;br&gt;
why I consider it to be terse rather than being concise.&lt;br&gt;
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&lt;br&gt;
Even though the test passed, it passed for the wrong reason. It passed because the
method&lt;br&gt;
&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;to()&lt;/span&gt; threw
the exception in this case (because I inadvertently set the same unit for conversion&lt;br&gt;
for from and to), and the test did not even reach the &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;convert()&lt;/span&gt;method.&lt;br&gt;
&lt;br&gt;
&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;@Test(expected=ConverterException.&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;class&lt;/span&gt;)&lt;/span&gt; is
terse and lacks the granularity that the &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;try/catch&lt;/span&gt; block&lt;br&gt;
provides. It does not tell you which method within the test actually threw the exception
you're&lt;br&gt;
expecting. This is the same problem with the &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;[ExpectedException(...)] &lt;/span&gt;attribute
in C# (NUnit and&lt;br&gt;
VS testing tool)—it is terse and lacks graularity.&lt;br&gt;
&lt;br&gt;
If you are using Java or C# to test your code, I say the longer verbose version is
actually better&lt;br&gt;
than the terse version.&lt;br&gt;
&lt;br&gt;
If you are using Groovy or JRuby to test your Java code (or plan to use IronRuby to
test&lt;br&gt;
your C# code), you can enjoy a concise syntax to write this test.&lt;br&gt;
&lt;br&gt;
Here is a Groovy example to test the &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;TemperatureConverter&lt;/span&gt;:&lt;br&gt;
&lt;p&gt;
   &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;&lt;span style="color: Blue; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;void&lt;/span&gt; testConvertCtoFFailureForLargeValueConcise()&lt;br&gt;
   {&lt;br&gt;
   &amp;nbsp; _converter.from(TemperatureUnit.C);&lt;br&gt;
   &amp;nbsp; _converter.to(TemperatureUnit.F);&lt;br&gt;
   &amp;nbsp; shouldFail {_converter.convert(Double.MAX_VALUE);}&lt;br&gt;
   }&lt;br&gt;
   &lt;/span&gt;
&lt;/p&gt;
The call to &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;convert()&lt;/span&gt; method
is placed in a closure block that is provided as parameter to the&lt;br&gt;
&lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;shouldFail()&lt;/span&gt; method.
If the &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;from()&lt;/span&gt; or
the &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;to()&lt;/span&gt; method
were to thrown an exception, the test will&lt;br&gt;
fail. Also, if the &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;convert()&lt;/span&gt; method
does not throw an exception, the test will fail. The way this test&lt;br&gt;
is written, you are expecting the &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;convert()&lt;/span&gt; method
to throw an exception. You can be precise about&lt;br&gt;
which exception you expect as follows:&lt;br&gt;
&lt;p&gt;
   &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;shouldFail
   ConverterException, {_converter.convert(Double.MAX_VALUE);}&lt;br&gt;
   &lt;/span&gt;
&lt;/p&gt;
The &lt;span style="color: Black; background-color: transparent; font-family: Courier New; font-size: 11px;"&gt;shouldFail()&lt;/span&gt; method
can take two parameters, the first parameter is the name/type of the&lt;br&gt;
exception it expects, and the second is the closure block that contains the code that
is expected to&lt;br&gt;
throw the mentioned exception.&lt;br&gt;
&lt;br&gt;
While the annotation based exception testing illustrates &lt;i&gt;terseness&lt;/i&gt;, the closure
based approach&lt;br&gt;
shows &lt;b&gt;&lt;i&gt;conciseness&lt;/i&gt;&lt;/b&gt;. Both let you type fewer lines of code, but one is
elusive while the other is expressive.&lt;br&gt;
When you come across APIs, evaluate whether they are terse or concise. Prefer conciseness
over terseness.&lt;br&gt;
&lt;img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=f2144324-8835-41b4-bea1-cdf7e5a47a82"&gt;</description>
      <comments>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=f2144324-8835-41b4-bea1-cdf7e5a47a82</comments>
      <category>Software Practices</category>
    </item>
    <item>
      <trackback:ping>http://www.agiledeveloper.com/blog/Trackback.aspx?guid=8e745568-d5eb-43d3-8d1e-1bd7e7009311</trackback:ping>
      <pingback:server>http://www.agiledeveloper.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=8e745568-d5eb-43d3-8d1e-1bd7e7009311</pingback:target>
      <wfw:comment>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=8e745568-d5eb-43d3-8d1e-1bd7e7009311</wfw:comment>
      <wfw:commentRss>http://www.agiledeveloper.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=8e745568-d5eb-43d3-8d1e-1bd7e7009311</wfw:commentRss>
      <slash:comments>3</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I am delighted to receive copies of the
   Japanese edition of "Practices of an Agile Developer."<br />
   It's nice to see Thirukural verses translated to Japanese in the book!<br /><br /><img src="http://www.agiledeveloper.com/blog/content/binary/pad_japanese.jpg" border="0" height="623" width="451" /><img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=8e745568-d5eb-43d3-8d1e-1bd7e7009311" /></body>
      <title>PAD in Japanese</title>
      <guid>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=8e745568-d5eb-43d3-8d1e-1bd7e7009311</guid>
      <link>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=8e745568-d5eb-43d3-8d1e-1bd7e7009311</link>
      <pubDate>Fri, 05 Sep 2008 14:14:15 GMT</pubDate>
      <description>I am delighted to receive copies of the Japanese edition of "Practices of an Agile Developer."&lt;br&gt;
It's nice to see Thirukural verses translated to Japanese in the book!&lt;br&gt;
&lt;br&gt;
&lt;img src="http://www.agiledeveloper.com/blog/content/binary/pad_japanese.jpg" border="0" height="623" width="451"&gt;&lt;img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=8e745568-d5eb-43d3-8d1e-1bd7e7009311"&gt;</description>
      <comments>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=8e745568-d5eb-43d3-8d1e-1bd7e7009311</comments>
      <category>General</category>
    </item>
    <item>
      <trackback:ping>http://www.agiledeveloper.com/blog/Trackback.aspx?guid=f8e19f4d-b2dd-4131-a33c-b68af84f4c7c</trackback:ping>
      <pingback:server>http://www.agiledeveloper.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=f8e19f4d-b2dd-4131-a33c-b68af84f4c7c</pingback:target>
      <wfw:comment>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=f8e19f4d-b2dd-4131-a33c-b68af84f4c7c</wfw:comment>
      <wfw:commentRss>http://www.agiledeveloper.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=f8e19f4d-b2dd-4131-a33c-b68af84f4c7c</wfw:commentRss>
      <slash:comments>0</slash:comments>
      <body xmlns="http://www.w3.org/1999/xhtml">I got an email from Dan Sline about the
   upcoming <a href="http://www.houstontechfest.com/dotnetnuke/default.aspx" target="_blank">Houston
   Techfest</a>. Some of the brightest minds in Houston are putting together<br />
   this event and the topics and speaker line up looks pretty interesting. If you're
   in the Houston vicinity, I encourage you to attend.<br /><img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=f8e19f4d-b2dd-4131-a33c-b68af84f4c7c" /></body>
      <title>Houston Techfest</title>
      <guid>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=f8e19f4d-b2dd-4131-a33c-b68af84f4c7c</guid>
      <link>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=f8e19f4d-b2dd-4131-a33c-b68af84f4c7c</link>
      <pubDate>Fri, 29 Aug 2008 23:43:55 GMT</pubDate>
      <description>I got an email from Dan Sline about the upcoming &lt;a href="http://www.houstontechfest.com/dotnetnuke/default.aspx" target=_blank&gt;Houston
Techfest&lt;/a&gt;. Some of the brightest minds in Houston are putting together&lt;br&gt;
this event and the topics and speaker line up looks pretty interesting. If you're
in the Houston vicinity, I encourage you to attend.&lt;br&gt;
&lt;img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=f8e19f4d-b2dd-4131-a33c-b68af84f4c7c"&gt;</description>
      <comments>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=f8e19f4d-b2dd-4131-a33c-b68af84f4c7c</comments>
      <category>General</category>
    </item>
    <item>
      <trackback:ping>http://www.agiledeveloper.com/blog/Trackback.aspx?guid=678e8c1a-11d3-4dfe-9974-06728031226d</trackback:ping>
      <pingback:server>http://www.agiledeveloper.com/blog/pingback.aspx</pingback:server>
      <pingback:target>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=678e8c1a-11d3-4dfe-9974-06728031226d</pingback:target>
      <wfw:comment>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=678e8c1a-11d3-4dfe-9974-06728031226d</wfw:comment>
      <wfw:commentRss>http://www.agiledeveloper.com/blog/SyndicationService.asmx/GetEntryCommentsRss?guid=678e8c1a-11d3-4dfe-9974-06728031226d</wfw:commentRss>
      <slash:comments>0</slash:comments>
      <title>New Groovy and Grails book</title>
      <guid>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=678e8c1a-11d3-4dfe-9974-06728031226d</guid>
      <link>http://www.agiledeveloper.com/blog/PermaLink.aspx?guid=678e8c1a-11d3-4dfe-9974-06728031226d</link>
      <pubDate>Tue, 05 Aug 2008 13:18:28 GMT</pubDate>
      <description>&lt;table&gt;
   &lt;tr&gt;
      &lt;td&gt;
         I received a copy of "Beginning Groovy and Grails—From Novice to Professional" book
         by Apress written by&lt;br&gt;
         Christopher M. Judd, Joseph Faisal Nusairat, and James Shingler. The book takes you
         quickly through concepts of Groovy in the first three chapters and then takes you
         into the depth of building Web Applications using Grails in the rest of the book.
         If you are looking into starting out with Grails, this is certainly a book for you.
         Congratulations to the authors.&lt;/td&gt;
      &lt;td&gt;
         &lt;a href="http://www.amazon.com/Beginning-Groovy-Grails-Novice-Professional/dp/1430210451" target=_blank&gt; &lt;img src="http://www.beginninggroovyandgrails.com/images/Groovy&amp;GrailsBookCover.jpg" width="200" height="250" /&gt;&lt;/a&gt; 
      &lt;/td&gt;
   &lt;/tr&gt;
   &lt;img width="0" height="0" src="http://www.agiledeveloper.com/blog/aggbug.ashx?id=678e8c1a-11d3-4dfe-9974-06728031226d"&gt;</description>
      <comments>http://www.agiledeveloper.com/blog/CommentView.aspx?guid=678e8c1a-11d3-4dfe-9974-06728031226d</comments>
      <category>Groovy</category>
    </item>
  </channel>
</rss>