<?xml version="1.0" encoding="UTF-8"?>
<?xml-stylesheet href="/stylesheets/rss.css" type="text/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>Tom Moertel's Weblog: Tag culture</title>
    <link>http://blog.moertel.com/articles/tag/culture?tag=culture</link>
    <language>en-us</language>
    <ttl>40</ttl>
    <description>Quality rants on programming theory and stuff geeks like</description>
    <item>
      <title>Seven signs YOU may have created a Gratuitous Domain Specific Language</title>
      <description>&lt;p&gt;Like &lt;a href="http://use.perl.org/~chromatic/journal/"&gt;chromatic&lt;/a&gt;, I have
watched the recent irrational exuberance for domain-specific languages
(DSLs) with bewilderment.  In certain quarters of the programming
universe, it seems that creating DSLs is nearly a rite of passage.
The problem is, more and more of these DSLs appear to have been
created mainly because, well, DSLs are cool these days, even if less
&amp;#8220;novel&amp;#8221; solutions probably would have been more sensible.&lt;/p&gt;


	&lt;p&gt;Whereas chromatic &lt;a href="http://www.oreillynet.com/onlamp/blog/2007/05/the_is_it_a_dsl_or_an_api_ten.html"&gt;unhesitatingly confronted the madness
head-on&lt;/a&gt;,
I have so far managed to avoid the fray.  Sure, I&amp;#8217;ve asked the
&lt;a href="http://www.jroller.com/obie/entry/expressing_contract_terms_in_a#comment-1147246044000"&gt;occasional probing question of the &lt;span class="caps"&gt;DSL&lt;/span&gt;
enthusiast&lt;/a&gt;,
but mostly my reaction has been limited to standing back and staring
in mute amazement at the runaway Domain-Specific Fun-Time Language
Train, screaming down the tracks, destined for its inevitable high-speed
derailment into what I can only expect will be a bridge abutment.
But I&amp;#8217;m starting to get the feeling that some of the train&amp;#8217;s passengers are
aboard because they think it&amp;#8217;s the Right Thing To Do Train,
so maybe it&amp;#8217;s time to throw in my two cents.&lt;/p&gt;


	&lt;p&gt;To set the record straight, I don&amp;#8217;t have anything against DSLs,
embedded or otherwise.  (I have created &lt;a href="http://blog.moertel.com/articles/2006/03/14/talk-embedded-domain-specific-languages-for-perl"&gt;my fair
share&lt;/a&gt;,
some of which &lt;a href="http://community.moertel.com/ss/space/PXSL"&gt;are actually
useful&lt;/a&gt;.)  No, my concern is
limited strictly to the rise of the &lt;em&gt;Gratuitous &lt;span class="caps"&gt;DSL&lt;/span&gt;&lt;/em&gt;.  So let&amp;#8217;s talk
about it.&lt;/p&gt;


	&lt;p&gt;The reason &amp;#8211; the right reason &amp;#8211; for creating a &lt;span class="caps"&gt;DSL&lt;/span&gt; is because it ultimately lowers the cost
of solving problems.  If, then, you create a &lt;span class="caps"&gt;DSL&lt;/span&gt; and the cost of
solving your problems does not go down, why did you create
it?  Think about it.  Creating a &lt;span class="caps"&gt;DSL&lt;/span&gt; is an expensive proposition.  Making
people learn your &lt;span class="caps"&gt;DSL&lt;/span&gt;&amp;#8217;s syntax,
semantics, and underlying domain is a lot to ask &amp;#8211; it&amp;#8217;s costly. If you do ask, if you do make
the imposition, you had better be sure your &lt;span class="caps"&gt;DSL&lt;/span&gt; pays its bills.&lt;/p&gt;


	&lt;p&gt;But what if your &lt;span class="caps"&gt;DSL&lt;/span&gt; turns out to be a deadbeat? What if using your &lt;span class="caps"&gt;DSL&lt;/span&gt; doesn&amp;#8217;t lower the cost of solving problems? Well, guess what?  &lt;em&gt;You&lt;/em&gt; have
created a Gratuitous Domain Specific Language.&lt;/p&gt;


	&lt;p&gt;Still unsure of whether you&amp;#8217;re on the &lt;span class="caps"&gt;DSL&lt;/span&gt; Train for the wrong reason?  No problem.  Just take
