<?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>Object Mentor Blog: Notes from the OkC Dojo 2009-09-30</title>
    <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description></description>
    <item>
      <title>Notes from the OkC Dojo 2009-09-30</title>
      <description>&lt;p&gt;Tonight we had a small group of die-hard practitioners working with Ruby and RSpec. We intended to use the Randori style, but it was a small enough group that we were a bit more informal than that.&lt;/p&gt;


	&lt;p&gt;We tried the Shunting Yard Algorithm again and it worked out fairly well. The level of experience in Ruby was low to moderate (which is why we wanted to get people a chance to practice it) and the RSpec experience was generally low (again, great reason to give it a try).&lt;/p&gt;


We had several interesting (at least to me) side discussions on things such as:
	&lt;ul&gt;
	&lt;li&gt;Forth&lt;/li&gt;
		&lt;li&gt;Operator precedence&lt;/li&gt;
		&lt;li&gt;Operator associativity&lt;/li&gt;
		&lt;li&gt;L-Values and R-Values&lt;/li&gt;
		&lt;li&gt;Directed Acyclic Graphis&lt;/li&gt;
		&lt;li&gt;In-fix, pre-fix, post-fix binary tree traversal&lt;/li&gt;
		&lt;li&gt;Abstract Syntax Trees (AST)&lt;/li&gt;
		&lt;li&gt;The list goes on, I&amp;#8217;m a big-time extrovert, so I told Chad to occasionally tell me to shut the heck up&lt;/li&gt;
	&lt;/ul&gt;


