<?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>UNIXy Goodness &#187; Developer Tools</title>
	<atom:link href="http://quenelle.org/unix/category/developer-tools/feed/" rel="self" type="application/rss+xml" />
	<link>http://quenelle.org/unix</link>
	<description>UNIX developer tools and other cool stuff</description>
	<lastBuildDate>Mon, 23 Jan 2012 19:21:59 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.2.1</generator>
		<item>
		<title>Is shell history an anachronism?</title>
		<link>http://quenelle.org/unix/2011/shell-history/</link>
		<comments>http://quenelle.org/unix/2011/shell-history/#comments</comments>
		<pubDate>Fri, 16 Sep 2011 19:41:36 +0000</pubDate>
		<dc:creator>Chris Quenelle</dc:creator>
				<category><![CDATA[Developer Tools]]></category>

		<guid isPermaLink="false">http://quenelle.org/unix/?p=364</guid>
		<description><![CDATA[<p>I work in an environment that has user home directories shared over NFS.  I always thought that kind of made the normal shell history mechanism fall on it&#8217;s face.  None of the shells I&#8217;ve seen will actually do the hard work of synchronizing the shell history file to collect data from multiple different hosts in [...]]]></description>
			<content:encoded><![CDATA[<p>I work in an environment that has user home directories shared over NFS.  I always thought that kind of made the normal shell history mechanism fall on it&#8217;s face.  None of the shells I&#8217;ve seen will actually do the hard work of synchronizing the shell history file to collect data from multiple different hosts in one file.  It even falls apart when you have multiple term windows open on one machine.  Many years ago I realized I didn&#8217;t want my shells writing frequently to my home directory over NFS, so I relocated my history file to /tmp.  This means I&#8217;ll get history restored when I log into the same machine (until it gets rebooted) but it&#8217;s put luck which session on the same machine saved it&#8217;s history last.  Bash is my normal shell these days, and it has a lot of features to tweak and manipulate the history, but none of the features seem to deal with the inherent sync issues.  I suspect everyone uses history within their current shell session, and nobody much cares if it is saved or not.</p>
<p>The reason I care is because I&#8217;m looking at using it as a platform to associate command history with logical projects.  It&#8217;s an interesting idea, but I&#8217;m surprised the whole mechanism is so poorly adapted to modern environments.</p>
]]></content:encoded>
			<wfw:commentRss>http://quenelle.org/unix/2011/shell-history/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The everpresent &#8220;util&#8221; module.</title>
		<link>http://quenelle.org/unix/2010/util-module/</link>
		<comments>http://quenelle.org/unix/2010/util-module/#comments</comments>
		<pubDate>Sun, 12 Sep 2010 16:40:30 +0000</pubDate>
		<dc:creator>Chris Quenelle</dc:creator>
				<category><![CDATA[Developer Tools]]></category>
		<category><![CDATA[Tech Trivia]]></category>

		<guid isPermaLink="false">http://quenelle.org/unix/?p=345</guid>
		<description><![CDATA[<p>Every major library or application I write seems to have a module named &#8220;util&#8221; these days.  I think it represents a kind of &#8220;impedance mismatch&#8221; between the platform I&#8217;m using (C runtime, C++ runtime, python standard libraries) and the platform I *wish* I were using.</p> <p>Recently, I&#8217;ve been writing python code that runs lots of [...]]]></description>
			<content:encoded><![CDATA[<p>Every major library or application I write seems to have a module named &#8220;util&#8221; these days.  I think it represents a kind of &#8220;impedance mismatch&#8221; between the platform I&#8217;m using (C runtime, C++ runtime, python standard libraries) and the platform I *wish* I were using.</p>
<p>Recently, I&#8217;ve been writing python code that runs lots of little UNIX utilities.  You know, like: find, ls, chmod, etc, etc.  It&#8217;s the kind of code that might also be written as a shell script, but python is much nicer when the program gets larger than about a page.  If you&#8217;re running lots of utilities, you want a variety of ways to interact with them.</p>
<p>Sometimes, you don&#8217;t want to send it any input, sometimes you do, sometimes you are expecting one line of output.  Sometimes you&#8217;re expecting a list of lines.  Sometimes you&#8217;re going to check the return code, sometimes you&#8217;re not.  These functions are all just small wrappers around calls to the python subprocess module in python.  But if you&#8217;re writing a lot of code that uses them, it&#8217;s important to make that code readable, so you want to streamline away most of the goop for dealing with the subprocess module.</p>
<p>I have utility routines for creating temporary files and removing them all when the program exits. There are routines to keep me from adding a lot of obscure import statements to the top of most of my modules.</p>
<p>Here&#8217;s some examples of what I&#8217;m using for now:</p>
<blockquote><p>def gethostname():<br />
   from socket import gethostname<br />
   return gethostname()</p></blockquote>
<blockquote><p>def timestamp():<br />
   import datetime<br />
   return str(datetime.datetime.today())</p></blockquote>
<p>Here&#8217;s a recipe that I got from stackoverflow.com.  I wanted the equivalent of &#8220;mkdir -p&#8221;, and you need a few lines to do that in python.</p>
<blockquote><p>def mkdir_p(dir):<br />
  import errno<br />
  try:<br />
    os.makedirs(dir)<br />
  except OSError, exc:<br />
    if exc.errno == errno.EEXIST:<br />
      pass<br />
    else:<br />
      raise</p></blockquote>
<p>There&#8217;s also code to do things that I&#8217;m convinced must have a better answer in python, but I haven&#8217;t found it yet.  So I isolate the hack to the until module.</p>
<blockquote><p>def is_executable(file):<br />
  S_IEXEC = 00100<br />
  mode = os.stat(file).st_mode<br />
  return mode &amp; S_IEXEC</p></blockquote>
<p>Moving code in and out of my util module also prevents me from worrying so much about obscure modularity issues. Any code I don&#8217;t want to worry about today goes into the util module. When I know where it belongs, I can easily move it later. Of course, that&#8217;s much easier to do with python than in a language that uses header files like C or C++.</p>
]]></content:encoded>
			<wfw:commentRss>http://quenelle.org/unix/2010/util-module/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>On Iteration by Andrei Alexandrescu</title>
		<link>http://quenelle.org/unix/2010/iterators/</link>
		<comments>http://quenelle.org/unix/2010/iterators/#comments</comments>
		<pubDate>Wed, 23 Jun 2010 17:54:34 +0000</pubDate>
		<dc:creator>Chris Quenelle</dc:creator>
				<category><![CDATA[Compilers]]></category>
		<category><![CDATA[Developer Tools]]></category>

		<guid isPermaLink="false">http://quenelle.org/unix/?p=335</guid>
		<description><![CDATA[<p>I just finished reading a great article on iterators by Andrei Alexandrescu.  Mr. Alexandrescu is a contributor to the D programming language.  In this paper, he discusses the background of iterator implementations including C++ STL iterators, and then goes on to outline a new model for iterators.  It&#8217;s very readable, I recommend it.</p> <p>http://www.informit.com/articles/article.aspx?p=1407357</p> <p>To [...]]]></description>
			<content:encoded><![CDATA[<p>I just finished reading a great article on iterators by Andrei Alexandrescu.  Mr. Alexandrescu is a contributor to the D programming language.  In this paper, he discusses the background of iterator implementations including C++ STL iterators, and then goes on to outline a new model for iterators.  It&#8217;s very readable, I recommend it.</p>
<p>http://www.informit.com/articles/article.aspx?p=1407357</p>
<p>To get a more readable all-in-one page, click on the &#8220;print&#8221; link on the page above, or go here:</p>
<p>http://www.informit.com/articles/printerfriendly.aspx?p=1407357</p>
]]></content:encoded>
			<wfw:commentRss>http://quenelle.org/unix/2010/iterators/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Charles Stross on EBooks</title>
		<link>http://quenelle.org/unix/2010/charles-stross-on-ebooks/</link>
		<comments>http://quenelle.org/unix/2010/charles-stross-on-ebooks/#comments</comments>
		<pubDate>Fri, 18 Jun 2010 00:24:20 +0000</pubDate>
		<dc:creator>Chris Quenelle</dc:creator>
				<category><![CDATA[Developer Tools]]></category>

		<guid isPermaLink="false">http://quenelle.org/unix/?p=332</guid>
		<description><![CDATA[<p>I just read a nice essay by science fiction author Charles Stross about EBooks.  As usual, he presents a very lucid and entertaining look into the world of publishing.</p> <p>CMAP #9: Ebooks</p> ]]></description>
			<content:encoded><![CDATA[<p>I just read a nice essay by science fiction author Charles Stross about EBooks.  As usual, he presents a very lucid and entertaining look into the world of publishing.</p>
<p><a title="CMAP #9: Ebooks" href="http://www.antipope.org/charlie/blog-static/2010/05/cmap-9-ebooks.html" target="_self">CMAP #9: Ebooks</a></p>
]]></content:encoded>
			<wfw:commentRss>http://quenelle.org/unix/2010/charles-stross-on-ebooks/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Virtualization terms</title>
		<link>http://quenelle.org/unix/2010/virtualization-terms/</link>
		<comments>http://quenelle.org/unix/2010/virtualization-terms/#comments</comments>
		<pubDate>Wed, 16 Jun 2010 01:23:26 +0000</pubDate>
		<dc:creator>Chris Quenelle</dc:creator>
				<category><![CDATA[Developer Tools]]></category>
		<category><![CDATA[OpenSolaris]]></category>
		<category><![CDATA[Tech Trivia]]></category>

		<guid isPermaLink="false">http://quenelle.org/unix/?p=329</guid>
		<description><![CDATA[<p>Okay, before I forget, I&#8217;m writing it all down.</p> <p>We have to test against all this stuff, and it&#8217;s becoming more and more convenient to use virtualization as a way to share lab resources, so I figured I&#8217;d go make sense of all the terminology that&#8217;s flying around.  I understood 80% of it, but I [...]]]></description>
			<content:encoded><![CDATA[<p>Okay, before I forget, I&#8217;m writing it all down.</p>
<p>We have to test against all this stuff, and it&#8217;s becoming more and more convenient to use virtualization as a way to share lab resources, so I figured I&#8217;d go make sense of all the terminology that&#8217;s flying around.  I understood 80% of it, but I could never understand all of it at once.  A lot of this was extracted from Wikipedia.</p>
<p>Here are the things that affect my life: Xen, VirtualBox, VMWare, LDOMs, Zones, Containers.</p>
<p>Hypervisor : Software that emulates a hardware platform, so that Operating Systems can run on top of it, as if they had hardware to run on.</p>
<p>OS Virtualization: When you have one OS (one kernel) running multiple user-spaces. Applications think they are on separate machines.</p>
<p>There are two kinds of Hypervisors, some run directly on hardware (Type 1), and some run as applications (Type 2).</p>
<p>With those terms defined, here is a description of the technologies, features, products that I listed at the top:</p>
<ul>
<li>Hypervisors:
<ul>
<li>Running on hardware &#8211; Type 1 Hypervisor
<ul>
<li>Xen: Hypervisor that runs on hardware, supports x86 (aka Sun xVM)</li>
<li>LDOMs: Hypervisor that runs on hardware, supports SPARC</li>
</ul>
</li>
<li>Running as an application &#8211; Type 2 Hypervisor
<ul>
<li>VirtualBox: Hypervisor that runs as an application, supports x86</li>
<li>VMWare: Hypervisor that runs as an application, supports x86</li>
</ul>
</li>
</ul>
</li>
</ul>
<ul>
<li>OS Virtualization
<ul>
<li>Solaris Containers/Zones</li>
</ul>
</li>
</ul>
<p>The terms &#8220;zone&#8221; and &#8220;container&#8221; seem to interchangeable. I have not found a source that is both clear and authoritative that can tell me the difference.</p>
<p>Zones are capable of running different versions of Solaris inside one Global OS instance.</p>
<p>There are lots of things I glossed over here, but my goal was keep it short and sweet.</p>
<p>Trivia:</p>
<ul>
<li>You can run a specific old version of Linux inside a Solaris zone.</li>
<li>The VMWare company probably supports products on other chips than x86</li>
<li>There are lots of differences between the features of Xen and LDOMs that I didn&#8217;t discuss</li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://quenelle.org/unix/2010/virtualization-terms/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Which version of Sun Studio do I have installed?</title>
		<link>http://quenelle.org/unix/2010/packaging-recipes/</link>
		<comments>http://quenelle.org/unix/2010/packaging-recipes/#comments</comments>
		<pubDate>Fri, 14 May 2010 17:47:09 +0000</pubDate>
		<dc:creator>Chris Quenelle</dc:creator>
				<category><![CDATA[Developer Tools]]></category>
		<category><![CDATA[OpenSolaris]]></category>

		<guid isPermaLink="false">http://quenelle.org/unix/?p=321</guid>
		<description><![CDATA[Recipes for supported packaging formats <p>Sun Studio is available on three different packaging systems. Here are some examples that show you how to get information about the Sun Studio packages on each kind of system.</p> IPS packaging system &#8211; on OpenSolaris SYSV packages &#8211; on Solaris 10 RPMs &#8211; on SuSE and RedHat Linux <p>If [...]]]></description>
			<content:encoded><![CDATA[<h4>Recipes for supported packaging formats</h4>
<p>Sun Studio is available on three different packaging  systems. Here are some examples that show you how to get information  about the Sun Studio packages on each kind of system.</p>
<ul>
<li>IPS packaging system &#8211; on OpenSolaris</li>
<li>SYSV packages &#8211; on Solaris 10</li>
<li>RPMs &#8211; on SuSE and RedHat Linux</li>
</ul>
<p>If you want to know what version of a Studio component you&#8217;re using,  the steps are shown below.  The compiler or tool you&#8217;re interested in  might be on your search path (you can find the location with &#8220;which cc&#8221;)  or you might already know the full path.  Once you have the full path,  here are the things you might want to find out:</p>
<ol>
<li>Find out the name of the package containing that binary.</li>
<li>Dump out information about that package.</li>
<li>Optionally look for other packages from the same Studio release, to  see what else is installed.</li>
</ol>
<p>Generally the multiple packages that make up Sun Studio will use a  similar naming convention.  In the currently available releases, these  package names are cryptic.</p>
<p><strong><span style="text-decoration: underline;">Sun Studio 12 update 1 installed on Solaris 10</span></strong></p>
<p>What version is built into the binary?</p>
<pre>% /opt/sunstudio12.1/bin/cc -V
cc: Sun C 5.10 SunOS_sparc 2009/06/03
usage: cc [ options] files.  Use 'cc -flags' for details</pre>
<p>Which package is that binary in?</p>
<pre>% pkgchk -l -p '/opt/sunstudio12.1/bin/cc'
NOTE: Couldn't lock the package database.
Pathname: /opt/sunstudio12.1/bin/cc
Type: symbolic link
Source of link: ../prod/bin/cc
Referenced by the following packages:
SPROcc
Current status: installed
</pre>
<p>What other packages are installed?</p>
<pre>% pkginfo | grep SPRO
application SPROatd                          Sun Studio 12 update 1 Advanced Tools Development Module
application SPROcc                           Sun Studio 12 update 1 C Compiler
application SPROcmpl                         Sun Studio 12 update 1 C++ Complex Library
application SPROcpl                          Sun Studio 12 update 1 C++ Compiler
application SPROcplx                         Sun Studio 12 update 1 C++ 64-bit Libraries
...</pre>
<p><span style="text-decoration: underline;"><strong>Sun Studio 12 update 1 installed on OpenSolaris</strong></span></p>
<p>What version is built into the binary?</p>
<pre>% /opt/sunstudio12.1/bin/cc -V
cc: Sun C 5.10 SunOS_i386 2009/06/03
usage: cc [ options] files.  Use 'cc -flags' for details% /opt/sunstudio12.1/bin/cc -V</pre>
<p>Which package is that binary in?</p>
<pre>% pkg search -lp /opt/sunstudio12.1/bin/cc
PACKAGE                                   PUBLISHER
pkg:/developer/sunstudio12u1@12.1.1-0.111</pre>
<p>What other packages are installed?</p>
<pre>% pkg list | grep -i studio
developer/sunstudio12u1                       12.1.1-0.111    installed  -----</pre>
<p><span style="text-decoration: underline;"><strong>Sun Studio 12 update 1 installed on SuSE 11 Linux</strong></span></p>
<p>What version is built into the binary?</p>
<pre>% /opt/sun/sunstudio12.1/bin/cc -V
cc: Sun C 5.10 Linux_i386 2009/06/03
usage: cc [ options] files.  Use 'cc -flags' for details</pre>
<p>Which package is that binary in?</p>
<pre>% rpm -qf /opt/sun/sunstudio12.1/bin/cc
sun-cc-12.1-1</pre>
<p>What other packages are installed?</p>
<pre>% rpm -qa | grep sun- | head
sun-lang-12.1-1
sun-idext-12.1-1
sun-mr3m-12.1-1
sun-prfan-12.1-1
sun-stl4h-12.1-1
sun-cplx-12.1-1
sun-dbxx-12.1-1
sun-pls-12.1-1
sun-dwrfs-12.1-1
sun-rtmx-12.1-1
...</pre>
<h4>Notes</h4>
<p>The excessively terse naming convention is because of the ancient  restrictions in AT&amp;T System V UNIX that limited package names to 9  characters.   Sun also made an early decision to prefix packages names  with 4 letters to mark the part of the company that was releasing the  packages.  In all fairness, Sun was trying to invent a scheme where  outside software vendors could reasonably choose package names without  accidentally conflicting with any of the Sun packages.  That&#8217;s difficult  to do in only 9 characters.  On OpenSolaris, you can see that we merged  everything into one package.  Because the friendly new packaging system  is one of the highlights of OpenSolaris, we didn&#8217;t want to confuse new  users with the multitude of small packages we have for Sun Studio.</p>
<p>Hopefully, this information will be useful in a variety of  circumstances. Inside the Studio team, we need to go back and forth  between all three packaging systems, and it&#8217;s not easy to remember the  right system commands to work with the packages on a given system. In  the support team, one of the first things they ask a customer is which  version of the Sun Studio software they are running. It&#8217;s also possible  to install subsets of Sun Studio, so you may want to know which tools  are currently installed.</p>
<p>Note: Studio will actually run fine on lots of different versions of  Linux, including distributions that don&#8217;t use RPM as their native  package format (like Ubuntu).  The tarball downloads are useful for  those Linux distributions.</p>
]]></content:encoded>
			<wfw:commentRss>http://quenelle.org/unix/2010/packaging-recipes/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Code Bubbles</title>
		<link>http://quenelle.org/unix/2010/code-bubbles/</link>
		<comments>http://quenelle.org/unix/2010/code-bubbles/#comments</comments>
		<pubDate>Sat, 13 Mar 2010 05:15:57 +0000</pubDate>
		<dc:creator>Chris Quenelle</dc:creator>
				<category><![CDATA[Developer Tools]]></category>

		<guid isPermaLink="false">http://quenelle.org/unix/?p=299</guid>
		<description><![CDATA[<p>This is the IDE for me.  They start talking about debugger functionality about 75% of the way through.  IDEs are all about navigating huge amounts of information. Code Bubbles (http://www.cs.brown.edu/people/acb/codebubbles_site.htm)</p> ]]></description>
			<content:encoded><![CDATA[<p>This is the IDE for me.  They start talking about debugger functionality about 75% of the way through.  IDEs are all about navigating huge amounts of information. <a href="http://www.cs.brown.edu/people/acb/codebubbles_site.htm">Code Bubbles</a> (http://www.cs.brown.edu/people/acb/codebubbles_site.htm)</p>
]]></content:encoded>
			<wfw:commentRss>http://quenelle.org/unix/2010/code-bubbles/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Sun Studio uninstall problems (Sun Studio 12 update 1)</title>
		<link>http://quenelle.org/unix/2009/sun-studio-uninstall-problems/</link>
		<comments>http://quenelle.org/unix/2009/sun-studio-uninstall-problems/#comments</comments>
		<pubDate>Mon, 21 Dec 2009 16:19:31 +0000</pubDate>
		<dc:creator>Chris Quenelle</dc:creator>
				<category><![CDATA[Developer Tools]]></category>

		<guid isPermaLink="false">http://quenelle.org/unix/?p=280</guid>
		<description><![CDATA[<p>If you installed the initial release of Sun Studio 12 update 1 (around June of 2009) you might have some problems running the uninstall script that came with it.  Our installer guru came up with a &#8220;workaround&#8221; script which is now available for download on the Sun Download Center.  You can find a description of [...]]]></description>
			<content:encoded><![CDATA[<p>If you installed the initial release of Sun Studio 12 update 1 (around June of 2009) you might have some problems running the uninstall script that came with it.  Our installer guru came up with a &#8220;workaround&#8221; script which is now available for download on the Sun Download Center.  You can find a description of the problems and a link to the script on the Sun Studio web site&#8217;s <a href="http://developers.sun.com/sunstudio/support/troubleshooting/#failed_uninstall">Troubleshooting Page</a>.  You may also find it useful to check the Sun Studio 12 update 1 <a href="http://docs.sun.com/app/docs/doc/820-7601">installation guide</a>.  Some of the failure modes may show you errors like this:</p>
<pre>The local registry (/root/.nbi/registry.xml) could not be loaded, or was loaded partially.
The installer can continue to work normally, but doing so may result in a corrupted global registry.</pre>
<p>As Sun moves towards using the IPS packaging system, we&#8217;ll be able to rely more on the packaging tools built in to Solaris, and we won&#8217;t have as many issues like these.  I&#8217;m looking forward to it.</p>
]]></content:encoded>
			<wfw:commentRss>http://quenelle.org/unix/2009/sun-studio-uninstall-problems/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Facets of Programming</title>
		<link>http://quenelle.org/unix/2009/facets/</link>
		<comments>http://quenelle.org/unix/2009/facets/#comments</comments>
		<pubDate>Tue, 10 Nov 2009 21:55:10 +0000</pubDate>
		<dc:creator>Chris Quenelle</dc:creator>
				<category><![CDATA[Compilers]]></category>
		<category><![CDATA[Developer Tools]]></category>

		<guid isPermaLink="false">http://quenelle.org/unix/?p=272</guid>
		<description><![CDATA[<p>I&#8217;ve been thinking recently about the fact that the average piece of software code includes instructions to the compiler mixed together with instructions that should be executed at runtime.  Type declarations are instructions to the compiler. Most of the general sequential code is instructions that should be executed at runtime.  It occurred to me these [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve been thinking recently about the fact that the average piece of software code includes instructions to the compiler mixed together with instructions that should be executed at runtime.  Type declarations are instructions to the compiler. Most of the general sequential code is instructions that should be executed at runtime.  It occurred to me these are just two of many facets of software.  It would be nice to enable all these facets to be mixed together into one document so that the author of the software can keep all the facets consistent.</p>
<p>Another facet is specifications or unit tests.  I group those together because the way they&#8217;re tied to software at the code level is very similar, and they serve similar purposes.  There is an approach to coding called &#8220;Test Driven Design&#8221; where unit tests are written simultaneously with individual chunks of code.  There is a variant of this called &#8220;Behavior Driven Design&#8221;.  I was exposed to BDD in the latest Scala book (Programming Scala) and that was when I realized the TDD is really about verifiable specification, not so much about testing.</p>
<p>I really don&#8217;t want to use something that&#8217;s just a &#8220;programming language&#8221;, I want to use a &#8220;Software Authoring System&#8221;.</p>
<p>So what are the facets that a good &#8220;Software Authoring System&#8221; needs?</p>
<p>Runtime instructions: The purest expression of this facet is in dynamically typed languages, because they omit static type declarations.</p>
<p>Compiler instructions: Static type declarations for variables are instructions to the compiler. Type definitions themselves (in static or dynamic languages) are partly for the benefit of the compiler, and partly for the specification of runtime behavior.  Explicit testing and runtime manipulation of types (metaprogramming) uses types as part of the runtime behavior of the program. Virtual dispatch uses type information to determine runtime behavior. But non-virtual dispatch is really just a hint to the compiler about what code is going to be associated with what data. The behavior of such code is wired down at compile time.  The compiler uses it to optimize, and report programming errors back to the user.</p>
<p>The way that instructions are provided to the compiler should be rethought.  The declarative style of such instructions should be retained, but the functionality should be extensible through code that&#8217;s integrated with the project code. If I don&#8217;t like the way the static type system works (as supplied by the environment), I should be able to write extensions to it that will be executed by the compiler when it compiles my code. Among other benefits, this would allow me to implement better Domain Specific Languages and add better support for static analysis tools.  Moving the language complexity associated with static typing into a user-extensible library would also streamline the core language specification. The implementation of this feature would be more natural in a language where the compiler could just as easily interpret code as compile it, like dynamic interpreted languages.</p>
<p>Documentation: Embedding chunks of documentation inside your source code is a good start, and extracting method signatures is also useful (ala javadoc).  But a truly integrated system could provide much more information about interface specifications, preconditions, postconditions, etc.</p>
<p>Interface specification: If a public function takes arguments including a list and an integer that must be less than or equal to the length of the list, how does the author encode that information into the source code?  They can put it in comments.  They can add an assert statement (which will likely be ignored by the compiler, optimizer, documentation system etc). They can use TDD to create a test case that ensures the module throws an exception if the precondition is violated.  None of that goes far enough.  This kind of specification needs to be supported directly by the programming language and tied into the other facets of programming.</p>
<p>Module definition: The source code structures used to create a piece of software (a reusable module) are often not the same structures that you want to use to control how that software is used by other components.  That&#8217;s why programming languages support Classes and instances for object oriented design, and also support some concept of modules or packages for controlling the import and export of software interfaces to other components.  In most cases, this module/package support is a very thin layer glued onto the outside of a programming language.  For example, when creating a shared library on UNIX, there are linker-specific ways to enumerate which symbols are visible to consumers of the library.  There are also platform-specific hooks to allow this information to be passed into the linker from the source code, but again, it&#8217;s not truly integrated into the programming language.</p>
<p>Optimization: The author of a component usually needs to concern themselves (at some level) with basic choices that affect performance.  In some cases this requires in-depth bit-twiddling and care selection of compiler options, but in some cases it just means choosing data structure implementations that are appropriate for the task at hand.  As an author, I don&#8217;t want to have to use the Makefile to assign different optimization levels to different source files. I&#8217;d like to declare that a particular chunk of code needs to be heavily optimized and have the compiler just do the right thing.</p>
<p>Binding: Two kinds of binding are important to me as an author. My component will need to bind to the implementations of the interfaces it needs to be complete. Also, other components will bind to my component. The way I facilitate external binding is really part of the &#8220;module definition&#8221; facet discussed above.  The binding facet concerns itself with how to control the way that a component binds to its own required components. In some cases you want this binding to be via copy inclusion (think of archive libraries or combining .class files into a .jar file). In some cases you want to bind to external component, and include a version dependency in your component&#8217;s binary representation. In my source code I can say &#8220;import webservices.securesocket&#8221;, should I really have to go over to the makefile or build.xml in order to specify which version of the package I need to depend on?  A lot of what currently needs to go in the build structures should be folded into a new style of &#8220;rich&#8221; source code.</p>
<p>Static analysis: There&#8217;s a very useful development cycle in statically typed languages where you iterate between the compiler and editor while the compiler tells you about static typing errors in your source code.  But there are other static analysis tools besides the compiler.  The &#8220;compiler instructions&#8221; programming facet that I described above should be extended to include giving instructions to multiple static analysis tools in a unified way. Alternatively, the compiler can be extended as a universal front-end to outside analysis tools. Either way, this facet of programming should be expanded.</p>
<p>With this understanding as a basis, the next exercise would be to define a streamlined language that could be used as the basis for this kind of modern authoring system.</p>
]]></content:encoded>
			<wfw:commentRss>http://quenelle.org/unix/2009/facets/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>The next big concurrent language</title>
		<link>http://quenelle.org/unix/2009/concurrent-language/</link>
		<comments>http://quenelle.org/unix/2009/concurrent-language/#comments</comments>
		<pubDate>Wed, 07 Oct 2009 02:08:24 +0000</pubDate>
		<dc:creator>Chris Quenelle</dc:creator>
				<category><![CDATA[Compilers]]></category>
		<category><![CDATA[Developer Tools]]></category>

		<guid isPermaLink="false">http://quenelle.org/unix/?p=267</guid>
		<description><![CDATA[<p>Tim Bray has been writing his thoughts recently on the topic of the next big language for concurrency.</p> <p>Let me start by saying I&#8217;m completely an arm-chair quarterback here, I&#8217;ve never used a functional language for a real project, but I&#8217;ve worked in the area of development tools and multi-threaded applications for many years. I&#8217;ve [...]]]></description>
			<content:encoded><![CDATA[<p>Tim Bray has been writing his thoughts recently on the topic of the <a title="Tim's concur.next blog" href="http://www.tbray.org/ongoing/When/200x/2009/09/27/Concur-dot-next" target="_self">next big language for concurrency</a>.</p>
<p>Let me start by saying I&#8217;m completely an arm-chair quarterback here, I&#8217;ve never used a functional language for a real project, but I&#8217;ve worked in the area of development tools and multi-threaded applications for many years. I&#8217;ve watched a lot of language extensions and libraries come and go over the years claiming to &#8220;solve&#8221; the problems of parallel coding.  I&#8217;ve also seen some pretty fancy analysis done by compilers, which seems like it could be better leveraged if the languages had better ways to communicate the intent of the code author.</p>
<p>Do we need a new language for concurrency?</p>
<p>My assumption is that the development of OO programming was the result of increasing software complexity, not a response to a particular change in the capabilities of computer hardware (like multi-core is hitting us today).</p>
<p>Over the last many years, distributed networks of computers have been a very popular platform for writing software.  There are many libraries and frameworks for dealing with distributed systems, but specific languages that address that need (I&#8217;m sure there are some) have not become popular in general.  Distributed programs are still written mostly in languages that don&#8217;t have any specific features to support distributed programming.</p>
<p>So I don&#8217;t think the need for concurrency itself will drive the adoption of a new language.  The compelling argument for me is the possibility that the needs of multi-core (and hence multi-threaded) programming may drive software complexity far enough that we need another big leap in programming technology.  I&#8217;m skeptical that&#8217;s the case, but it won&#8217;t stop me from theorizing about what the next leap in programming technology might be.  <img src='http://quenelle.org/unix/wp-includes/images/smilies/icon_smile.gif' alt=':-)' class='wp-smiley' /> </p>
<p>Eventually we&#8217;ll need a new language, what will it be like?</p>
<p>Global state makes multi-threaded programs difficult to write and maintain because it requires synchronization.  The problem is not the synchronization, the problem is the global state. That&#8217;s a lesson I take from functional languages. Previous attempts to address concurrent programming tended to focus on encapsulating the synchronization, instead of encapsulating (or abstracting away) the global state.  For example, a parallel language extension that allows you to specify a matrix operation without needing to name any iterator variables has abstracted away the global state (in this case, the iterator variable).  A language feature (like OpenMP) that tells the compiler where and how to synchronize, but still requires you to code the iteration yourself, is hiding the synchronization but not the the global state.</p>
<p>It&#8217;s tempting to look for a language that emphasizes functional programming in its design, but that&#8217;s not necessarily the right approach.  There are many difficult and complex aspects to writing software, and the problem of global state is just one more. The right response is to look for a language that makes it easy to <strong>encapsulate</strong> global state.  In general, functional languages don&#8217;t necessarily make it easy to encapsulate global state. I think the correct response is to look at languages that can abstract away the complexity of MT coding and global state in effective ways.</p>
<p>So here&#8217;s an analogy: A long time ago I took a course on the software APIs used to internationalize software.  My main take-away was the the best way to internationalize any sort of library was to remove all the messages from the library, and only return diagnostic codes.  In other words, the best way to internationalize code is not to have to.  Similarly, the best way to synchronize code is not to have to. You want to encapsulate it into a specialized module.</p>
<p>In a layered application that is concurrent, you want to focus on making the lowest layers of software completely reentrant (that is, side-effect free). It&#8217;s generally not a big deal if the very top layer has global state, as long as the top layer is sufficiently thin. You want a language that makes it easy to write side-effect free code, but there is still lots of code that needs to have side-effects that can&#8217;t be ignored.</p>
<p>So it seems to me that the key feature we should be looking for is a significantly increased ability to abstract away implementation details.  By the way, any functional language that requires coders to understand how/why/when to write a tail-recursive function loses out big time in the abstraction department.</p>
<p>I was recently inspired by a paper in IEEE Computer that talked about a research language called SequenceL. I discussed it in a previous blog. The benefits of SequenceL are described as the ability to write executable code that maps as directly as possible into a requirements specification in the jargon of the problem domain.  This meshes with the recent discussions of DSLs (domain specific languages) as a good way to encapsulate various concurrent implementations.</p>
<p>Check out <a href="http://quenelle.org/unix/2009/sequencel/" target="_self">my last blog entry about SequenceL</a>, and read the paper, it&#8217;s very well written.  If you have a direct link for it, please let me know.</p>
]]></content:encoded>
			<wfw:commentRss>http://quenelle.org/unix/2009/concurrent-language/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

