<?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>Pieces of Mind &#187; Software Development</title>
	<atom:link href="http://pieces.openpolitics.com/category/software-development/feed/" rel="self" type="application/rss+xml" />
	<link>http://pieces.openpolitics.com</link>
	<description>Puzzlings on software development and other topics of interest</description>
	<lastBuildDate>Tue, 31 Jan 2012 04:17:51 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
		<item>
		<title>A better git stash</title>
		<link>http://pieces.openpolitics.com/2012/01/a-better-git-stash/</link>
		<comments>http://pieces.openpolitics.com/2012/01/a-better-git-stash/#comments</comments>
		<pubDate>Tue, 31 Jan 2012 04:17:51 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://pieces.openpolitics.com/?p=228</guid>
		<description><![CDATA[Jon of saintsjd recently wrote a piece on improving the git user interface. This got me thinking about one of my git peeves. git stash needs another sub-command. Often I want to stash ALL unstaged changes, including new (not yet added) files. This is almost possible with git stash -k, except it does not stash [...]]]></description>
			<content:encoded><![CDATA[<p>Jon of <a href="http://www.saintsjd.com">saintsjd</a> recently wrote a piece on <a href="http://www.saintsjd.com/2012/01/a-better-ui-for-git/">improving the git user interface</a>. This got me thinking about one of my git peeves.</p>
<p><code>git stash</code> needs another sub-command. Often I want to stash ALL unstaged changes, including new (not yet added) files. This is almost possible with <code>git stash -k</code>, except it does not stash new files, which is very important.</p>
<p>Enter <code>git stash unstaged</code>. So now I&#8217;ve stashed the unstaged changes. That is, I&#8217;ve stashed all the changes I do not want included in the next commit. I can now run my tests as I always do before I commit&#8230; That&#8217;s what you do too, right? Oops, the tests fail because I forgot to add a file, which now happens to be in the stash. At this point I do not know of a way to get my stashed changes back exactly as they were before I stashed them, that is, unstaged. It&#8217;s really bad if there are some files that are partially staged (i.e., only certain hunks were staged), because they will create conflicts if I attempt to apply the stash right now. This should be possible. There should be a way to get things back exactly as they were before I stashed them. The missing command is <code>git stash pop unstaged</code>, which applies all of the changes from the stash and puts them in the unstaged (off-stage? pre-stage?) area, without conflicts.</p>
<p>In summary:</p>
<ul>
<li><code>git stash unstaged</code> &#8211; stash all changes that are not currently staged, including new and removed files</li>
<li><code>git stash pop unstaged</code> &#8211; pop the top stash as unstaged changes</li>
</ul>
<p>This would greatly improve my workflow when I get over-zealous and start changing more than I want to commit at one time (happens all the time). It would make it much easier to isolate those changes into individual, logical commits.</p>
]]></content:encoded>
			<wfw:commentRss>http://pieces.openpolitics.com/2012/01/a-better-git-stash/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>SQLAlchemy-Migrate vs Alembic</title>
		<link>http://pieces.openpolitics.com/2011/11/sqlalchemy-migrate-vs-alembic/</link>
		<comments>http://pieces.openpolitics.com/2011/11/sqlalchemy-migrate-vs-alembic/#comments</comments>
		<pubDate>Mon, 07 Nov 2011 15:49:44 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Python]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://pieces.openpolitics.com/?p=189</guid>
		<description><![CDATA[I made this list while evaluating schema migration tools for SQLAlchemy (currently at 0.7.3) with PostgreSQL and SQLite. This is a very high-level overview of my findings specifically related to the project I&#8217;m currently working on. I do not have experience with either SQLAlchemy-Migrate or Alembic, although I do have experience with Django South, so [...]]]></description>
			<content:encoded><![CDATA[<p>I made this list while evaluating schema migration tools for <a href="http://www.sqlalchemy.org/">SQLAlchemy</a> (currently at 0.7.3) with <a href="http://www.postgresql.org/">PostgreSQL</a> and <a href="http://www.sqlite.org/">SQLite</a>. This is a very high-level overview of my findings specifically related to the project I&#8217;m currently working on. I do not have experience with either <a href="http://code.google.com/p/sqlalchemy-migrate/">SQLAlchemy-Migrate</a> or <a href="http://pypi.python.org/pypi/alembic/0.1alphadev">Alembic</a>, although I do have experience with <a href="http://south.aeracode.org/">Django South</a>, so I&#8217;m familiar with the issues of schema branching, etc. At the time of this writing I have a working (patched) SQLAlchemy-Migrate 0.7.2 system, but did not yet try to get Alembic (0.1alphadev) up and running, mostly due to lack of documentation.</p>
<p>&nbsp;</p>
<p>SQLAlchemy-Migrate pros:</p>
<ul>
<li>nice documentation</li>
<li>seems to be more widely used in the community</li>
<li>has (experimental) schema/model comparison tools</li>
<li>maybe approximates non-linear (but ordered) versioning with timestamped scripts?</li>
<li>more development activity</li>
</ul>
<p>SQLAlchemy-Migrate cons:</p>
<ul>
<li>requires a patch to get <code>make_update_script_for_model</code> working with (SA 0.7.3?) <code>TypeDecorator</code></li>
</ul>
<p>&nbsp;</p>
<p>Alembic pros:</p>
<ul>
<li>may be simpler than SQLAlchemy-Migrate</li>
<li>written and recommended by Mike Bayer</li>
<li>non-linear versioning (looks nice, but do I really need it?)</li>
</ul>
<p>Alembic cons:</p>
<ul>
<li><del>no documentation (yet)</del> documentation was published within a day of writing this&#8230; Mike Bayer is amazing.</li>
<li>no SQLite ALTER support, must build own dump/import system for SQLite</li>
<li>lacks schema/model comparison tools</li>
</ul>
<p>&nbsp;</p>
<p>Takeaway: Alembic looks promising, and maybe it will be the right choice sometime in the future. The lack of documentation and no support for SQLite ALTER makes it less appealing to me at this point.</p>
<p>The schema/model comparison features look like they could be very handy if they are reliable. They are currently experimental (and need a patch) in SQLAlchemy-Migrate, but non-existent in Alembic.</p>
]]></content:encoded>
			<wfw:commentRss>http://pieces.openpolitics.com/2011/11/sqlalchemy-migrate-vs-alembic/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Post Log</title>
		<link>http://pieces.openpolitics.com/2010/11/post-log/</link>
		<comments>http://pieces.openpolitics.com/2010/11/post-log/#comments</comments>
		<pubDate>Sat, 13 Nov 2010 16:43:38 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Link]]></category>
		<category><![CDATA[Other]]></category>
		<category><![CDATA[Python]]></category>
		<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://pieces.openpolitics.com/?p=127</guid>
		<description><![CDATA[Improved shortcut for Django&#8217;s render_to_response Comments on Time Machine backups after moving /Users to a different volume. stackoverflow A memoize decorator for instance methods Authenticated encryption with PyCrypto pypopper &#8211; Python POP3 Server]]></description>
			<content:encoded><![CDATA[<ul>
<li><a href="http://stackoverflow.com/questions/1215801/django-why-is-requestcontext-set-as-context-instance/4401027#4401027">Improved shortcut for Django&#8217;s render_to_response</a></li>
<li><a href="http://lnx2mac.blogspot.com/2010/09/moving-os-x-users-to-separate-partition.html#c5805127800600520134">Comments on Time Machine backups</a> after moving /Users to a different volume.</li>
<li><a href="http://stackoverflow.com/users/10840/daniel">stackoverflow</a></li>
<li><a href="http://code.activestate.com/recipes/577452-a-memoize-decorator-for-instance-methods/">A memoize decorator for instance methods</a></li>
<li><a href="http://code.activestate.com/recipes/576980-authenticated-encryption-with-pycrypto/">Authenticated encryption with PyCrypto</a></li>
<li><a href="http://code.activestate.com/recipes/534131-pypopper-python-pop3-server/">pypopper &#8211; Python POP3 Server</a></li>
</ul>
]]></content:encoded>
			<wfw:commentRss>http://pieces.openpolitics.com/2010/11/post-log/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Verbose is not Explicit</title>
		<link>http://pieces.openpolitics.com/2005/12/verbose-is-not-explicit/</link>
		<comments>http://pieces.openpolitics.com/2005/12/verbose-is-not-explicit/#comments</comments>
		<pubDate>Fri, 30 Dec 2005 01:48:08 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://pieces.openpolitics.com/2005/12/verbose-is-not-explicit/</guid>
		<description><![CDATA[This is a response to Verbosity published at lesscode.org From my big fat &#8220;compact&#8221; Random House dictionary: verbosity: the state or quality of being verbose; superfluity of words, wordiness Syn: &#8230;redundancy, turgidity and verbose: characterized by the use of many or too many words; wordy Syn: &#8230;tedious, inflated, turgid&#8230; In fact, my dictionary is verbose, [...]]]></description>
			<content:encoded><![CDATA[<p>This is a response to <a href="http://lesscode.org/2005/12/28/verbosity/">Verbosity</a> published at <a href="http://lesscode.org/">lesscode.org</a></p>
<p>From my big fat &#8220;compact&#8221; Random House dictionary:</p>
<blockquote><div class="q1">
<div class="q2">
<div class="q3">
<b>verbosity:</b> the state or quality of being verbose; superfluity of words, wordiness<br />
Syn: &#8230;redundancy, turgidity
</div>
</div>
</div>
</blockquote>
<p>and</p>
<blockquote><div class="q1">
<div class="q2">
<div class="q3">
<b>verbose:</b> characterized by the use of many or too many words; wordy<br />
Syn: &#8230;tedious, inflated, turgid&#8230;
</div>
</div>
</div>
</blockquote>
<p>In fact, my dictionary is verbose, and come to think of it, programmers (and lawyers) tend to be verbose as well. We need to qualify every statement (as if you didn&#8217;t already know it), to make sure everyone gets our point exactly as we intended it to be interpreted, so there is zero ambiguity. This tendency toward verbosity can have the effect of causing our readers to fall asleep&#8230; WAKE UP! I&#8217;m not finished <img src='http://pieces.openpolitics.com/wp-includes/images/smilies/icon_smile.gif' alt=':)' class='wp-smiley' /> </p>
<p>Some programming languages are more verbose than others. As <a href="http://matt-good.net/">Matt Good</a> <a href="http://lesscode.org/2005/12/28/verbosity/#comment-873">pointed out</a>, Java is more verbose than Python. That type of verbosity is a bad thing for readability. It&#8217;s redundant, tedious, inflated. It causes me to go to sleep. It slows me down. It&#8217;s tiring.</p>
<p>The confusion is between verbosity and explicitness. Again from Random House:</p>
<blockquote><div class="q1">
<div class="q2">
<div class="q3">
<b>explicit:</b> fully and clearly expressed or demonstrated; leaving nothing merely implied&#8230;<br />
Syn: express, definite, precise, exact, unambiguous&#8230;
</div>
</div>
</div>
</blockquote>
<p>Explicitness is when I come right out and say it, rather than doing it with black magic behind the scenes. Verbosity, on the other hand, is extra, unneeded, superfluous verbiage&#8211;more than is required. As programmers, we should be striving to DO NO MORE THAN IS REQUIRED. Verbosity is bad, explicitness is good.</p>
<p>Alex quoted &#8220;the other fellow&#8221; as saying (emphasis added):</p>
<blockquote><div class="q1">
<div class="q2">
<div class="q3">
And <b>verbosity makes code easier to read</b>. I donít have to know anything to understand the code. Everything I need to know is there in front of me.
</div>
</div>
</div>
</blockquote>
<p>That&#8217;s just plain wrong. Especially if he <i>meant</i> to say &#8220;verbosity&#8221;, but I think he was confused and <i>actually</i> meant to say &#8220;explicitness&#8221;. Verbosity does not guarantee that &#8220;everything I need to know is right there&#8221;. Instead, it usually means that there is more there than I need, which makes it harder to find what I want. Explicitness, by definition, means that everything is there: &#8220;leaving nothing merely implied&#8221;.</p>
]]></content:encoded>
			<wfw:commentRss>http://pieces.openpolitics.com/2005/12/verbose-is-not-explicit/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
		<item>
		<title>Mythical RDBMS Features</title>
		<link>http://pieces.openpolitics.com/2005/11/mythical-rdbms-features/</link>
		<comments>http://pieces.openpolitics.com/2005/11/mythical-rdbms-features/#comments</comments>
		<pubDate>Wed, 02 Nov 2005 04:40:51 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://pieces.openpolitics.com/2005/11/mythical-rdbms-features/</guid>
		<description><![CDATA[Alex Bunardzic wrote an article on database integrity in which he completely dismissed commonly accepted methods of using an RDBMS to enforce data integrity. I strongly disagree with his conclusions. In fact, I think his arguments are terrible. The argument against surrogate keys (for example) is based on a naive and misguided understanding of how [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://jooto.com/blog/index.php/2005/11/01/the-myth-of-data-integrity/">Alex Bunardzic</a> wrote an article on database integrity in which he completely dismissed commonly accepted methods of using an RDBMS to enforce data integrity. I strongly disagree with his conclusions. In fact, I think his arguments are terrible.</p>
<p>The argument against surrogate keys (for example) is based on a naive and misguided understanding of how surrogate keys and unique constraints should be used to enforce data integrity. In the worst case, a surrogate key by itself allows multiple rows to contain the same data (duplication). However, these duplicate records can be merged into a single record if necessary, thus providing a feasible cleanup route. The implied alternative (data integrity enforced by other application layers) only leads to worse problems&#8211;at best reinvention of the wheel.</p>
<p>The database is the last line of defense against data corruption. Well written applications will handle integrity violations in a graceful way that shields the user from nasty database exceptions. However, even if the application framework/code (i.e. Rails) doesn&#8217;t catch it, at least most major data integrity errors will be caught if database constraints are used.</p>
<p>However, I do agree that many RDBMS engines today (Postgres, MySQL, MSSQL) are not good enough to justify storing large amounts of code in them. I have some serious issues with code stored in the database (i.e. stored procedures and functions). The following list of those issues with implied feature ideas for a better RDBMS:</p>
<ul>
<li><b>Lack of expressiveness</b> I hate T-SQL! (aside: Postgres does allow the use of Python to write functions, although I haven&#8217;t tried it)</li>
<li><b>Lack of version control</b> There&#8217;s no way to know if an entity has been modified, and no way to roll back if it gets messed up</li>
<li><b>Lack of good editors</b> Sure anyone can copy the code into his favorite editor and then copy it back when finished, but then there&#8217;s the whole problem of maintaining a local copy in case the system crashes while editing. I&#8217;d like to be able to check out a local copy, make my changes (clicking the &#8220;Save&#8221; button as often as I want) with whatever editor I choose, and then commit them back&#8211;this ties into the previous version control issue.</li>
</ul>
<p>These issues have caused me to adopt a hybrid approach to using the database to enforce constraints. I maintain my DDL in a file in version control&#8211;adding referential integrity and unique constraints as needed (after all, that&#8217;s what an RDBMS is made for). I tend to use surrogate keys in most cases because ORM frameworks (Hibernate and SQLObject) like and/or require them in most cases. When updates are needed on a live database (where the DDL cannot be applied directly), I write update scripts and commit them to version control as well. Finally, I avoid stored procedures and functions except where necessary for security or performance optimizations. This minimizes the number of times that the database needs to be updated, and consequently provides a simpler upgrade path when releasing new versions.</p>
]]></content:encoded>
			<wfw:commentRss>http://pieces.openpolitics.com/2005/11/mythical-rdbms-features/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Design tradeoff: Tier Pressure and Isolationism</title>
		<link>http://pieces.openpolitics.com/2005/07/design-tradeoff-tier-pressure-and-isolationism/</link>
		<comments>http://pieces.openpolitics.com/2005/07/design-tradeoff-tier-pressure-and-isolationism/#comments</comments>
		<pubDate>Mon, 18 Jul 2005 14:17:50 +0000</pubDate>
		<dc:creator>daniel</dc:creator>
				<category><![CDATA[Software Development]]></category>

		<guid isPermaLink="false">http://pieces.openpolitics.com/2005/07/design-tradeoff-tier-pressure-and-isolationism/</guid>
		<description><![CDATA[This article from The Code Project describes a maintainability tradeoff that is realized when any logical layer in a multi-tier application is allowed to access any other layer. In my experience, this tradeoff is often justified by ease of implementation and getting the job done as quickly as possible. The hidden cost of the decision [...]]]></description>
			<content:encoded><![CDATA[<p><a href="http://www.codeproject.com/gen/design/TierPressure.asp">This article</a> from <a href="http://www.codeproject.com/">The Code Project</a> describes a maintainability tradeoff that is realized when any logical layer in a multi-tier application is allowed to access any other layer. In my experience, this tradeoff is often justified by ease of implementation and getting the job done as quickly as possible. The hidden cost of the decision is deferred until the application must be extended. If the extension is large or complex enough it is often easier to rewrite a large section of- or the entire application at that future time. And of course that, in the <a href="http://www.joelonsoftware.com/articles/fog0000000069.html">words</a> of <a href="http://www.joelonsoftware.com/">Joel</a>, is &#8220;the single worst strategic mistake that any software company can make.&#8221;</p>
]]></content:encoded>
			<wfw:commentRss>http://pieces.openpolitics.com/2005/07/design-tradeoff-tier-pressure-and-isolationism/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>