The Shunting Yard Algorithm is a means of translating an in-fix expression into a post-fix expression (a.k.a. reverse polish notation &amp;#8211; used by the best calculators in the world, HP [I also prefer vi, fyi!-] ). For example:
	&lt;ul&gt;
	&lt;li&gt;1 + 3 becomes 1 3 +&lt;/li&gt;
		&lt;li&gt;a = b = 17 becomes a b 17 = =&lt;/li&gt;
		&lt;li&gt;2 + 3 * 5 becomes 2 3 5 * +&lt;/li&gt;
		&lt;li&gt;2 * 3 + 5 becomes 2 3 * 5 +&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;One typical approach to this problem is to develop an &lt;span class="caps"&gt;AST&lt;/span&gt; from the in-fix representation and then recursively traversing the &lt;span class="caps"&gt;AST&lt;/span&gt; using a recursive post-fix traversal.&lt;/p&gt;


	&lt;p&gt;What I like about he Shunting Yard Algorithm is it takes a traditionally recursive algorithm (DAG traversal, where a binary tree is a degenerate &lt;span class="caps"&gt;DAG&lt;/span&gt;) and writes it iteratively using it&amp;#8217;s own stack (local or instance variable) storage versus using the program stack to store activation records (OK stack frames). Essentially, the local stack is used for pending work.&lt;/p&gt;


	&lt;p&gt;This is one of those things I think is a useful skill to learn: writing traditionally recursive algorithms using a stack-based approach. This allows you to step through something (think iteration) versus having to do things whole-hog (recursively, with a block (lambda) passed in). In fact, I bought a used algorithm book 20 years ago because it had a second on this subject. And looking over my left shoulder, I just saw that book. Nice.&lt;/p&gt;


	&lt;p&gt;To illustrate, here&amp;#8217;s the &lt;span class="caps"&gt;AST&lt;/span&gt; for the first example:&lt;p/&gt;
&lt;img src="http://yuml.me/3e75c5ce" /&gt;&lt;/p&gt;


Since the group had not done a lot with recursive algorithms (at least not recently), we discussed a short hand way to remember the various traversal algorithms using three letters: L, R, P
	&lt;ul&gt;
	&lt;li&gt;L -&amp;gt; Go Left&lt;/li&gt;
		&lt;li&gt;R -&amp;gt; Go Right&lt;/li&gt;
		&lt;li&gt;P -&amp;gt; Print (or process)&lt;/li&gt;
	&lt;/ul&gt;


Each of the three traditional traversal algorithms (for a binary tree) use just these three letters. And the way to remember each is to put the &amp;#8216;p&amp;#8217; where the name suggests. For example:
	&lt;ul&gt;
	&lt;li&gt;in-fix, in -&amp;gt; in between -&amp;gt; L &lt;b&gt;P&lt;/b&gt; R&lt;/li&gt;
		&lt;li&gt;pre-fix, pre, before -&amp;gt; &lt;b&gt;P&lt;/b&gt; L R&lt;/li&gt;
		&lt;li&gt;post-fix, post, after -&amp;gt; &lt;span class="caps"&gt;L R&lt;/span&gt; &lt;b&gt;P&lt;/b&gt;&lt;/li&gt;
	&lt;/ul&gt;


Then, given the graph above, you can traverse it as follows:
	&lt;ul&gt;
	&lt;li&gt;in-fix: Go left, you hit the 1, it&amp;#8217;s a leaf note so print it, go up to the +, print it, go to the right, you end up with 1 + 3&lt;/li&gt;
		&lt;li&gt;post-fix: Go left you hit the 1, it&amp;#8217;s a leaf node, print it, go back to the +, since this is post-fix, don&amp;#8217;t print yet, go to the right, you get the 3, it&amp;#8217;s a leaf node, print it, then finally print the +, giving: 1 3 +&lt;/li&gt;
		&lt;li&gt;pre-fix: start at + and print it, then go left, it&amp;#8217;s a leaf note, print it, go right, it&amp;#8217;s a leaf node, print it, so you get: + 1 3 &amp;#8211; which looks like a function call (think operator+(1, 3))&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;It&amp;#8217;s not quite this simple &amp;#8211; we actually looked at larger examples &amp;#8211; but this gets the essence across. And to move from a tree to a &lt;span class="caps"&gt;DAG&lt;/span&gt;, simply iterate over all children, printing before or after the complete iteration; in-fix doesn&amp;#8217;t make as much sense in a general &lt;span class="caps"&gt;DAG&lt;/span&gt;. We also discussed tracking the visited nodes if you&amp;#8217;ve got a graph versus an acyclic graph.&lt;/p&gt;


	&lt;p&gt;After we got a multi-operator expression with same-precedence operators working, e.g., 1 + 3 &amp;#8211; 2, which results in: 1 3 + 2 -, we moved on to handling different operator precedence.&lt;/p&gt;


	&lt;p&gt;Around this time, there was some skepticism that post-fix could represent the same expression as in-fix. This is normal, if you have not seen these kinds of representations. And let&amp;#8217;s be frank, how often do most of us deal with these kinds of things? Not often.&lt;/p&gt;


	&lt;p&gt;Also, there was another question: &lt;span class="caps"&gt;WHY&lt;/span&gt;?&lt;/p&gt;


	&lt;p&gt;In a nutshell, with a post-fix notation, you do not need parentheses. As soon as an operator is encountered, you can immediately process it rather than waiting until the next token to complete the operator (no look-ahead required). This also led to HP developing a calculator in 1967 (or &amp;#8216;68) that was &amp;lt; 50 pounds and around &lt;span class="caps"&gt;USD&lt;/span&gt; $5,000 that could add, subtract, multiply and divide, which was&lt;i&gt; &lt;b&gt;huge&lt;/b&gt;&lt;/i&gt; at the time (with a stack size of 3 &amp;#8211; later models went to a stack size of 4, giving us the x, y, z and t registers).&lt;/p&gt;


	&lt;p&gt;During this rat-hole, we discussed associativity. For example, a = b = c is really (a = (b = c))&lt;/p&gt;


	&lt;p&gt;That&amp;#8217;s because the assignment operator is right-associative. This lead into r-values and l-values.&lt;/p&gt;


Anyway, we&amp;#8217;re going to meet again next week. Because we (read this as me) were not disciplined in following the Randori style, these side discussions lead to taking a long to fix a problem. We should have &amp;#8220;hit the reset button&amp;#8221; sooner, so next time around we&amp;#8217;re going to add a bit more structure to see what happens:
	&lt;ul&gt;
	&lt;li&gt;The driver finishes by writing a new failing test.&lt;/li&gt;
		&lt;li&gt;The driver commits the code with the newest failing test (we&amp;#8217;ll be using git)&lt;/li&gt;
		&lt;li&gt;Change drivers and give him/her some time-box (5 &amp;#8211; 10 minutes)&lt;/li&gt;
		&lt;li&gt;If, at the end of the current time-box, the current driver has all tests passing, go back to the first bullet in this list.&lt;/li&gt;
		&lt;li&gt;If at the end, the same test that was failing is still failing, (fist time only) give them a bit more time.&lt;/li&gt;
		&lt;li&gt;However, if any other tests are failing, then we revert back to the last check in and switch drivers.&lt;/li&gt;
	&lt;/ul&gt;


	&lt;p&gt;Here&amp;#8217;s an approximation of these rules using &lt;a href="http://yuml.me"&gt;yuml.me&lt;/a&gt;:
&lt;img src="http://yuml.me/704421f3" /&gt;&lt;/p&gt;


And here&amp;#8217;s the syntax to create that diagram:
&lt;pre&gt;
(start)-&amp;gt;(Create New Failing Test)-&amp;gt;(Commit Work)-&amp;gt;(Change Drivers)
(Change Drivers)-&amp;gt;(Driver Working)
(Driver Working)-&amp;gt;&amp;lt;d1&amp;gt;[tick]-&amp;gt;(Driver Working)
&amp;lt;d1&amp;gt;[alarm]-&amp;gt;(Check Results)-&amp;gt;([All Tests Passing])-&amp;gt;(Create New Failing Test)
(Check Results)-&amp;gt;([Driver Broke Stuff])-&amp;gt;(git -reset hard)-&amp;gt;(Change Drivers)
(Check Results)-&amp;gt;([First Time Only and Still Only Newest Test Failing])-&amp;gt;(Give Driver A Touch More Time)-&amp;gt;(Check Results)
&lt;/pre&gt;

	&lt;p&gt;Note that this is not a strict activity diagram, the feature is still in beta, and creating this diagram as I did made the results a bit more readable. Even so, I like this tool so I wanted to throw another example in there (and try out this diagram type I have not used before &amp;#8211; at least not with this tool, I&amp;#8217;ve created too many activity diagrams). If you&amp;#8217;d like to see an accurate activity diagram, post a comment and I&amp;#8217;ll draw one in Visio and post it.&lt;/p&gt;


	&lt;p&gt;Anyway, we&amp;#8217;re going to try to move to a weekly informal practice session with either bi-weekly or monthly &amp;#8220;formal&amp;#8221; meetings. We&amp;#8217;ll keep switching out the language and the tools. I&amp;#8217;m even tempted to do design sessions &amp;#8211; &lt;span class="caps"&gt;NO CODING&lt;/span&gt;?! What?! Why not. Some people still work that way, so it&amp;#8217;s good to be able to work in different modes.&lt;/p&gt;


	&lt;p&gt;If you&amp;#8217;re in Oklahoma City, hope to see you. If not, and I&amp;#8217;m in your town, I&amp;#8217;d be interested in dropping into your dojos!&lt;/p&gt;</description>
      <pubDate>Wed, 30 Sep 2009 22:57:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:10b4fa5b-d8fa-4c4a-aabf-53130760201e</guid>
      <author>Brett Schuchert</author>
      <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30</link>
      <category>Schuchert's Scattered Synapses </category>
      <category>dojo</category>
      <category>kata</category>
      <category>shunting</category>
      <category>yard</category>
      <category>algorithm</category>
      <category>computer</category>
      <category>science</category>
      <category>ast</category>
      <category>TDD</category>
      <category>bdd</category>
      <category>RSpec</category>
      <category>Ruby</category>
      <category>yuml.me</category>
    </item>
    <item>
      <title>"Notes from the OkC Dojo 2009-09-30" by louis vuitton </title>
      <description>&lt;p&gt;*Well , the view of the passage is  totally correct ,your details is really reasonable and you guy give us valuable informative post, I totally agree the standpoint of upstairs . &lt;a href="http://www.precision-mechanical.net" rel="nofollow"&gt;http://www.precision-mechanical.net&lt;/a&gt;  I often surfing on this forum when I m free and I find there are so much good information we can learn in this forum!&lt;/p&gt;</description>
      <pubDate>Tue, 22 Jun 2010 23:00:10 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:e4c3968f-8a97-42c5-86fa-732a016cef3c</guid>
      <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30#comment-13607</link>
    </item>
    <item>
      <title>"Notes from the OkC Dojo 2009-09-30" by AVI to ipad</title>
      <description>&lt;p&gt;Are you planning to have more meetings with your Randori group? I would be very interested if you&lt;/p&gt;</description>
      <pubDate>Tue, 22 Jun 2010 05:39:17 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:c2081eda-d56f-4638-98cf-398927074193</guid>
      <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30#comment-13566</link>
    </item>
    <item>
      <title>"Notes from the OkC Dojo 2009-09-30" by Carter</title>
      <description>&lt;p&gt;Are you planning to have more meetings with your Randori group? I would be very interested if you are holding another conference anytime soon. Please update.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.mbaessaysamples.com" rel="nofollow"&gt;mba essay samples&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 20 May 2010 01:05:29 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:69d9aeac-340a-4f21-b8ae-3d6c222a90da</guid>
      <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30#comment-11752</link>
    </item>
    <item>
      <title>"Notes from the OkC Dojo 2009-09-30" by Daniel</title>
      <description>&lt;p&gt;Thanks for sharing about your so-called informal gathering. It is good to know that the gathering is successful and productive.&lt;/p&gt;


	&lt;p&gt;&lt;a href="http://www.homebasedwriters.com" rel="nofollow"&gt;writing jobs philippines&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Wed, 19 May 2010 12:56:20 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:42fd447e-509c-4481-9df5-e932febaf5f2</guid>
      <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30#comment-11688</link>
    </item>
    <item>
      <title>"Notes from the OkC Dojo 2009-09-30" by Speed Dating New York</title>
      <description>&lt;p&gt;We are what we repeatedly do. Excellence, therefore,
is not an act but a habit.&lt;/p&gt;</description>
      <pubDate>Tue, 11 May 2010 09:38:33 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:86e3a1bd-c0f4-4223-8f80-b3c439db8580</guid>
      <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30#comment-11206</link>
    </item>
    <item>
      <title>"Notes from the OkC Dojo 2009-09-30" by Ukraine Scammers</title>
      <description>&lt;p&gt;I don&amp;#8217;t advocate practicing moves on someone who is untrained in Aikido and/or without safety mats, but if you have access to both of those things, then that is the best way. Most of us don&amp;#8217;t though.&lt;/p&gt;</description>
      <pubDate>Wed, 28 Apr 2010 03:55:09 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:fe26650f-f9b6-4c4e-a171-0779e9676e81</guid>
      <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30#comment-10688</link>
    </item>
    <item>
      <title>"Notes from the OkC Dojo 2009-09-30" by Russian Wife</title>
      <description>&lt;p&gt;It&#8217;s not quite this simple &#8211; we actually looked at larger examples &#8211; but this gets the essence across.&lt;/p&gt;</description>
      <pubDate>Wed, 14 Apr 2010 06:45:03 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:51687561-36bb-4b5e-beba-42fbffcc706c</guid>
      <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30#comment-9954</link>
    </item>
    <item>
      <title>"Notes from the OkC Dojo 2009-09-30" by FLV extractor</title>
      <description>&lt;p&gt;it is  really  goosd&lt;/p&gt;</description>
      <pubDate>Wed, 07 Apr 2010 03:47:00 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:221ccb77-4d43-4b85-854c-f079a33e2bc7</guid>
      <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30#comment-9302</link>
    </item>
    <item>
      <title>"Notes from the OkC Dojo 2009-09-30" by disney restaurants</title>
      <description>&lt;p&gt;When life becomes a challenge visit Positive Share for wisdom.
You did it very well&amp;#8230;&lt;/p&gt;</description>
      <pubDate>Wed, 31 Mar 2010 01:47:12 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:2cfafcfb-e0d2-4595-92fd-469d9b3ee57c</guid>
      <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30#comment-8378</link>
    </item>
    <item>
      <title>"Notes from the OkC Dojo 2009-09-30" by iphone fix</title>
      <description>&lt;p&gt;how abstract foe me.&lt;/p&gt;</description>
      <pubDate>Tue, 09 Mar 2010 21:29:11 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:1e098383-d221-4a8c-8060-37315f0f900a</guid>
      <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30#comment-7819</link>
    </item>
    <item>
      <title>"Notes from the OkC Dojo 2009-09-30" by gucci louis vuitton shoes</title>
      <description>&lt;p&gt;Welcome to Freshstyleshop, the hottest urban clothing site on the net! We offer great products from Gucci sneakers, prada sneakers, LV shoes, True Religion Jeans and many more! Our selection of products are always increasing for the fact that we have new items added weekly to our selection. All products on our site are already marked down 40-60% off retail price. Freshstyleshop also backs all its orders with a 110% satisfaction guarantee, making sure that our customers are left satisfied with the hottest products on the net.&lt;/p&gt;</description>
      <pubDate>Tue, 15 Dec 2009 21:16:05 -0600</pubDate>
      <guid isPermaLink="false">urn:uuid:1d7d06e4-49a1-48e0-8f5f-c306a01c5696</guid>
      <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30#comment-5720</link>
    </item>
    <item>
      <title>"Notes from the OkC Dojo 2009-09-30" by sikistubetk@gmail.com</title>
      <description>&lt;p&gt;thanks for all admin 
to share the most beautiful treasure
&lt;a href="http://www.sikistube.tk" rel="nofollow"&gt;siki?&lt;/a&gt;&lt;/p&gt;</description>
      <pubDate>Thu, 29 Oct 2009 15:09:09 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:34850316-9789-4a85-aaaf-41ac4266d923</guid>
      <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30#comment-4952</link>
    </item>
    <item>
      <title>"Notes from the OkC Dojo 2009-09-30" by Brett L. Schuchert</title>
      <description>&lt;p&gt;Doh! Thanks sam.&lt;/p&gt;


	&lt;p&gt;Fixed. Along with not having a preview and the rest of the body!&lt;/p&gt;</description>
      <pubDate>Thu, 01 Oct 2009 10:44:13 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:812e76bf-2818-4570-aa6c-68ff08c530a2</guid>
      <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30#comment-4328</link>
    </item>
    <item>
      <title>"Notes from the OkC Dojo 2009-09-30" by Sam</title>
      <description>&lt;p&gt;BTW, it&amp;#8217;s Forth, not Fourth.  :)  The name of the language came from the IBM minicomputer&amp;#8217;s 5-character filename limitation.&lt;/p&gt;</description>
      <pubDate>Thu, 01 Oct 2009 02:15:47 -0500</pubDate>
      <guid isPermaLink="false">urn:uuid:5d45d3d3-e8c7-4e2d-9efb-3b83f74ce1f2</guid>
      <link>http://blog.objectmentor.com/articles/2009/09/30/notes-from-the-okc-dojo-2009-09-30#comment-4324</link>
    </item>
  </channel>
</rss>
