<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>devgrind &#187; design</title>
	<atom:link href="http://devgrind.com/tag/design/feed/" rel="self" type="application/rss+xml" />
	<link>http://devgrind.com</link>
	<description>thinking outside the { }</description>
	<lastBuildDate>Tue, 04 May 2010 17:25:24 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.2</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>APIs and DSLs</title>
		<link>http://devgrind.com/2007/04/26/apis-and-dsls/</link>
		<comments>http://devgrind.com/2007/04/26/apis-and-dsls/#comments</comments>
		<pubDate>Thu, 26 Apr 2007 20:11:51 +0000</pubDate>
		<dc:creator>Arne</dc:creator>
				<category><![CDATA[api]]></category>
		<category><![CDATA[design]]></category>
		<category><![CDATA[dsl]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://devgrind.com/2007/04/26/apis-and-dsls/</guid>
		<description><![CDATA[Today I stumbled upon Josh Bloch&#8217;s talk How To Design A Good API and Why it Matters at Google Tech Talks. Its loaded with profound wisdom and advice from one of the masters of API design.
He explains that API design is very similar to language design, and I immediately thought that this particularly holds for [...]]]></description>
			<content:encoded><![CDATA[<p>Today I stumbled upon Josh Bloch&#8217;s talk <a href="http://video.google.com/videoplay?docid=-3733345136856180693">How To Design A Good API and Why it Matters</a> at Google Tech Talks. Its loaded with profound wisdom and advice from one of the masters of API design.</p>
<p>He explains that API design is very similar to language design, and I immediately thought that this particularly holds for APIs which are designed as domain-specific languages, which is one of Ruby&#8217;s strengths (read <a href="http://www.oreillynet.com/ruby/blog/2005/12/what_is_a_dsl.html">this article</a> from Oreillynet.com to learn more about DSLs).</p>
<p>A few slides later he talks about characteristics of good APIs:</p>
<blockquote>
<ul>
<li>Easy to learn</li>
<li>Easy to use, even without documentation</li>
<li>Hard to misuse</li>
<li>Easy to read and maintain code that uses it</li>
<li>Sufficiently powerful to satisfy requirements</li>
<li>Easy to evolve</li>
<li>Appropriate to audience</li>
</ul>
</blockquote>
<p>To achieve all these properties for an API is certainly non-trivial, but at least some of them get easier if you design APIs as a domain-specific languages: As the term says, a DSL provides a language that is tailored for a particular domain, in addition DSLs are generally declarative and hide language aspects that are irrelevant. Such a language is obviously easier to learn, use and to read than a mere API, and is more appropriate to its audience. In the end, these are known strengths of <a href="http://en.wikipedia.org/wiki/Declarative_language">declarative languages</a>. Here&#8217;s an example taken from the <a href="http://manuals.rubyonrails.com/read/chapter/100">Capistrano manual</a> (Capistrano is a Ruby DSL for remote software deployment):<br />
[ruby]<br />
desc &#8220;Start the spinner daemon&#8221;<br />
task :spinner, :roles => :app do<br />
  run &#8220;#{current_path}/script/spin&#8221;<br />
end</p>
<p>desc &#8220;Used only for deploying when the spinner isn&#8217;t running&#8221;<br />
task :cold_deploy do<br />
  transaction do<br />
    update_code<br />
    symlink<br />
  end</p>
<p>  spinner<br />
end<br />
[/ruby]<br />
Though this doesn&#8217;t hide imperative aspects completely, I think it&#8217;s a good example of how a DSL feels &#8211; just as if it wasn&#8217;t Ruby but a different language.
</p>
<p>So, is it safe to conclude that DSLs are the better APIs?</p>
]]></content:encoded>
			<wfw:commentRss>http://devgrind.com/2007/04/26/apis-and-dsls/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Beans, Snakes, Gems</title>
		<link>http://devgrind.com/2007/03/13/beans-snakes-gems/</link>
		<comments>http://devgrind.com/2007/03/13/beans-snakes-gems/#comments</comments>
		<pubDate>Tue, 13 Mar 2007 09:19:07 +0000</pubDate>
		<dc:creator>Magnus</dc:creator>
				<category><![CDATA[design]]></category>
		<category><![CDATA[humor]]></category>
		<category><![CDATA[languages]]></category>
		<category><![CDATA[programming]]></category>

		<guid isPermaLink="false">http://devgrind.com/2007/03/13/beans-snakes-gems/</guid>
		<description><![CDATA[This will not be another programming language comparison frenzy. I had just some semi-serious thoughts about something I would call &#8220;language marketing&#8221;:
If you are starting to design a new programming language, start thinking of language identity. I do not know whether this term existed prior to this posting, but language identity is for programming languages [...]]]></description>
			<content:encoded><![CDATA[<p>This will not be another programming language comparison frenzy. I had just some semi-serious thoughts about something I would call &#8220;language marketing&#8221;:</p>
<p>If you are starting to design a new programming language, start thinking of <em>language identity</em>. I do not know whether this term existed prior to this posting, but language identity is for <em>programming languages</em> what <em>corporate identity</em> is for enterprises. Of course, the scope of the language and all the nifty little features and whether it is compiled or interpreted and for which platforms the language is available is of some importance &#8211; but to make your language known, you need a lot more sexiness. This language sexiness is made by (but necessarily limited to):</p>
<ul>
<li>A <strong>logo</strong>. Or better, an allegory. As we see in successful languages, this does not have to be an animal (although this helps a lot with O&#8217;Reilly). Java has the coffee, Python has the snake (although the name comes from the British comedy group), Ruby has the gem.</li>
<li>The <strong>name</strong>. C++ is a notable exception, taking its fame mostly from its predecessor C, which did not need a fancy name because it was the programming language sent to us from above in the <a href="http://www.science.uva.nl/~mes/jargon/o/oldtestament.html">Old and the New Testament</a>. But most popular languages have names which are good to remember. Ask five developers how they are pronouncing &#8220;C#&#8221; and you will get six different answers.</li>
<li>A <strong>web site</strong>. This serves as a hub for everything about your language. The <a href="http://www.python.org">Python</a> page, for example, is so resourceful that keeping a local documentation for the language should never be necessary. There is even a <a href="http://www.edgewall.org/python-sidebar/">Firefox sidebar</a> for easy access to all the information on the pages.</li>
<li>A <strong>figure head</strong>. At best, someone as strange and bearded as Larry Wall (PERL), at least some guru whose name is not even mentioned in full (like DHH instead of David Heinemeier Hansson, Rails/Ruby), or only by first name (&#8220;<a href="http://www.research.att.com/~bs/homepage.html">Bjarne</a> said &#8230;&#8221;).</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://devgrind.com/2007/03/13/beans-snakes-gems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Humane Interface Design</title>
		<link>http://devgrind.com/2007/03/07/humane-interface-design/</link>
		<comments>http://devgrind.com/2007/03/07/humane-interface-design/#comments</comments>
		<pubDate>Wed, 07 Mar 2007 10:46:14 +0000</pubDate>
		<dc:creator>Arne</dc:creator>
				<category><![CDATA[design]]></category>
		<category><![CDATA[java]]></category>
		<category><![CDATA[languages]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[ruby]]></category>

		<guid isPermaLink="false">http://devgrind.com/2007/03/07/humane-interface-design/</guid>
		<description><![CDATA[Martin Fowler writes on his view on humane interface design, i.e. APIs that are designed for convenient use, in contrast to minimalist APIs. He states that
The essence of the humane interface is to find out what people want to do and design the interface so that it&#8217;s really easy to do the common case.
For example, [...]]]></description>
			<content:encoded><![CDATA[<p>Martin Fowler <a href="http://martinfowler.com/bliki/HumaneInterface.html">writes</a> on his view on humane interface design, i.e. APIs that are designed for convenient use, in contrast to minimalist APIs. He states that</p>
<blockquote><p>The essence of the humane interface is to find out what people want to do and design the interface so that it&#8217;s really easy to do the common case.</p></blockquote>
<p>For example, Ruby&#8217;s arrays have convenience methods such as <tt>first</tt>, <tt>last</tt>, <tt>flatten</tt>, etc. which tend to be omitted in minimalist interfaces, because they can easily be implemented by clients. And Ruby also aliases method names, i.e. using multiple names for the same functionality, such as <tt>length</tt> and <tt>size</tt> of arrays. As an example for a minimalist interface, Fowler mentions the Java API for collections.</p>
<p>I wonder where Python falls in this spectrum. The Python folks <a href="http://www.python.org/dev/culture.html">state explicitly</a> that</p>
<blockquote><p>There should be one &#8212; and preferably only one &#8212; obvious way to do it.</p></blockquote>
<p>Which sounds like a minimalist approach to me, in the meaning of &#8220;reduce stuff to the things that are canonically necessary&#8221;. But if you look at the APIs, you&#8217;ll find aliases there as well. I don&#8217;t know Python terribly well, so perhaps some Python guru can enlighten me on this?</p>
<p>Wrapping things up I don&#8217;t think that one approach &ndash; humane or minimalist &ndash; is necessarily better than the other. Both have their benefits and drawbacks, but like Martin Fowler I prefer humane interfaces.</p>
<p>
Via <a href="http://ravimohan.blogspot.com/2005/12/what-mr-fowler-really-said.html">One Man Hacking</a></p>
]]></content:encoded>
			<wfw:commentRss>http://devgrind.com/2007/03/07/humane-interface-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
