<?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>The Joy of Hack &#187; Editors</title>
	<atom:link href="http://www.aijazansari.com/tag/editors/feed/" rel="self" type="application/rss+xml" />
	<link>http://www.aijazansari.com</link>
	<description>For people who like to make things</description>
	<lastBuildDate>Tue, 20 Jul 2010 13:20:08 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	
		<item>
		<title>Sometimes Text Files Are Better Than Databases</title>
		<link>http://www.aijazansari.com/2010/03/08/sometimes-text-files-are-better-than-databases/</link>
		<comments>http://www.aijazansari.com/2010/03/08/sometimes-text-files-are-better-than-databases/#comments</comments>
		<pubDate>Tue, 09 Mar 2010 03:08:33 +0000</pubDate>
		<dc:creator>Aijaz Ansari</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Data]]></category>
		<category><![CDATA[Database]]></category>
		<category><![CDATA[Diff]]></category>
		<category><![CDATA[Editors]]></category>
		<category><![CDATA[Grep]]></category>
		<category><![CDATA[GUI]]></category>
		<category><![CDATA[Persistence]]></category>
		<category><![CDATA[Programming]]></category>
		<category><![CDATA[RDBMS]]></category>
		<category><![CDATA[Representation]]></category>
		<category><![CDATA[SSH]]></category>
		<category><![CDATA[TaskForest]]></category>
		<category><![CDATA[Text]]></category>

		<guid isPermaLink="false">http://www.aijazansari.com/?p=499</guid>
		<description><![CDATA[There are many classes of applications for which text files are the preferred means of storing data.  One of the main reasons is that when data is stored in a relational database, editing it is not a trivial task.  A well-normalized database is not easily updated via an SQL command line.  More often than not, a dedicated, graphical editor is needed to model the complex relationships.    ]]></description>
			<content:encoded><![CDATA[<p><a rel="attachment wp-att-504" href="http://www.aijazansari.com/2010/03/08/sometimes-text-files-are-better-than-databases/file/"><img class="alignleft size-full wp-image-504" title="A File" src="http://www.aijazansari.com/wp-content/uploads/2010/03/File.png" alt="A File" width="108" height="136" /></a>I remember in my first Computer Programming class in college, the instructors wanted to make sure we understood the concept of persistence by saving application data to disk.  To keep things simple we would serialize data and save it to text files.  Once we learned advanced concepts we migrated to using relational databases.  As a professional, most of the apps I see use an RDBMS like DB2, PostgreSQL, Sybase or Oracle.  Text files have been relegated to the simple homework assignments of Programming 101.</p>
<p>There are, however, many classes of applications for which text files are the preferred means of storing data.  One of the main reasons is that <strong>when data is stored in a relational database, editing it is not a trivial task</strong>.  A well-normalized database is not easily updated via an SQL command line.  More often than not, a dedicated, graphical editor is needed to model the complex relationships.</p>
<p>Several years ago, when I wrote <a href="http://www.taskforest.com/">TaskForest</a>, one of the initial design requirements was that it be easily configurable with just a shell prompt and one&#8217;s favorite text editor. Many of the servers I cared for for schools and non-profits were old boxes which I administered by logging into them via ssh. So when it came to designing job definitions and dependencies, I chose a text file representation. The benefits of text files over a graphical user interface for this include:</p>
<dl>
<dt>Easy Remote Access</dt>
<dd>All you need is the ability to get to a command line and a text editor on the machine that holds the data files. With the such low client access requirements, virtually any old machine that has internet access and an ssh client can be used to administer the system. I have often worked on my own taskforestd server from a local internet cafe using a Putty.exe downloaded minutes earlier.</dd>
<dt>Mobile Access</dt>
<dd>Text files also make work relatively easy using a mobile ssh client like Idokorro Mobile SSH. A dedicated mobile client would be ideal, but short of that, the text file approach assures low bandwidth usage and easy-to-make changes.</dd>
<dt>Flexibility</dt>
<dd>The simple, easily parseable format of text files allows us to build richer graphical clients later that would use a graphical interface to specify relationships between jobs.</dd>
<dt>Source Control</dt>
<dd> The text based format makes it easy to place the data files under source control. You can also easily <em>diff</em> different versions of the same data file.</dd>
<dt><em>Grep</em></dt>
<dd> When you have dozens of job group files and hundreds of jobs, you may need to answer questions like: &#8220;Are we still running Job J?&#8221; This can easily be answered by <em>grep</em>ping the files for job J.</dd>
<dt>Low footprint</dt>
<dd>When you&#8217;re designing an open-source application you may want to minimize the complexity of the system by not forcing dependencies on major subsystems like GUI libraries and Relational Databases.  Of course there is a point at which a such dependencies are inevitable &#8211; you have to periodically re-evaluate your decisions and determine whether decisions that were correct, say, a year ago are still correct today.</dd>
</dl>
<h2>Choosing A Text Format</h2>
<p>In the case of the TaskForest project, the most difficult task by far was choosing which text format to use.  I went through several iterations trying to find one that was simple to read and write, and yet rich enough to model the domain space completely.  What worked for me (and might work for you) was to ask myself how I would represent the data I&#8217;m trying to save given just a pencil and paper.  Drawing in a notebook gave me the flexibility to sketch and edit easily, and once I had a good representation, converting that to a text file was a simple task.</p>
]]></content:encoded>
			<wfw:commentRss>http://www.aijazansari.com/2010/03/08/sometimes-text-files-are-better-than-databases/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
		<item>
		<title>Why Text Editors Matter</title>
		<link>http://www.aijazansari.com/2010/01/26/why-text-editors-matter/</link>
		<comments>http://www.aijazansari.com/2010/01/26/why-text-editors-matter/#comments</comments>
		<pubDate>Wed, 27 Jan 2010 04:46:17 +0000</pubDate>
		<dc:creator>Aijaz Ansari</dc:creator>
				<category><![CDATA[Computers]]></category>
		<category><![CDATA[Editors]]></category>
		<category><![CDATA[Efficiency]]></category>
		<category><![CDATA[Emacs]]></category>
		<category><![CDATA[Productivity]]></category>
		<category><![CDATA[VI]]></category>

		<guid isPermaLink="false">http://www.aijazansari.com/?p=186</guid>
		<description><![CDATA[A good editor is a very flexible tool.  Once you become an expert at it, you can use it to accomplish tasks almost as quickly as you can think of them.]]></description>
			<content:encoded><![CDATA[<p>As of this past weekend it&#8217;s been fifteen years since I started my career as a software developer.  With the exception of a few months here and there, I&#8217;ve spent all these years working on Linux or Unix-like operating systems.  I&#8217;ve noticed that despite the wide variety of tools and applications I have used and continue to use, some key skills are always in demand in this field. One of these is mastery of a text editor.<span id="more-186"></span></p>
<div id="attachment_195" class="wp-caption alignleft" style="width: 230px"><a rel="attachment wp-att-195" href="http://www.aijazansari.com/2010/01/26/why-text-editors-matter/editor/"><img class=" wp-image-195 " title="Emacs Screenshot" src="http://www.aijazansari.com/wp-content/uploads/2010/01/editor.jpg" alt="Emacs Screenshot" width="220" height="258" /></a><p class="wp-caption-text">The emacs editor</p></div>
<p>In their book &#8220;<a href="http://www.pragprog.com/the-pragmatic-programmer">The Pragmatic Programmer</a>,&#8221; Andrew Hunt and David Thomas stress to &#8220;Use a single editor well. The editor should be an extension of your hand; make sure your editor is configurable, extensible, and programmable.&#8221;  I couldn&#8217;t agree with this more.  A good editor is a very flexible tool.  Once you become an expert at it, you can use it to accomplish tasks almost as quickly as you can think of them.  You need to process a file as a one-off?  You could write a perl or python script, or an awk/sed one-liner, but often you could also do it in an editor &#8211; with the benefit of &#8216;Undo.&#8217;</p>
<p>A good editor is configurable, so that you can use it the way that works best for you.  Most editors have more than one way to do things, and there is no right way, just the way that works for you and helps you reach your goal quickly and efficiently. A good editor is extensible, so that it can grow along with your needs.  You need syntax highlighting for the new programming language that was invented after your editor?  You should be able to go online and download an extension module &#8211; or write one yourself.  A good editor is programmable.  Your job requires you to document functions and change histories a certain way &#8211; your editor should allow you to change its behavior, so that you don&#8217;t have to repeat the same kinds of tasks over and over again.</p>
<p>One of the best ways to learn what you can do with editors is to watch others.  Do you have a coworker whose fingers fly across the keyboard while she bends text files to her will? It may not be just that she&#8217;s a fast typist &#8211; she&#8217;s probably really comfortable using her editor.  Search for these people, ask for advice and take notes.  Try different options out, pick an editor, and invest the time to learn it well. You&#8217;ll be doing your career a favor.</p>
<p>There is no real correct answer to the question &#8220;Which editor is best?&#8221;  But there is one absolute: If you work on a Linux or Unix system, you <strong>must</strong> know how to use the <code>vi</code> editor.  This is because every Linux or Unix system has at least that one editor installed.  Depending on your line of work, it may not be unusual to find yourself on a machine that has <em>only</em> that editor installed.  I started off using <code>vi</code> in college and took the time to learn it well.  Years later I found myself in a short lull while switching from the IS41 to the VLR products at Motorola.  I took advantage of the downtime by teaching myself <code>emacs</code> and have been primarily an <code>emacs</code> user for since then (about 11 years now).  While I prefer <code>emacs</code>, I still use <code>vi</code> every so often, and consider myself fortunate because I know both.</p>
<p>There are many other editors out there and a lot of them would probably meet Hunt&#8217;s and Thomas&#8217;s criteria, but I would like to add one more to their list:  A good editor must be usable without a windowing system.  I have also played the role of system administrator, and none of my hosted machines ever had a windowing system installed.  This means I could not run eclipse or even jedit.  The only editors I could install and use were ones that would work in a text window (an xterm).  So it was either <code>vi</code> or <code>emacs</code>.</p>
<p>Pick a good editor, one that meets the criteria listed above, and learn it well.  Spend the time to become an expert. The time you invest will be paid back in increased productivity, power and flexibility.</p>
<div class="wp-caption alignnone" style="width: 630px"><img class="  size-full" title="Real Programmers - xkcd" src="http://imgs.xkcd.com/comics/real_programmers.png" alt="Real Programmers - xkcd" width="620" height="349" /><p class="wp-caption-text">Real Programmers - from http://xkcd.com/378</p></div>
]]></content:encoded>
			<wfw:commentRss>http://www.aijazansari.com/2010/01/26/why-text-editors-matter/feed/</wfw:commentRss>
		<slash:comments>0</slash:comments>
		</item>
	</channel>
</rss>