this simple, seven-step test:&lt;/p&gt;


	&lt;h3&gt;Seven signs &lt;em&gt;you&lt;/em&gt; may have created a Gratuitous Domain Specific Language (GDSL)&lt;/h3&gt;


	&lt;ol&gt;
	&lt;li&gt;You can&amp;#8217;t actually explain what a &lt;span class="caps"&gt;DSL&lt;/span&gt; is.&lt;/li&gt;
		&lt;li&gt;For your &lt;span class="caps"&gt;DSL&lt;/span&gt;, you can&amp;#8217;t explain what the domain is.&lt;/li&gt;
		&lt;li&gt;You have a hard time explaining the &lt;span class="caps"&gt;DSL&lt;/span&gt;&amp;#8217;s syntax and semantics.&lt;/li&gt;
		&lt;li&gt;You have a hard time explaining how the &lt;span class="caps"&gt;DSL&lt;/span&gt; interacts with the language it is embedded in.  (For embedded DSLs only.)&lt;/li&gt;
		&lt;li&gt;A vanilla library &lt;span class="caps"&gt;API&lt;/span&gt; would have captured the domain&amp;#8217;s semantics without awkwardness.&lt;/li&gt;
		&lt;li&gt;It&amp;#8217;s easier to express complex domain concepts in general-purpose code than in your &lt;span class="caps"&gt;DSL&lt;/span&gt;.&lt;/li&gt;
		&lt;li&gt;Your colleagues have a hard time writing things in your &lt;span class="caps"&gt;DSL&lt;/span&gt;.&lt;/li&gt;
	&lt;/ol&gt;


	&lt;p&gt;Did more than a few of the statements ring true?  If so, take a bow.
&lt;em&gt;You&lt;/em&gt; are the proud creator of a Gratuitous
&lt;span class="caps"&gt;DSL&lt;/span&gt;!&lt;sup&gt;&lt;a href="#gdsl-fn1"&gt;1&lt;/a&gt;&lt;/sup&gt;&lt;/p&gt;


	&lt;p&gt;Even so, it&amp;#8217;s not too late.  You can always hop off the &lt;span class="caps"&gt;DSL&lt;/span&gt; Train at the next stop.&lt;/p&gt;


	&lt;p&gt;(&lt;em&gt;Note for the humor-impaired:  This post is meant to be interpreted in
tongue-in-cheek fashion.&lt;/em&gt;)&lt;/p&gt;


&lt;hr/&gt;

&lt;div class="footnote"&gt;

	&lt;p&gt;&lt;a name="gdsl-fn1"&gt;1.&lt;/a&gt; &lt;em&gt;Rationale for the Seven Signs.&lt;/em&gt; Signs
1&amp;#8211;4 suggest that your &lt;span class="caps"&gt;DSL&lt;/span&gt; may not even &lt;em&gt;be&lt;/em&gt; a &lt;span class="caps"&gt;DSL&lt;/span&gt;, so &lt;em&gt;calling&lt;/em&gt;
it a &lt;span class="caps"&gt;DSL&lt;/span&gt; is gratuitous.  Signs 4&amp;#8211;7 suggest that, though your &lt;span class="caps"&gt;DSL&lt;/span&gt;
may be real, it may not be paying the bills; thus, creating it and
foisting it upon the world was likely gratuitous.&lt;/p&gt;


&lt;/div&gt;

&lt;div class="update"&gt;
&lt;strong&gt;Update:&lt;/strong&gt; minor edit for clarity.

	&lt;p&gt;&lt;strong&gt;Update 2008-03-22:&lt;/strong&gt; edits for clarity.&lt;/p&gt;


&lt;/div&gt;</description>
      <pubDate>Sat, 18 Aug 2007 13:01:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:a7f4ca09-3250-4e6f-ab80-385247dcc969</guid>
      <author>Tom Moertel</author>
      <link>http://blog.moertel.com/articles/2007/08/18/seven-signs-you-may-have-created-a-gratuitous-domain-specific-language</link>
      <category>programming</category>
      <category>humor</category>
      <category>culture</category>
      <category>coding</category>
      <category>humor</category>
      <category>dsl</category>
      <category>edsl</category>
      <category>cargocult</category>
      <trackback:ping>http://blog.moertel.com/articles/trackback/531</trackback:ping>
    </item>
    <item>
      <title>Unit testing is a tool, not a goal</title>
      <description>&lt;p&gt;Via the ever-entertaining
