<?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>Jeff Mather's Dispatches &#187; Computing</title>
	<atom:link href="http://jeffmatherphotography.com/dispatches/category/computing/feed/" rel="self" type="application/rss+xml" />
	<link>http://jeffmatherphotography.com/dispatches</link>
	<description>The 9 to 5 Life of an International Playboy</description>
	<lastBuildDate>Fri, 30 Jul 2010 18:48:55 +0000</lastBuildDate>
	<generator>http://wordpress.org/?v=2.9.1</generator>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
			<item>
		<title>A Menagerie of Image File Formats</title>
		<link>http://jeffmatherphotography.com/dispatches/2010/05/a-menagerie-of-image-file-formats/</link>
		<comments>http://jeffmatherphotography.com/dispatches/2010/05/a-menagerie-of-image-file-formats/#comments</comments>
		<pubDate>Tue, 18 May 2010 21:02:58 +0000</pubDate>
		<dc:creator>Jeff Mather</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[File Formats]]></category>
		<category><![CDATA[Fodder for Techno-weenies]]></category>
		<category><![CDATA[Life Lessons]]></category>

		<guid isPermaLink="false">http://jeffmatherphotography.com/dispatches/?p=778</guid>
		<description><![CDATA[This is a follow-up to my recent post on parsing NITF files that contain JPEG data.  It&#8217;s basically a crash course into the organization of the guts of image file formats.  If I were ever asked to be an expert witness in a trial, it would probably be about file formats.*  This [...]]]></description>
			<content:encoded><![CDATA[<p><i>This is a follow-up to my recent post on <a href="http://jeffmatherphotography.com/dispatches/2010/05/nitf-jpeg/">parsing NITF files that contain JPEG data</a>.  It&#8217;s basically a crash course into the organization of the guts of image file formats.  If I were ever asked to be an expert witness in a trial, it would probably be about file formats.*  This is the area of my expertise.</i></p>
<p>You can divide the world of image file formats into different kingdoms based on the their structure.  There is some overlap between these categories, but for the most part image formats are (1) tag/record-based, (2) structure-like, (3) marker/stream-based, (4) textual, (5) card-like, (6) raw, or (7) opaque.</p>
<p>TIFF, DNG, and DICOM are examples of tag/record-based formats.  A unique tag identifies the entity in the file and its meaning.  For example, a particular hexadecimal tag might indicate that this is the &#8220;photometric interpretation&#8221; record.  The datatype of this record either explicitly appears after the tag or appears in a data dictionary that&#8217;s known to the application developer.  Almost always, these records explicitly tell the length of their data, which makes it easy to skip to the tag location of the next record.</p>
<p>Microsoft was (for a time) very fond of making structure-like formats.  In these formats, the file looks a lot like the memory representation of a C/C++ data structure.  These formats are easy to describe and easy to read if you have the structure definition; simply <tt>fread()</tt> the data into a variable and reference the data members by name.  The problems should be pretty clear.  You need to be using a programming language that supports C structs.  And you need to know the layout of the struct.  And once you define the layout of the struct, it&#8217;s fixed.  (Well, not exactly.  Microsoft changed the data layout in its BMP family of formats with every release of Windows, and used a &#8220;magic&#8221; value to tell readers which struct to use.)  All told, it&#8217;s a very brittle kind of format.</p>
<p>JPEG is the prototypical &mdash; but certainly not the only &mdash; marker-based format.  Markers are special combinations of bytes that, like a tag, tell what the data is that&#8217;s coming next in the stream.  But, very much like struct-based formats and very unlike tagged formats, the data that follows the marker can be heterogeneous.  In JPEG, the data that appears after the SOF (Start of Frame) marker is a record, while the data that follows an RST<i>n</i> marker is just a stream of compressed bytes.  The SOI and EOI (Start/End of image) markers don&#8217;t even have any bytes that follow them.  In marker-based formats, semantics and syntax are rather carelessly jumbled together.</p>
<p>It&#8217;s very difficult to quickly parse marker-based formats, because often markers don&#8217;t specify how much data appears before the next marker.  These are very much &#8220;streams&#8221; of bytes that you&#8217;re forced to read until you come to the next marker.  Consequently the number and appearance of markers is very limited and this limitation ripples through to the data that they contain.  JPEG markers all begin with the <tt>0xFF</tt> byte followed by another byte, which taken together specify which marker it is.  Consequently, the appearance of an <tt>0xFF</tt> byte in the data of a marker has to be escaped by a NULL byte so that it&#8217;s not mistaken for the next marker.</p>
<p>Textual formats, such as XML, have the benefit of being self-describing and readable by both humans and machines.  Their main drawbacks are the inflated size of the data they contain (even when represented in a semi-binary <tt>CDATA</tt> hunk) and the inability to quickly skip through them with binary I/O routines.</p>
<p>FITS is a fairly prototypical &#8220;card-like&#8221; format.  As the name implies, these are fixed-length records like one might have encountered on a punch card.  For example in format with 120-character records, the first <i>n</i> characters are reserved for the &#8220;variable name&#8221; part of the equation, while the remaining 120-<i>n</i> characters are the textual representation of the value of the record.  They are frequently text-only for the descriptive part of the format with a binary payload at the end.  These are easy to read, but a pain to parse, since the &#8220;right hand side&#8221; values often have to be interpreted.</p>
<p>Raw and opaque formats aren&#8217;t very easy to describe because they&#8217;re so varied.  In a &#8220;raw&#8221; format (and there are dozens or hundreds&nbsp;.&nbsp;.&nbsp;. possibly more) all of the bytes are jumbled together in a payload-only file.  A separate file may have a header that describes the data and helps a reader/parser make sense of the payload.  Or not.  These are almost always completely free of any helpful description within the file.</p>
<p>This shouldn&#8217;t be confused with opaque files, such as HDF, CDF, or netCDF.  These formats are completely defined by their API, which for all intents and purposes, you have to use to access the data within the file.  This allows for a lot of richness in handling the data contents, which can be organized in highly optimized ways.  The downside is that you&#8217;re limited in how you can interact with your data to mechanisms someone else has defined.  And data permanence can suffer, since if the tool chain changes (or goes out of existence) you don&#8217;t really have a way to get at your data.</p>
<p>Practically, each format style has it&#8217;s pros and cons.  But tagged formats (which might incorporate features of the record style) are the most durable and easiest for third-parties to work with.</p>
<p><br clear="all" />* &mdash; Cue awesome &#8220;CSI&#8221; + &#8220;Law and Order&#8221; + &#8220;House&#8221; mashup daydream.  *DOINK DOINK*</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmatherphotography.com/dispatches/2010/05/a-menagerie-of-image-file-formats/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>NITF + JPEG</title>
		<link>http://jeffmatherphotography.com/dispatches/2010/05/nitf-jpeg/</link>
		<comments>http://jeffmatherphotography.com/dispatches/2010/05/nitf-jpeg/#comments</comments>
		<pubDate>Tue, 18 May 2010 21:01:26 +0000</pubDate>
		<dc:creator>Jeff Mather</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[File Formats]]></category>
		<category><![CDATA[Fodder for Techno-weenies]]></category>
		<category><![CDATA[Life Lessons]]></category>

		<guid isPermaLink="false">http://jeffmatherphotography.com/dispatches/?p=737</guid>
		<description><![CDATA[I&#8217;ve recently been working with streams of JPEG data inside of NITF files.  Given my experience supporting I/O involving DICOM files that contain JPEG-compressed imagery, I was extremely surprised to learn how difficult it is to read JPEG from &#8220;National Imagery Transmission Format&#8221; files.  This post exists to help the next person who [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;ve recently been working with streams of JPEG data inside of NITF files.  Given my experience supporting I/O involving DICOM files that contain JPEG-compressed imagery, I was extremely surprised to learn how difficult it is to read JPEG from &#8220;National Imagery Transmission Format&#8221; files.  This post exists to help the next person who needs to read JPEG data embedded in NITF or another file format.</p>
<p>My naïve idea was to copy the JPEG-encoded to a temporary file and then read that file using the <a href="http://www.ijg.org/">Independent JPEG Group</a>&#8217;s libjpeg library.  That&#8217;s what I did with JPEG data encapsulated in DICOM.  This is far too simple an approach for NITF, resulting in incomplete images.  Here&#8217;s why:</p>
<ul>
<li>NITF breaks most images into multiple tiles.</li>
<li>Each tile is independently compressed into its own image stream.</li>
<li>NITF uses &#8220;block masking,&#8221; which prevents storing <i>unimportant</i> tiles.</li>
</ul>
<p>The idea makes sense on one level.  If you&#8217;re going to send an image over a low-bandwidth or low-fidelity channel, you want to limit the amount of data that you send, and you want to avoid an all-or-nothing situation during image transmission or reception.  But it&#8217;s a total pain in the ass for application developers.</p>
<p>Add to this the fact that JPEG is a marker-based format that isn&#8217;t very self-describing, and you have a tricky parsing situation.*</p>
<p>Here&#8217;s the basic idea behind getting imagery out of a NITF file if it&#8217;s been JPEG compressed.  (I assume that you already know how to parse a NITF file &mdash; see <a href="http://www.gwg.nga.mil/ntb/baseline/docs/188_198a/index.html">MIL-STD-188-198A</a> if you don&#8217;t &mdash; and that you have a JPEG codec that you can use to decode the data.)</p>
<ol>
<li>The first two bytes of the compressed stream should be the standard JPEG <tt>SOI</tt> marker (0xFF 0xD8).  This is your sanity check.</li>
<li>The next two bytes should be the <tt>APP6</tt> marker (0xFF 0xE6).  The payload of this marker contains a bunch of useful information about tile sizes and counts, bit depths, etc.  Some of this is redundant with what&#8217;s inside the NITF file.</li>
<li>The remainder of the NITF file should be a bunch of JPEG codestreams delimited by <tt>SOI</tt> and <tt>EOI</tt> (0xFF 0xD9) markers.  Each delimited stream is one tile in the image; and it&#8217;s a completely standalone JPEG stream.  It can be extracted to its own file (if necessary) and decompressed.  Tiles are stored across the image horizontally and then down.</li>
<li>If there&#8217;s no block masking, it suffices to read each tile in turn and store it in the appropriate region in the output image.</li>
<li>If the NITF file does use block masking, use the values in the <tt>BMRnBNDm</tt> attribute of the image subheader to find the locations of the blocks that contain actual image data.  The masked out blocks will have 0xFFFFFFFF values.  The other values &mdash; there&#8217;s one for each tile &mdash; are 0-based offsets pointing to the <tt>SOI</tt> marker that starts each tile, relative to the start of the JPEG compressed data.</li>
</ol>
<p>And that&#8217;s it.  After coding, you should probably test out your parser on <a href="http://www.gwg.nga.mil/ntb/baseline/software/testfile/Nitfv2_1/scen_2_1.html">the sample NITF files</a> provided by the <a href="http://en.wikipedia.org/wiki/National_Geospatial-Intelligence_Agency" title="National Geospatial-Intelligence Agency">NGA</a>.</p>
<p><br clear="all" />* &#8211; You can divide the world of image file formats into different buckets based on the their structure.  There is some overlap between these categories, but for the most part image formats are (1) tag/record-based, (2) structure-like, (3) marker/stream-based, (4) textual, (5) card-like, (6) raw, or (7) opaque.  I&#8217;m going to <a href='http://jeffmatherphotography.com/dispatches/2010/05/a-menagerie-of-image-file-formats/'>write more about this in the next post</a>.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmatherphotography.com/dispatches/2010/05/nitf-jpeg/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Buckshot o&#8217; Links &#8211; Software Development Edition</title>
		<link>http://jeffmatherphotography.com/dispatches/2010/04/buckshot-o-links-software-development-edition/</link>
		<comments>http://jeffmatherphotography.com/dispatches/2010/04/buckshot-o-links-software-development-edition/#comments</comments>
		<pubDate>Fri, 16 Apr 2010 19:56:58 +0000</pubDate>
		<dc:creator>Jeff Mather</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Fodder for Techno-weenies]]></category>
		<category><![CDATA[Hoarding]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://jeffmatherphotography.com/dispatches/?p=701</guid>
		<description><![CDATA[I&#8217;m a hoarder.  I may not have lived through the Great Depression like my grandmother did, but I seem to have inherited the gene that led her to keep dozens of plastic Cool Whip tubs in her attic &#8220;just in case she needed them.&#8221;  My grandfather kept used bolts and nails for reuse. [...]]]></description>
			<content:encoded><![CDATA[<p>I&#8217;m a hoarder.  I may not have lived through the Great Depression like my grandmother did, but I seem to have inherited the gene that led her to keep dozens of plastic Cool Whip tubs in her attic &#8220;just in case she needed them.&#8221;  My grandfather kept used bolts and nails for reuse.  Me, I keep articles about things I think I should know some day.  From smart people on Twitter and e-mail lists and coworkers I gather links to articles, <a href="http://ilovecharts.tumblr.com/post/450388944/brownpau-everytime-you-make-a-powerpoint">PowerPoint presentations</a>, blog posts, and videos.  And they hang out in my browser tabs &mdash; forever.</p>
<p>It&#8217;s time to clear some of them out.  Here are some daytime-themed links.  (If I had a Tumblr account, I&#8217;d just post there.  But I don&#8217;t need another website no one reads.)</p>
<p><b>Parallel Computing</b><br clear="all" />James Reinders of Intel TBB fame estimates that datasets (images, videos, etc.) <a href="http://softtalkblog.wordpress.com/2010/04/13/intel-software-conference-2010-our-obsession-with-data-is-driving-parallelism/">have grown 10x larger</a> over the last five years.  Sequential systems are just too dang slow to process this amount of data.  In the near future, &#8220;parallel programming&#8221; will just become &#8220;programming.&#8221;  (I&#8217;m still hoping for better language support so that state synchronization and multicore memory issues are as easy to get right as the sequential aspects of programming are now.)</p>
<p>New memory models would certainly help.  A new paper, <i><a href="http://uwnews.org/relatedcontent/2010/March/rc_parentID56284_thisID56367.pdf">DMP: Deterministic Shared Memory Multiprocessing</a></i> by Joseph Devietti, Brandon Lucia, Luis Ceze, and Mark Oskin presents some of the problems with the current memory model and provides one possible solution.</p>
<p>Another post on SoftTalk (sponsored by Intel) describes some of the ways that <a href="http://softtalkblog.wordpress.com/2010/04/13/intel-software-conference-2010-intel-software-roadmap-for-2010/">Intel plans to make parallel programming easier this year</a>: Parallel Studio 2010, a Cilk-based offering for task parallelism, &#8220;a data-parallel centric model with safety guarantee,&#8221; new SIMD instructions, and new array notations.</p>
<p>You might also want a <a href="http://softtalkblog.wordpress.com/2010/04/15/intel-software-conference-2010-which-tools-are-right-for-my-program/">high-level view of how Intel&#8217;s offerings work together</a>.</p>
<p>Herb Sutter, who really knows his stuff, wrote an article for Dr. Dobbs a couple years ago about <a href="http://www.drdobbs.com/cpp/211800538">understanding parallel performance</a>.  It&#8217;s one of a series of articles about multicore/multithreaded programming, and this helps set expectations about what&#8217;s possible and gives pointers on where to start making changes.</p>
<p><b>Miscellaneous</b><br clear="all" />Visual Studio + Time Machine = <a href="http://www.drdobbs.com/blog/archives/2010/04/visual_studio_2_3.html">IntelliTrace</a>.  Don&#8217;t just move up and down the call stack; now you can move forward and backward in time, too.</p>
<p>Everything you ever wanted to know about floating-point representation: <a href="http://floating-point-gui.de/">Floating Point Guide</a>.  (Everything, that is, unless you work where I do.  Then you just have to go down the hall to get that last 2%.  Of course, you&#8217;ll be drinking from the fire hose.&nbsp;.&nbsp;.&nbsp;.)</p>
<p>What does Microsoft think are the <a href="http://blogs.msdn.com/somasegar/archive/2010/02/23/key-software-development-trends.aspx">key trends in software development</a>? Cloud computing, the web as a platform, parallel computing, proliferation of devices (with their own capabilities, IO paradigms, etc.), agile development processes, distributed development.  Nothing terribly futuristic here, and comments want to know why &#8220;mobility&#8221; (i.e., phones) isn&#8217;t on the list.</p>
<p>The <a href="http://www.justsoftwaresolutions.co.uk/cplusplus/c++0x-now-at-fcd.html">C++0x &#8220;final draft&#8221; revision</a> is ready for &#8220;final&#8221; comments.  Here&#8217;s your chance to see the significant changes to C++ that will be part of the standard next year (they hope).</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmatherphotography.com/dispatches/2010/04/buckshot-o-links-software-development-edition/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Checklists</title>
		<link>http://jeffmatherphotography.com/dispatches/2010/02/checklists/</link>
		<comments>http://jeffmatherphotography.com/dispatches/2010/02/checklists/#comments</comments>
		<pubDate>Thu, 18 Feb 2010 20:36:43 +0000</pubDate>
		<dc:creator>Jeff Mather</dc:creator>
				<category><![CDATA[Book Notes]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[Life Lessons]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://jeffmatherphotography.com/dispatches/?p=551</guid>
		<description><![CDATA[We use checklists a lot at work.  They help us reduce waste and ensure a high quality product.  If we&#8217;ve run into a problem before, we&#8217;re likely to run into it again, so we might as well go down the checklist of &#8220;Did you think about this?&#8221; and &#8220;Did you do that?&#8221; items [...]]]></description>
			<content:encoded><![CDATA[<p>We use checklists a lot at work.  They help us reduce waste and ensure a high quality product.  If we&#8217;ve run into a problem before, we&#8217;re likely to run into it again, so we might as well go down the checklist of &#8220;Did you think about this?&#8221; and &#8220;Did you do that?&#8221; items before submitting code into the repository.</p>
<p>But our checklists have gotten a little long and messy, which raises the risk that people won&#8217;t use them at all.  Part of my job is to improve our team best practices and checklists, so I&#8217;m working out how to make all of those checklist-bound countermeasures fresher and more accessible.</p>
<p>So I&#8217;m very hopeful that Atul Gawande&#8217;s <a href="http://www.amazon.com/Checklist-Manifesto-How-Things-Right/dp/0805091742" title="Amazon: The Checklist Manifesto"><i>The Checklist Manifesto: How to Get Things Right</i></a>, which arrived on my desk today, will give me some in-the-trenches perspective.  I&#8217;ll keep y&#8217;all posted on what I learn.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmatherphotography.com/dispatches/2010/02/checklists/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Generating globally unique values on Linux</title>
		<link>http://jeffmatherphotography.com/dispatches/2009/07/generating-globally-unique-values-on-linux/</link>
		<comments>http://jeffmatherphotography.com/dispatches/2009/07/generating-globally-unique-values-on-linux/#comments</comments>
		<pubDate>Tue, 28 Jul 2009 15:06:11 +0000</pubDate>
		<dc:creator>Jeff Mather</dc:creator>
				<category><![CDATA[Computing]]></category>

		<guid isPermaLink="false">http://jeffmatherphotography.com/dispatches/2009/07/generating-globally-unique-values-on-linux/</guid>
		<description><![CDATA[I may expand this later.&#160;.&#160;.&#160;.
Query the file /proc/sys/kernel/random/uuid for a globally unique value.  It produces a new value on each read.  For a globally unique value that&#8217;s persistent between machine startup, query /proc/sys/kernel/random/boot_id.
[earth:/]120 % cat /proc/sys/kernel/random/uuid
78345a49-875f-48d3-aa80-130db5e57991

[earth:/]121 % cat /proc/sys/kernel/random/uuid
d258123d-f2bd-49c0-89d6-e4db5d377776

[earth:/]122 % cat /proc/sys/kernel/random/boot_id
e58a255a-0f6c-418f-ac0b-0fac81a5ff4a

[earth:/]123 % cat /proc/sys/kernel/random/boot_id
e58a255a-0f6c-418f-ac0b-0fac81a5ff4a

]]></description>
			<content:encoded><![CDATA[<p><i>I may expand this later.&nbsp;.&nbsp;.&nbsp;.</i></p>
<p>Query the file <tt>/proc/sys/kernel/random/uuid</tt> for a globally unique value.  It produces a new value on each read.  For a globally unique value that&#8217;s persistent between machine startup, query <tt>/proc/sys/kernel/random/boot_id</tt>.</p>
<pre>[earth:/]120 % cat /proc/sys/kernel/random/uuid
78345a49-875f-48d3-aa80-130db5e57991

[earth:/]121 % cat /proc/sys/kernel/random/uuid
d258123d-f2bd-49c0-89d6-e4db5d377776

[earth:/]122 % cat /proc/sys/kernel/random/boot_id
e58a255a-0f6c-418f-ac0b-0fac81a5ff4a

[earth:/]123 % cat /proc/sys/kernel/random/boot_id
e58a255a-0f6c-418f-ac0b-0fac81a5ff4a
</pre>
]]></content:encoded>
			<wfw:commentRss>http://jeffmatherphotography.com/dispatches/2009/07/generating-globally-unique-values-on-linux/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>MATLAB and Greenspun&#8217;s 10th Rule</title>
		<link>http://jeffmatherphotography.com/dispatches/2009/06/matlab-and-greenspuns-10th-rule/</link>
		<comments>http://jeffmatherphotography.com/dispatches/2009/06/matlab-and-greenspuns-10th-rule/#comments</comments>
		<pubDate>Fri, 26 Jun 2009 19:24:52 +0000</pubDate>
		<dc:creator>Jeff Mather</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Life Lessons]]></category>
		<category><![CDATA[MATLAB]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://jeffmatherphotography.com/dispatches/2009/06/matlab-and-greenspuns-10th-rule/</guid>
		<description><![CDATA[Just to get this disclaimer out of the way, let&#8217;s remind everyone that this is my personal website.  Even though I may write some of the articles at work about things I&#8217;ve done at work, they aren&#8217;t in anyway supervised or endorsed by my employer.  I&#8217;m only including this disclaimer because this article [...]]]></description>
			<content:encoded><![CDATA[<p><i>Just to get this disclaimer out of the way, let&#8217;s remind everyone that this is my personal website.  Even though I may write some of the articles at work about things I&#8217;ve done at work, they aren&#8217;t in anyway supervised or endorsed by my employer.  I&#8217;m only including this disclaimer because this article is meant to be self-deprecating in that &#8220;I had the best of intentions, but now I feel a little silly&#8221; way.</i></p>
<p>Several years ago I read <a href="http://c2.com/cgi/wiki?GreenspunsTenthRuleOfProgramming">Greenspun&#8217;s Tenth Rule of Programming</a>: &#8220;Any sufficiently complicated C or Fortran program contains an ad-hoc, informally-specified, bug-ridden, slow implementation of half of Common Lisp.&#8221;  Basically it&#8217;s a joke about feature creep in software.  I was reminded of this quotation today when I started reading Joshua Kerievsky&#8217;s <i>Refactoring to Patterns</i>.  He describes the perils of over-engineering, which is basically the same as wasting money.</p>
<p>You see, about seven or eight years ago, I added a Lisp parser to a feature in MATLAB&#8217;s Image Processing Toolbox.  If you have the toolbox, just take a look in <tt>toolbox/images/iptformats/private/dicom_create_IOD.m</tt>.  There you&#8217;ll see a part of the code that looks like this:</p>
<pre>
function tf = check_condition(expr, metadata)
%CHECK_CONDITION  Determine whether a particular condition is true.
%
%   Conditions are LISP-style cell arrays.  The first element is a
%   conditional operator, remaining cells are arguments to the operator.
%
%   Conditions can be nested.  Each cell array in expr indicates a new
%   conditional expression.

[snip]

%
% Process conditional expressions recursively.
%
switch (lower(operator))
case 'and'

    % This AND short circuits.
    for p = 1:numel(operands)
        tf = check_condition(operands{p}, metadata);

        if (~tf)
            return
        end
    end

[snip]
</pre>
<p>So why did I do this?  The DICOM file format has conditional elements, which only show up in the file if other elements are present, are absent, or have a particular value.  I wanted to create a general-purpose, reusable, extensible mechanism for describing these conditions so that I didn&#8217;t actually have to write code for all of those conditionals.  Moreover, I wanted our customers to be able to write the conditions in a nice tabular form rather than writing code, because &mdash; you know &mdash; one day they would want to write more of the dozens of kinds of DICOM information objects from scratch than we supported right out of the box.</p>
<p>You probably see where this is going.  We ended up extending the product in a different direction after we learned more about how our customers actually wanted to use the DICOM export functionality.  So, if you need a Lisp-like algebraic Boolean logic parser in MATLAB, just go look in the previously mentioned file.  (Also take a look at the <tt>dicom_modules.m</tt> file in the same directory to see how to express those conditions.)  But for g-d&#8217;s sake, ask yourself if you really, really need that, or if you aren&#8217;t just fooling yourself into over-engineering your code.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmatherphotography.com/dispatches/2009/06/matlab-and-greenspuns-10th-rule/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>AMD performance counters</title>
		<link>http://jeffmatherphotography.com/dispatches/2009/05/amd-performance-counters/</link>
		<comments>http://jeffmatherphotography.com/dispatches/2009/05/amd-performance-counters/#comments</comments>
		<pubDate>Wed, 27 May 2009 18:51:03 +0000</pubDate>
		<dc:creator>Jeff Mather</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[Fodder for Techno-weenies]]></category>
		<category><![CDATA[From the Yellow Notepad]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://jeffmatherphotography.com/dispatches/2009/05/amd-performance-counters/</guid>
		<description><![CDATA[Here&#8217;s a little reminder for myself and for anyone on the web who&#8217;s searching for information about AMD Athlon and/or Opteron performance counters.
AMD Performance counter resources:

Doc #26094, Chapter 10 (very detailed!)
Doc #22007, Appendix D (part of the Optimization Guide)
Doc #24593, Chapter 13 (part of the AMD64 Architecture Programmer’s Manual)
Doc #41256, Section 3.14 (somewhat older, but [...]]]></description>
			<content:encoded><![CDATA[<p>Here&#8217;s a little reminder for myself and for anyone on the web who&#8217;s searching for information about AMD Athlon and/or Opteron performance counters.</p>
<p>AMD Performance counter resources:</p>
<ul>
<li><a href="http://support.amd.com/us/Processor_TechDocs/26094.PDF">Doc #26094</a>, Chapter 10 (very detailed!)</li>
<li><a href="http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/22007.pdf">Doc #22007</a>, Appendix D (part of the <i>Optimization Guide</i>)</li>
<li><a href="http://www.amd.com/us-en/assets/content_type/white_papers_and_tech_docs/22007.pdf">Doc #24593</a>, Chapter 13 (part of the <i>AMD64 Architecture Programmer’s Manual</i>)</li>
<li><a href="http://support.amd.com/us/Processor_TechDocs/41256.pdf">Doc #41256</a>, Section 3.14 (somewhat older, but still good)</li>
<li><a href="http://oprofile.sourceforge.net/docs/amd-hammer-events.php">OProfile documentation</a> (a list of CPU performance events)</li>
</ul>
<p>Less techie posts to follow .&nbsp;.&nbsp;. honestly.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmatherphotography.com/dispatches/2009/05/amd-performance-counters/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Rememberance of things past</title>
		<link>http://jeffmatherphotography.com/dispatches/2009/05/rememberance-of-things-past/</link>
		<comments>http://jeffmatherphotography.com/dispatches/2009/05/rememberance-of-things-past/#comments</comments>
		<pubDate>Thu, 21 May 2009 15:50:28 +0000</pubDate>
		<dc:creator>Jeff Mather</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[General]]></category>
		<category><![CDATA[Software Engineering]]></category>
		<category><![CDATA[Travel]]></category>
		<category><![CDATA[Worthy Feeds]]></category>

		<guid isPermaLink="false">http://jeffmatherphotography.com/dispatches/2009/05/rememberance-of-things-past/</guid>
		<description><![CDATA[This has been the busiest year ever.  True, last year I was in school and (consequently) working twice as much. But this year, I&#8217;ve actually gone places and done things that have generally kept me away from posting here.
In January, I went to the Electronic Imaging symposium in San Jose, promised to write about [...]]]></description>
			<content:encoded><![CDATA[<p>This has been the busiest year ever.  True, last year I was in school and (consequently) working twice as much. But this year, I&#8217;ve actually gone places and done things that have generally kept me away from posting here.</p>
<p>In January, <a href="http://jeffmatherphotography.com/dispatches/2009/01/matlab-in-3d/">I went to the Electronic Imaging symposium</a> in San Jose, promised to write about what I learned and then did not.  In February, I went on a &#8220;business trip&#8221; to Cozumel &mdash; via cruise ship &mdash; and then posted some of the <a href="http://jeffmatherphotography.com/dispatches/2009/02/recent-holga-photos/">photos I made on my Holga camera</a>.  Then in March, Lisa and I went to Paris to celebrate my graduation.  I could talk your ear off all day about how much I love Paris; and if you&#8217;re Lisa, you&#8217;re probably sick of hearing me walk around the house sighing and saying &#8220;I miss Paris.&#8221;  (Sorry!)  Most recently, I promised to post pictures from my <a href="http://jeffmatherphotography.com/dispatches/2009/04/utah-bound/">backpacking/camping/hiking trip to Utah</a>.  I did put some of them into a <a href="http://www.flickr.com/photos/jeff_mather/sets/72157618085362322/">photoset on Flickr</a>, but I haven&#8217;t gotten them here yet.  Tomorrow I&#8217;m off to Iowa for a family reunion.</p>
<p>&#8220;But what about the other 15-or-so weeks of the year?  Why no posts?&#8221;</p>
<p>It isn&#8217;t that I haven&#8217;t had any ideas.  Here are some of the things I jotted down that I should write about:</p>
<p><b>Physical architecture vs. software architecture, with respect to the visibility and communication of design</b> &mdash; I actually started writing a bit about this after some lengthy conversations with coworkers.  Basically, I yearn for the day when software engineers can have books like <a href="http://www.amazon.com/Detail-Process-AsBuilt-Christine-Killory/dp/1568987188" title="Amazon: Detail in Process">this</a>, <a href="http://www.amazon.com/Details-Contemporary-Architecture-Christine-Killory/dp/1568985762" title="Amazon: Details in Contemporary Architecture">this</a>, and <a href="http://www.amazon.com/Materials-Design-Victoria-Ballard-Bell/dp/1568985584" title="Amazon: Materials for Design">this</a>.  We need a shared visual grammar, shared materials, and shared processes so that we too can have coffee-table books that inspire our cohort.</p>
<p><b>A response to Jeff Atwood on (not) reinventing the wheel again .&nbsp;.&nbsp;. and again</b> &mdash; Given what I just wrote above, it&#8217;s no surprise that I would be disappointed after reading <a href="http://www.codinghorror.com/blog/archives/001145.html" title="Coding Horror: Don't Reinvent The Wheel, Unless You Plan on Learning More About Wheels">an article that advocates waste</a>.  I hope one day to live in a software engineering world which is more like a real engineering world, a world in which there are two kinds of software businesses: (1) the businesses where almost everyone buys off-the-shelf or special-order parts and uses them to build incredible things, innovating very broadly and (2) the businesses that specialize in making those off-the-shelf and special-order parts, making them well, and innovating very deeply.</p>
<p><b>Design blogs</b> &mdash; I&#8217;ve been making a little list of design blogs that I like.&nbsp;.&nbsp;.&nbsp;. I&#8217;m a total tease, though, so I&#8217;ll share them later.</p>
<p><b>My notebooks</b> &mdash; One of those afore(un)mentioned design web sites has an occasional series looking inside designers&#8217; notebooks.  (<a href="http://designobserver.com/archives/entry.html?id=38831">For example.</a>)  I keep most of my thoughts (and some designs) worth remembering in <a href="http://jeffmatherphotography.com/dispatches/category/historical-record/">journals</a> and took some beauty shots of them.  I&#8217;ve actually downloaded the photos off my camera into Lightroom.</p>
<p><b>French music</b> &mdash; The French are different.  Especially in their musical tastes.  I like some of it and thought about shilling for folks like Mylène Farmer, Mara Tremblay, A.D.N., Abd al Malik, Karna, MC Solaar, Cœur de Pirate, Alain Bashung, Dumas, Karkwa, Noir Désir, Prototypes, Vulgaires Machins, and Indochine.</p>
<p><b>Women in Software Engineering</b> &mdash; Though I&#8217;m not part of the Ruby/Rails communities I was disappointed to see the kerfuffle over a recent presentation which reminded many of us how few women there are in our profession, how they&#8217;re often (subconsciously) typecast, and how their accomplishments don&#8217;t often get enough attention.  So here are some belated congratulations to Barbara Liskov, winner of the most recent Turing Award.  And I like <a href="http://lizkeogh.com/">Liz Keogh&#8217;s web site</a>.</p>
<p><b>My grad program</b> &mdash; In a nutshell, I enjoyed my time at Brandeis as I worked toward my master of software engineering (M.S.E.) degree.  I learned a lot of practical things related to software construction, tooling, and process (just as <a href="http://jeffmatherphotography.com/dispatches/2006/07/backtoschool/">I hoped that I would</a>).</p>
<p>And finally, <b>Lent and my year-long cleaning project</b> &mdash; After graduating I looked around my office/library and was shocked at how <strike>cluttered</strike> it was.  So just before the new year, I resolved to get through all of the magazines, papers, articles, etc. in my big cardboard &#8220;in-box&#8221; &mdash; seriously, it&#8217;s big &mdash; by the end of 2009 and recycle whatever is left on January 1st, 2010.  My progress is slow. (I&#8217;m being very generous to myself right there.)  So for Lent I decided to better myself by working on my reading pile.  In particular, I forbade myself to add more things to it.  Basically, I&#8217;ve gotten to that point in my life where I need to put myself on an information diet or two.  Which I&#8217;ve done, although I find myself snacking a lot.</p>
<p>Anyway, that&#8217;s what I&#8217;ve been doing: reading from the big in-box, watching some of the 499 films in my Netflix queue, reading other people&#8217;s web sites*, writing in my own journal, photographing, gardening, carpooling, and more-or-less not writing here. More to come, eventually.&nbsp;.&nbsp;.&nbsp;.</p>
<p>* &nbsp; Thanks for nothing, Facebook and Twitter!  Just kidding.  You know I love you.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmatherphotography.com/dispatches/2009/05/rememberance-of-things-past/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Surveying Quality in Object-Oriented Design</title>
		<link>http://jeffmatherphotography.com/dispatches/2008/11/surveying-quality-in-object-oriented-design/</link>
		<comments>http://jeffmatherphotography.com/dispatches/2008/11/surveying-quality-in-object-oriented-design/#comments</comments>
		<pubDate>Thu, 27 Nov 2008 02:51:48 +0000</pubDate>
		<dc:creator>Jeff Mather</dc:creator>
				<category><![CDATA[C]]></category>
		<category><![CDATA[Computing]]></category>
		<category><![CDATA[From the Yellow Notepad]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://jeffmatherphotography.com/dispatches/2008/11/surveying-quality-in-object-oriented-design/</guid>
		<description><![CDATA[Just a short post informing you about a survey paper I wrote for my object-oriented (OO) design class: Surveying Quality in Object-Oriented Design.  In it, I look at the major books and articles concerning best practices for OO design.  If you do OO programming, you&#8217;ll probably find something interesting.  (It&#8217;s language-neutral, too.)

The [...]]]></description>
			<content:encoded><![CDATA[<p>Just a short post informing you about a survey paper I wrote for my object-oriented (OO) design class: <a href="/misc/oo_heuristics.pdf">Surveying Quality in Object-Oriented Design</a>.  In it, I look at the major books and articles concerning best practices for OO design.  If you do OO programming, you&#8217;ll probably find something interesting.  (It&#8217;s language-neutral, too.)</p>
<blockquote>
<p>The major goals of using object-oriented design are to facilitate the maintenance and extension of software systems by reducing the complexity of software at the class and system level.  Successful OO designs are resilient to change, largely because they manage interclass dependencies.  In such a system, changes to one part of the system are localized and do not cause a chain of modifications through the system.</p>
<p>The major techniques that OO designers have at their disposal are abstraction, encapsulation, inheritance, polymorphism, and composition.  But how does an engineer apply these techniques to create a good design?  What are the main ways that sets of classes can be structured and interact to maximize the chance of a successful design?  Over the last twenty years, numerous OO practitioners have developed a mature set of rules-of-thumb and best practices to use when constructing and evaluating OO design.</p>
</blockquote>
<p>If you celebrate it, enjoy your Thanksgiving tomorrow.  Don&#8217;t do any homework if you can help it.  I won&#8217;t!</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmatherphotography.com/dispatches/2008/11/surveying-quality-in-object-oriented-design/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Announcing a Series on Design Patterns</title>
		<link>http://jeffmatherphotography.com/dispatches/2008/09/announcing-a-series-on-design-patterns/</link>
		<comments>http://jeffmatherphotography.com/dispatches/2008/09/announcing-a-series-on-design-patterns/#comments</comments>
		<pubDate>Wed, 24 Sep 2008 14:53:10 +0000</pubDate>
		<dc:creator>Jeff Mather</dc:creator>
				<category><![CDATA[Computing]]></category>
		<category><![CDATA[From the Yellow Notepad]]></category>
		<category><![CDATA[Software Engineering]]></category>

		<guid isPermaLink="false">http://jeffmatherphotography.com/dispatches/2008/09/announcing-a-series-on-design-patterns/</guid>
		<description><![CDATA[The first week of my final semester of grad school is in the bag.  This go-round is all about software design, both low-level (&#8220;RSEG 109: Object-Oriented Design&#8220;) and high-level (&#8220;RSEG 290: Special Topics: Design Patterns&#8221;).  When you add in the reading group we&#8217;re starting at work, this could also be called the &#8220;UML [...]]]></description>
			<content:encoded><![CDATA[<p>The first week of my final semester of grad school is in the bag.  This go-round is all about software design, both low-level (&#8220;<a href="http://www.brandeis.edu/rabbgrad/visitors/course.php?courseid=7693&#038;term=071">RSEG 109: Object-Oriented Design</a>&#8220;) and high-level (&#8220;RSEG 290: Special Topics: Design Patterns&#8221;).  When you add in the <a href="http://www.amazon.com/Head-First-Design-Patterns/dp/0596007124/">reading group</a> we&#8217;re starting at work, this could also be called the &#8220;<a href="http://en.wikipedia.org/wiki/Unified_Modeling_Language">UML</a> semester.&#8221;</p>
<p><a href="http://en.wikipedia.org/wiki/Design_pattern_(computer_science)">Design patterns</a> give a shared vocabulary for talking about common software design features, present how and when to use a design, and lay out the trade-offs of using a particular design. They aren&#8217;t as widely used as they should be in a profession that claims to value reuse. I think that&#8217;s a shame.</p>
<p>As part of the design patterns course, I must create an object model for a real-world problem.  And along the way, I&#8217;ll be learning about most of the two-dozen OO design patterns in the <a href="http://www.amazon.com/Design-Patterns-Object-Oriented-Addison-Wesley-Professional/dp/0201633612/">Gang Of Four book</a>. (Usually I don&#8217;t present solutions to my homework in public because I feel it could help the next semesters&#8217; students cheat; but this semester we&#8217;re each doing our own thing.)</p>
<p>Since I&#8217;m learning about them, I&#8217;ll do my best to write about them over the coming weeks.  If all goes well, I&#8217;ll have an outlet to reinforce what I&#8217;m learning; and you, my dear readers, will have a gentle on-ramp to design patterns, too.</p>
<p>Here&#8217;s the description I submitted last night of the software system I will design:</p>
<div style="background: #c0c0c0; color: #000000">
<p>I will apply design patterns to a simplified web content management system, colloquially known as a &#8220;blog.&#8221;</p>
<p>While blogs frequently are vehicles for cute kitty photos, angst-filled teen poetry, and ill-informed political shouting, this CMS will not know anything special about its content. Here&#8217;s what users will be able to do with it:</p>
<ul>
<li>The blog author(s) will be able to write new articles and edit them before publishing.</li>
<li>Authors will be able to preview articles before publishing.</li>
<li>Authors will be able to post articles and have them appear on the web.</li>
<li>Authors will be able to edit articles after they are published.</li>
<li>The blog&#8217;s readers &#8212; supposing there are any &#8212; will be able to post comments in response to articles.</li>
<li>The CMS software will display the following elements: static text, linked images, embedded objects, and dynamically generated content.</li>
<li>Authors can activate/deactivate &#8220;plugins&#8221; that implement a well-defined API.</li>
<li>Authors will be able to change the appearance of the blog by selecting from an arbitrary set of &#8220;themes.&#8221;</li>
<li>Readers will be able to display single articles or an archive of articles showing a full month of articles.</li>
<li>Readers can navigate from one article (or set of articles) to the prior or next article (or set of articles).</li>
<li>The author can choose whether the CMS stores articles in a database or in a flat-text file.</li>
</ul>
</div>
<p>So keep tuning in, and we&#8217;ll take a tour through design patterns for object-oriented software reuse. And please post comments about where you&#8217;ve been able to use design patterns successfully, if you see anything you would have done differently, or if you just want to leave your two cents.</p>
]]></content:encoded>
			<wfw:commentRss>http://jeffmatherphotography.com/dispatches/2008/09/announcing-a-series-on-design-patterns/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