&lt;a href="http://programming.reddit.com"&gt;programming.reddit.com&lt;/a&gt;, I discovered
&lt;a href="http://blogs.concedere.net:8080/blog/discipline/software+engineering/?permalink=The-Misguided-Faith-in-Unit-Tests.html"&gt;The (Misguided?) Faith in Unit
Tests&lt;/a&gt;.
I don&amp;#8217;t agree with the article&amp;#8217;s thesis, but the article did hit
upon a grain of unfortunate truth: many unit-testing practitioners
have a rather cultish aspect to their devotion.  More and more, people
push unit testing not because it&amp;#8217;s an inexpensive way to establish a lot of
confidence in our code&amp;#8217;s correctness, but because it&amp;#8217;s &amp;#8220;good&amp;#8221; or &amp;#8220;a
best practice&amp;#8221; or &amp;#8220;professional.&amp;#8221;&lt;/p&gt;


	&lt;p&gt;When unit testing becomes an end in itself, something has gone
haywire. Software-development practices, including unit testing, are
just tools.  No one tool is the solution to all problems.  To the
extent that we over-apply any particular tool, we cheat ourselves.  We
miss out on the opportunity to use other, more effective tools.&lt;/p&gt;


	&lt;p&gt;My favorite example of a common, important kind of problem that unit
testing isn&amp;#8217;t much help for is the
&amp;#8220;strings problem.&amp;#8221;  All those &lt;a href="http://en.wikipedia.org/wiki/Cross_site_scripting" title="XSS"&gt;cross-site-scripting&lt;/a&gt;
vulnerabilities and
&lt;a href="http://en.wikipedia.org/wiki/SQL_injection"&gt;&lt;span class="caps"&gt;SQL&lt;/span&gt;-injection&lt;/a&gt; holes you
have been reading about in recent days are prime examples.  In short,
the strings problem is having to keep track of and escape, as needed,
the bazillion types of strings that flow as life-blood within the
arteries of modern web applications.&lt;/p&gt;


	&lt;p&gt;Trying to detect string-escaping problems via unit testing is costly
because it&amp;#8217;s at least as difficult to write the tests correctly as it
is to write the code the tests are testing.  Further, a
programmer who forgets that he needs to escape user-supplied strings
before stuffing them into live web pages isn&amp;#8217;t going to remember to
write tests for his having forgotten to escape the strings.&lt;/p&gt;


	&lt;p&gt;If, then, you come to the programming party with the preconceived
notion that unit testing is the only way to go, there&amp;#8217;s a pretty good
chance that your web applications are going to be sporting some &lt;span class="caps"&gt;XSS&lt;/span&gt; or
&lt;span class="caps"&gt;SQL&lt;/span&gt;-injection holes.  On the other hand, if you view unit testing as a
tool, you&amp;#8217;re likely to consider the possibility that other tools might
be more effective for something like the strings problem.  You might,
for example, decide to use a type-system-based
solution, which pretty much makes the strings problem trivial to solve.
(I&amp;#8217;ll write about solving the strings problem in Haskell in an
upcoming article.)&lt;/p&gt;


	&lt;p&gt;I&amp;#8217;m not saying that unit testing is &amp;#8220;bad&amp;#8221; or that it&amp;#8217;s not &amp;#8220;good.&amp;#8221; 
What I&amp;#8217;m saying is that &lt;em&gt;unit testing is not the goal&lt;/em&gt;.  The goal is
having confidence in your code doing what it ought to do.  Unit
testing is often an inexpensive way to achieve much of that confidence,
but for many situations, the strings problem being one of them, it
pays to keep an open mind about supplementing unit testing with other
tools.&lt;/p&gt;


&lt;div class="update"&gt;
&lt;strong&gt;Update:&lt;/strong&gt; Minor edits for readability.
&lt;/div&gt;</description>
      <pubDate>Tue, 10 Oct 2006 15:23:00 -0400</pubDate>
      <guid isPermaLink="false">urn:uuid:4578342f-daba-436c-9163-e20694d29cde</guid>
      <author>Tom Moertel</author>
      <link>http://blog.moertel.com/articles/2006/10/10/unit-testing-is-a-tool-not-a-goal</link>
      <category>programming</category>
      <category>testing</category>
      <category>testing</category>
      <category>culture</category>
      <trackback:ping>http://blog.moertel.com/articles/trackback/182</trackback:ping>
    </item>
  </channel>
</rss>
