<?xml version="1.0" encoding="utf-8"?>
<feed xmlns="http://www.w3.org/2005/Atom">
  <title>programming</title>
  <link rel="alternate" type="text/html" href="http://www.nekomancer.net/taxonomy/term/7"/>
  <link rel="self" type="application/atom+xml" href="http://www.nekomancer.net/taxonomy/term/7/atom/feed"/>
  <id>http://www.nekomancer.net/taxonomy/term/7/atom/feed</id>
  <updated>2008-03-28T19:36:04-05:00</updated>
  <entry>
    <title>What i don&#039;t like about Arc</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/2008/05/15/arc-problem" />
    <id>http://www.nekomancer.net/blog/2008/05/15/arc-problem</id>
    <published>2008-05-15T06:19:53-05:00</published>
    <updated>2008-05-15T06:33:56-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="lisp" />
    <category term="programming" />
    <summary type="html"><![CDATA[<p>Today i have found an article about <a href="http://en.wikipedia.org/wiki/Arc_(programming_language)">Arc</a> on <a href="http://reddit.com/r/programming/info/6jgnp/comments/">programming.reddit.com</a>. While reading the article, i remembered the thing that i do not like about Arc.  People often talk about problems like fragmenting the lisp-users even more, or about using lisp1 or lisp2, or hygienic macros etc. My issue is different:</p>

<p><em>Arc does not behave like an open-source project</em></p>

<p>that&#8217;s it. for example:</p>

<ul>
<li>what (open-source or free-software) license does the code use?</li>
<li>where is the version-controlled repository for the project?</li>
<li>where is the bug-tracker?</li>
</ul>

<p>The answer to all this is probably that the project is too young, and all this is still in flux, and it will be clarified when the language becomes more &#8216;final&#8217;. I think it should be the opposite way. Paul Graham should have specified the license from the start. They should also open up the version-control-system they use to develop Arc, and if they don&#8217;t use one, they should.</p>

<p>If i got something wrong, please tell me. I&#8217;d love to be corrected on these.</p>

<p>p.s: if you&#8217;d like to try out a lisp that&#8217;s usable currently, there are a lot of them. here are some to start with: <a href="http://en.wikipedia.org/wiki/Mzscheme">mzScheme</a> from the scheme family and <a href="http://en.wikipedia.org/wiki/SBCL">SBCL</a> from the common-lisp family. Or, if you would prefer to try out something different, something new, try <a href="http://en.wikipedia.org/wiki/Clojure">Clojure</a>. It runs on the <a href="http://en.wikipedia.org/wiki/Jvm">JVM</a>, so you also have access to all java libraries.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>Today i have found an article about <a href="http://en.wikipedia.org/wiki/Arc_(programming_language)">Arc</a> on <a href="http://reddit.com/r/programming/info/6jgnp/comments/">programming.reddit.com</a>. While reading the article, i remembered the thing that i do not like about Arc.  People often talk about problems like fragmenting the lisp-users even more, or about using lisp1 or lisp2, or hygienic macros etc. My issue is different:</p>

<p><em>Arc does not behave like an open-source project</em></p>

<p>that&#8217;s it. for example:</p>

<ul>
<li>what (open-source or free-software) license does the code use?</li>
<li>where is the version-controlled repository for the project?</li>
<li>where is the bug-tracker?</li>
</ul>

<p>The answer to all this is probably that the project is too young, and all this is still in flux, and it will be clarified when the language becomes more &#8216;final&#8217;. I think it should be the opposite way. Paul Graham should have specified the license from the start. They should also open up the version-control-system they use to develop Arc, and if they don&#8217;t use one, they should.</p>

<p>If i got something wrong, please tell me. I&#8217;d love to be corrected on these.</p>

<p>p.s: if you&#8217;d like to try out a lisp that&#8217;s usable currently, there are a lot of them. here are some to start with: <a href="http://en.wikipedia.org/wiki/Mzscheme">mzScheme</a> from the scheme family and <a href="http://en.wikipedia.org/wiki/SBCL">SBCL</a> from the common-lisp family. Or, if you would prefer to try out something different, something new, try <a href="http://en.wikipedia.org/wiki/Clojure">Clojure</a>. It runs on the <a href="http://en.wikipedia.org/wiki/Jvm">JVM</a>, so you also have access to all java libraries.</p>
    ]]></content>
  </entry>
  <entry>
    <title>google app engine: from sql to excel</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/2008/04/13/google-appengine-sql-excel" />
    <id>http://www.nekomancer.net/blog/2008/04/13/google-appengine-sql-excel</id>
    <published>2008-04-13T15:52:12-05:00</published>
    <updated>2008-05-14T13:54:18-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="python" />
    <category term="programming" />
    <summary type="html"><![CDATA[<p>As many other people, i also got my google app account (even crateated a <a href="http://viewrequest.appspot.com">stupid test application</a>. it&#8217;s fun to try out such a radically different hosting-environment.</p>

<p>but there is an issue with it seems many do not realize:</p>

<p>the &#8220;database&#8221; backend of google-app-engine (i will call it <a href="http://en.wikipedia.org/wiki/Bigtable">BigTable</a> in the following text) is not a relational (read &#8220;SQL&#8221;) store, and it will never be. for example, it does not support SQL JOINs. but it&#8217;s worse than that. because of it&#8217;s architecture, JOINS will never be fast there. BigTable is essentially a collection of spreadsheet-tables, where you can do some basic searches, that&#8217;s all. oh, and transactions.</p>

<p>for this reason, there probably never will be a BigTable django-ORM wrapper. of course technically it&#8217;s possible to implement in python all the missing features, but it&#8217;s performance characteristics will not be the same as of a relational-database.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>As many other people, i also got my google app account (even crateated a <a href="http://viewrequest.appspot.com">stupid test application</a>. it&#8217;s fun to try out such a radically different hosting-environment.</p>

<p>but there is an issue with it seems many do not realize:</p>

<p>the &#8220;database&#8221; backend of google-app-engine (i will call it <a href="http://en.wikipedia.org/wiki/Bigtable">BigTable</a> in the following text) is not a relational (read &#8220;SQL&#8221;) store, and it will never be. for example, it does not support SQL JOINs. but it&#8217;s worse than that. because of it&#8217;s architecture, JOINS will never be fast there. BigTable is essentially a collection of spreadsheet-tables, where you can do some basic searches, that&#8217;s all. oh, and transactions.</p>

<p>for this reason, there probably never will be a BigTable django-ORM wrapper. of course technically it&#8217;s possible to implement in python all the missing features, but it&#8217;s performance characteristics will not be the same as of a relational-database. so you will not be able to simply take your mysql/postgresql-optimized application, and deploy on it, and all is fine. you will have to restructure your application.</p>

<p>and if you have to restructure your app anyway, why do you need the django-ORM? you can as well write google-app-engine-specific code.</p>

<p>(on the other hand, maybe there could be a more stupid django-orm, that does not assume a relational-db-backend, and it could work with the various non-relational databases like <a href="http://en.wikipedia.org/wiki/Bigtable">BigTable</a> or <a href="http://hadoop.apache.org/hbase/">hBase</a> or other <a href="http://en.wikipedia.org/wiki/Column-oriented_DBMS">column-oriented databases</a>&#8230;)</p>

<p>the basic idea when writing BigTable code is that read-operations will happen much more often than write-operations. so do more at write-time, and less at read-time. denormalize tables.</p>

<p>for example, take a simple forum-application. it stores discussions. a discussion has comments.
now let&#8217;s see how we could implement 2 basic features: &#8220;add comment&#8221; and &#8220;list discussion-names with comment-count&#8221;.</p>

<p>SQL:</p>

<ul>
<li>&#8220;add comment&#8221;: store a new comment-entry, which contains a link (a foreign-key) to it&#8217;s discussion</li>
<li>&#8220;list discussion-names with comment-count&#8221;: do an SQL query like: <span class="geshifilter"><code class="geshifilter-text">SELECT discussion.name,count(1) from discussion LEFT OUTER JOIN comment GROUP BY comment.discussion_id;</code></span> (let&#8217;s not discuss right now if it&#8217;s inner or outer join etc. it&#8217;s quite late at night here, so maybe it&#8217;s not 100% correct. but it should be enough to demonstrate the situation)</li>
</ul>

<p>BigTable (one possible solution):</p>

<ul>
<li>&#8220;add comment&#8221;: store a new comment entry, which contains a link to it&#8217;s discussion. also, count the number of comments for this discussion, and store this value in the discussion-table</li>
<li>&#8220;list discussion-names with comment-count&#8221;: <span class="geshifilter"><code class="geshifilter-text">select * from discussion</code></span></li>
</ul>

<p>of course the whole denormalize-your-database-if-you-want-performance mantra is nothing new. if i remember correctly, Flickr also does this. but still, for most developers, (also for me), it&#8217;s just painful to give up our nice, clean, normalized db-tables.</p>

<p>p.s: please note, that all the info is not based on my own performance-benchmarks. it&#8217;s more a summary of what i&#8217;ve read in the the google-appengine documentation and the <a href="http://groups.google.com/group/google-appengine">google-appengine mailing list</a>.</p>
    ]]></content>
  </entry>
  <entry>
    <title>python web-application using generators</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/archives/python-web-app-using-generators" />
    <id>http://www.nekomancer.net/blog/archives/python-web-app-using-generators</id>
    <published>2008-03-01T17:16:16-06:00</published>
    <updated>2008-06-27T03:41:12-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="python" />
    <category term="programming" />
    <summary type="html"><![CDATA[<p>Probably many of you have heard already about <a href="http://www.seaside.st/">Seaside</a>. It&#8217;s a smalltalk web framework, where you can write a web-app in a linear style:</p>

<p>let&#8217;s say you want to create a web-app which:</p>

<ul>
<li>shows a form to the user, where he can enter a number and submit it</li>
<li>then you show him a second form, where the user can enter a second number and submit it</li>
<li>then you show the user a page which displays the sum of those 2 submitted numbers</li>
</ul>
    ]]></summary>
    <content type="html"><![CDATA[<p>Probably many of you have heard already about <a href="http://www.seaside.st/">Seaside</a>. It&#8217;s a smalltalk web framework, where you can write a web-app in a linear style:</p>

<p>let&#8217;s say you want to create a web-app which:</p>

<ul>
<li>shows a form to the user, where he can enter a number and submit it</li>
<li>then you show him a second form, where the user can enter a second number and submit it</li>
<li>then you show the user a page which displays the sum of those 2 submitted numbers
<!--break-->
in Seaside, you can implement it in something like this:
(pseudocode)</li>
</ul>

<div class="geshifilter"><pre class="geshifilter-python">first_num = get_number<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
second_num = get_number<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
display<span style="color: black;">&#40;</span>first_num + second_num<span style="color: black;">&#41;</span></pre></div>

<p>my language of choice is python, so i was curious if it&#8217;s possible to achieve something similar in that language. seside uses <a href="http://en.wikipedia.org/wiki/Continuation">continuations</a> to achieve this, so i turned to <a href="http://docs.python.org/ref/yield.html">python generators</a>. they allowed me to write this:</p>

<div class="geshifilter"><pre class="geshifilter-python"><span style="color: #ff7700;font-weight:bold;">def</span> sum_two_numbers<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    first_num = <span style="color: #ff7700;font-weight:bold;">yield</span> InputPage<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;enter first number:&quot;</span><span style="color: black;">&#41;</span>
    second_num = <span style="color: #ff7700;font-weight:bold;">yield</span> InputPage<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;enter second number:&quot;</span><span style="color: black;">&#41;</span>
    <span style="color: #008000;">sum</span> = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>first_num<span style="color: black;">&#41;</span> + <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>second_num<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">yield</span> TextPage<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;the sum isresult is: %s&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: #008000;">sum</span><span style="color: black;">&#41;</span></pre></div>

<p>the full code is below, but first some notes about it:</p>

<ul>
<li>it requires python 2.5 or higher, because i use the <a href="http://docs.python.org/whatsnew/pep-342.html">&#8220;advanced&#8221; version of yield</a>, which appeared in python2.5</li>
<li>this is only proof-of-concept code, and i know that it uses global-variables, ugly names, get-where-it-should-do-post etc.</li>
<li>i know Seaside does much much more (backbutton-support etc.)</li>
</ul>

<p>the code:</p>

<div class="geshifilter"><pre class="geshifilter-python"><span style="color: #808080; font-style: italic;">#!/usr/bin/env python2.5</span>
<span style="color: #ff7700;font-weight:bold;">from</span> wsgiref.<span style="color: black;">simple_server</span> <span style="color: #ff7700;font-weight:bold;">import</span> make_server
<span style="color: #ff7700;font-weight:bold;">from</span> <span style="color: #dc143c;">cgi</span> <span style="color: #ff7700;font-weight:bold;">import</span> parse_qs
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> TextPage<span style="color: black;">&#40;</span><span style="color: #008000;">object</span><span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">def</span> <span style="color: #0000cd;">__init__</span><span style="color: black;">&#40;</span><span style="color: #008000;">self</span>,text<span style="color: black;">&#41;</span>:
        <span style="color: #008000;">self</span>.<span style="color: black;">text</span> = text
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> get_response_content<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #483d8b;">'&lt;html&gt;&lt;body&gt;%s&lt;/body&gt;&lt;/html&gt;'</span> <span style="color: #66cc66;">%</span> <span style="color: #008000;">self</span>.<span style="color: black;">text</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> get_request_data<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>,environ<span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #008000;">None</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">class</span> InputPage<span style="color: black;">&#40;</span>TextPage<span style="color: black;">&#41;</span>:
    <span style="color: #ff7700;font-weight:bold;">def</span> get_response_content<span style="color: black;">&#40;</span><span style="color: #008000;">self</span><span style="color: black;">&#41;</span>:
        <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: #483d8b;">&quot;&quot;</span><span style="color: #483d8b;">&quot;&lt;html&gt;&lt;body&gt;%s
            &lt;form method=&quot;</span>get<span style="color: #483d8b;">&quot; action=&quot;</span>.<span style="color: #483d8b;">&quot;&gt;
            &lt;input type=&quot;</span>text<span style="color: #483d8b;">&quot; name=&quot;</span>data<span style="color: #483d8b;">&quot; value=&quot;</span><span style="color: #483d8b;">&quot;/&gt;
            &lt;/form&gt;
            &lt;/body&gt;&lt;/html&gt;&quot;</span><span style="color: #483d8b;">&quot;&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: #008000;">self</span>.<span style="color: black;">text</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">def</span> get_request_data<span style="color: black;">&#40;</span><span style="color: #008000;">self</span>, environ<span style="color: black;">&#41;</span>:
        get_req_dict = parse_qs<span style="color: black;">&#40;</span>environ<span style="color: black;">&#91;</span><span style="color: #483d8b;">'QUERY_STRING'</span><span style="color: black;">&#93;</span><span style="color: black;">&#41;</span>
        <span style="color: #ff7700;font-weight:bold;">return</span> get_req_dict<span style="color: black;">&#91;</span><span style="color: #483d8b;">'data'</span><span style="color: black;">&#93;</span><span style="color: black;">&#91;</span><span style="color: #ff4500;">0</span><span style="color: black;">&#93;</span>
&nbsp;
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> sum_two_numbers<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>:
    first_num = <span style="color: #ff7700;font-weight:bold;">yield</span> InputPage<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;enter first number:&quot;</span><span style="color: black;">&#41;</span>
    second_num = <span style="color: #ff7700;font-weight:bold;">yield</span> InputPage<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;enter second number:&quot;</span><span style="color: black;">&#41;</span>
    <span style="color: #008000;">sum</span> = <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>first_num<span style="color: black;">&#41;</span> + <span style="color: #008000;">int</span><span style="color: black;">&#40;</span>second_num<span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">yield</span> TextPage<span style="color: black;">&#40;</span><span style="color: #483d8b;">&quot;the sum isresult is: %s&quot;</span> <span style="color: #66cc66;">%</span> <span style="color: #008000;">sum</span><span style="color: black;">&#41;</span>
&nbsp;
s = sum_two_numbers<span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
cur_item = <span style="color: #008000;">None</span>
&nbsp;
<span style="color: #ff7700;font-weight:bold;">def</span> simple_app<span style="color: black;">&#40;</span>environ, start_response<span style="color: black;">&#41;</span>:
    status = <span style="color: #483d8b;">'200 OK'</span>
    response_headers = <span style="color: black;">&#91;</span><span style="color: black;">&#40;</span><span style="color: #483d8b;">'Content-type'</span>,<span style="color: #483d8b;">'text/html'</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
    start_response<span style="color: black;">&#40;</span>status, response_headers<span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">global</span> cur_item
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">if</span> <span style="color: #ff7700;font-weight:bold;">not</span> cur_item:
        cur_item = s.<span style="color: black;">next</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span>
    <span style="color: #ff7700;font-weight:bold;">else</span>:
        cur_item = s.<span style="color: black;">send</span><span style="color: black;">&#40;</span>cur_item.<span style="color: black;">get_request_data</span><span style="color: black;">&#40;</span>environ<span style="color: black;">&#41;</span><span style="color: black;">&#41;</span>
&nbsp;
    <span style="color: #ff7700;font-weight:bold;">return</span> <span style="color: black;">&#91;</span>cur_item.<span style="color: black;">get_response_content</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span><span style="color: black;">&#93;</span>
&nbsp;
&nbsp;
httpd = make_server<span style="color: black;">&#40;</span><span style="color: #483d8b;">''</span>, <span style="color: #ff4500;">8000</span>, simple_app<span style="color: black;">&#41;</span>
httpd.<span style="color: black;">serve_forever</span><span style="color: black;">&#40;</span><span style="color: black;">&#41;</span></pre></div>

<p>i did a quick google-check about this topic (&#8220;python web framework continuations&#8221;), and only found <a href="http://twistedmatrix.com/pipermail/twisted-web/2004-November/000863.html">Nevow with Wolf</a>, which uses a less-elegant approach, probably because when it was implemented, python2.5 was not yet available. if anyone knows about other python web-frameworks that use generators, leave me a comment.</p>
    ]]></content>
  </entry>
  <entry>
    <title>scm in programming language development</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/archives/scm-in-prog-lang-devel" />
    <id>http://www.nekomancer.net/blog/archives/scm-in-prog-lang-devel</id>
    <published>2008-02-24T15:38:50-06:00</published>
    <updated>2008-03-28T18:46:28-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="scm" />
    <category term="programming" />
    <summary type="html"><![CDATA[<p>i did a quick check about what source-code-management systems are used by the programming languages that i find important/interesting,
and here is what i found:</p>

<table class="simpleblog">
<tr><td><a href="http://www.python.org/dev/faq/#subversion-svn">python</a></td><td>subversion</td></tr>
<tr><td><a href="http://www.ruby-lang.org/en/community/ruby-core/#following-ruby">ruby</a></td><td>subversion</td></tr>
<tr><td><a href="http://gcc.gnu.org/svn.html">gcc</a></td><td>subversion</td></tr>
<tr><td><a href="http://sourceforge.net/cvs/?group_id=1373">sbcl (lisp)</a></td><td>cvs</td></tr>
<tr><td><a href="http://www.factorcode.org/development.fhtml">factor</a></td><td>git</td></tr>
<tr><td><a href="http://hackage.haskell.org/trac/ghc/wiki/Building/GettingTheSources">ghc (haskell)</a></td><td>darcs</td></tr>
<tr><td><a href="http://hg.openjdk.java.net/jdk7/jdk7">openjdk (java)</a></td><td>mercurial</td></tr>
<tr><td>lua</td><td>no public repo</td></tr>
</table>
    ]]></summary>
    <content type="html"><![CDATA[<p>i did a quick check about what source-code-management systems are used by the programming languages that i find important/interesting,
and here is what i found:</p>

<table class="simpleblog">
<tr><td><a href="http://www.python.org/dev/faq/#subversion-svn">python</a></td><td>subversion</td></tr>
<tr><td><a href="http://www.ruby-lang.org/en/community/ruby-core/#following-ruby">ruby</a></td><td>subversion</td></tr>
<tr><td><a href="http://gcc.gnu.org/svn.html">gcc</a></td><td>subversion</td></tr>
<tr><td><a href="http://sourceforge.net/cvs/?group_id=1373">sbcl (lisp)</a></td><td>cvs</td></tr>
<tr><td><a href="http://www.factorcode.org/development.fhtml">factor</a></td><td>git</td></tr>
<tr><td><a href="http://hackage.haskell.org/trac/ghc/wiki/Building/GettingTheSources">ghc (haskell)</a></td><td>darcs</td></tr>
<tr><td><a href="http://hg.openjdk.java.net/jdk7/jdk7">openjdk (java)</a></td><td>mercurial</td></tr>
<tr><td>lua</td><td>no public repo</td></tr>
</table>
    ]]></content>
  </entry>
  <entry>
    <title>why i did not choose Git</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/archives/why-i-did-not-choose-git" />
    <id>http://www.nekomancer.net/blog/archives/why-i-did-not-choose-git</id>
    <published>2007-08-11T06:26:01-05:00</published>
    <updated>2008-06-23T00:11:01-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="scm" />
    <category term="programming" />
    <summary type="html"><![CDATA[<p>[EDIT (2008/06/23): (based on the first commenter&#8217;s message, it seems the issue i complained about here has been addressed in Git)</p>

<p>i am very interested in distributed version control systems, so i follow the mailing lists of several of them (<a href="http://bazaar-vcs.org/">bzr</a>, <a href="http://git.or.cz/">git</a>, <a href="http://selenic.com/mercurial">hg</a>)&#8230;</p>

<p>currently my favourite is mercurial btw&#8230;</p>

<p>but this post is not about why i chose mercurial.</p>

<p>also not about why distributed version controls are much better than centralised ones (<a href="http://subversion.tigris.org/">svn</a>, <a href="http://www.nongnu.org/cvs/">cvs</a>, etc.) (probably will write about this a post at a later point, but not now)</p>

<p>this is about why git is not suitable for me.</p>

<p>intro:</p>

<p>in short, git was created when the kernel developers needed a version control system after the <a href="http://en.wikipedia.org/wiki/Git_%28software%29#Early_history">BitKeeper problems</a>, so Linus wrote Git.</p>

<p>it&#8217;s a very powerful, and extremely fast version control system. i think, if i would have to decide purely on the features, probably Git would be the winner.</p>

<p>the problem:</p>

<p>but the problem with git is the ..hmmm.. mentality?</p>

<p>it was written (primarily) for the kernel developers originally, and somehow what&#8217;s user-friendly for them is not always user-friendly for me.</p>

<p>let&#8217;s take a recent example, which i think nicely characterizes the issue:</p>

<p>( <a href="http://article.gmane.org/gmane.comp.version-control.git/54446">the discussion on the git mailing-list</a> )</p>

<p>when you use git, anytime you can do &#8220;git diff&#8221; which shows you what changed since the last commit, and &#8220;git stat&#8221; which shows you which files changed since the last commit (this is not an exact definition, but it&#8217;s more&amp;less like that).</p>

<p>someone found out, that if he just re-saves a file in the repository without changing it (or in unix-speak: &#8220;touch myfile&#8221;),
then:</p>

<ol>
<li>&#8220;git diff&#8221; will mention the file, but show an empty diff</li>
<li>&#8220;git status&#8221; will not list the given file</li>
<li>if he does &#8220;git diff&#8221; again (after the &#8220;git status&#8221;), then it will not even mention the file</li>
</ol>

<p>so in short, &#8220;git diff&#8221; behaves differently before &#8220;git status&#8221; and after &#8220;git status&#8221;.</p>

<p>when he asked on the mailing list, he was informed that this is not a bug, because for performance reasons &#8220;git status&#8221; does some things to the repository, which cause that the touched-file does not show up at the second &#8220;git diff&#8221;.</p>

<p>when he argued that &#8220;git status&#8221; should be a read-only operation (so that doing it should not affect the behavior of the other commands), he was told that &#8220;git status&#8221; is not a read-only operation, because in reality it does some internal things in the repository, and also that if this would be read-only, then some things might become slower, etc.</p>

<p>then he argued that while it can be true, that &#8220;git status&#8221; is not read-only from the implementation point of view, it still should be read-only from the user&#8217;s point of view</p>

<p>(for example imagine a simple form of caching of anything.. when you first request some data, they are retrieved, cached and given to you, but when you request it next time, they arrive from the cache. so from the implementation point of view, the retrieval-operation is not read-only, because it writes to the cache, but from the user&#8217;s point of view it&#8217;s a read-only operation (because to the world outside of the implementation, it behaves as read-only))</p>

<p>but somehow his argument did not get through&#8230;</p>

<p>so currently i am not sure if the problem is that:</p>

<ul>
<li>the git-developers are not able to understand this distinction between being read-only from the implementation point of view and being read-only from the user&#8217;s point of view</li>
</ul>

<p>or</p>

<ul>
<li>the git-developers think that this property of &#8220;git status&#8221; is not important enough to maybe sacrifice a little performance for it</li>
</ul>

<p>but whichever is the reason, it just proves for me that git is suitable not for me.</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>[EDIT (2008/06/23): (based on the first commenter&#8217;s message, it seems the issue i complained about here has been addressed in Git)</p>

<p>i am very interested in distributed version control systems, so i follow the mailing lists of several of them (<a href="http://bazaar-vcs.org/">bzr</a>, <a href="http://git.or.cz/">git</a>, <a href="http://selenic.com/mercurial">hg</a>)&#8230;</p>

<p>currently my favourite is mercurial btw&#8230;</p>

<p>but this post is not about why i chose mercurial.</p>

<p>also not about why distributed version controls are much better than centralised ones (<a href="http://subversion.tigris.org/">svn</a>, <a href="http://www.nongnu.org/cvs/">cvs</a>, etc.) (probably will write about this a post at a later point, but not now)</p>

<p>this is about why git is not suitable for me.</p>

<p>intro:</p>

<p>in short, git was created when the kernel developers needed a version control system after the <a href="http://en.wikipedia.org/wiki/Git_%28software%29#Early_history">BitKeeper problems</a>, so Linus wrote Git.</p>

<p>it&#8217;s a very powerful, and extremely fast version control system. i think, if i would have to decide purely on the features, probably Git would be the winner.</p>

<p>the problem:</p>

<p>but the problem with git is the ..hmmm.. mentality?</p>

<p>it was written (primarily) for the kernel developers originally, and somehow what&#8217;s user-friendly for them is not always user-friendly for me.</p>

<p>let&#8217;s take a recent example, which i think nicely characterizes the issue:</p>

<p>( <a href="http://article.gmane.org/gmane.comp.version-control.git/54446">the discussion on the git mailing-list</a> )</p>

<p>when you use git, anytime you can do &#8220;git diff&#8221; which shows you what changed since the last commit, and &#8220;git stat&#8221; which shows you which files changed since the last commit (this is not an exact definition, but it&#8217;s more&amp;less like that).</p>

<p>someone found out, that if he just re-saves a file in the repository without changing it (or in unix-speak: &#8220;touch myfile&#8221;),
then:</p>

<ol>
<li>&#8220;git diff&#8221; will mention the file, but show an empty diff</li>
<li>&#8220;git status&#8221; will not list the given file</li>
<li>if he does &#8220;git diff&#8221; again (after the &#8220;git status&#8221;), then it will not even mention the file</li>
</ol>

<p>so in short, &#8220;git diff&#8221; behaves differently before &#8220;git status&#8221; and after &#8220;git status&#8221;.</p>

<p>when he asked on the mailing list, he was informed that this is not a bug, because for performance reasons &#8220;git status&#8221; does some things to the repository, which cause that the touched-file does not show up at the second &#8220;git diff&#8221;.</p>

<p>when he argued that &#8220;git status&#8221; should be a read-only operation (so that doing it should not affect the behavior of the other commands), he was told that &#8220;git status&#8221; is not a read-only operation, because in reality it does some internal things in the repository, and also that if this would be read-only, then some things might become slower, etc.</p>

<p>then he argued that while it can be true, that &#8220;git status&#8221; is not read-only from the implementation point of view, it still should be read-only from the user&#8217;s point of view</p>

<p>(for example imagine a simple form of caching of anything.. when you first request some data, they are retrieved, cached and given to you, but when you request it next time, they arrive from the cache. so from the implementation point of view, the retrieval-operation is not read-only, because it writes to the cache, but from the user&#8217;s point of view it&#8217;s a read-only operation (because to the world outside of the implementation, it behaves as read-only))</p>

<p>but somehow his argument did not get through&#8230;</p>

<p>so currently i am not sure if the problem is that:</p>

<ul>
<li>the git-developers are not able to understand this distinction between being read-only from the implementation point of view and being read-only from the user&#8217;s point of view</li>
</ul>

<p>or</p>

<ul>
<li>the git-developers think that this property of &#8220;git status&#8221; is not important enough to maybe sacrifice a little performance for it</li>
</ul>

<p>but whichever is the reason, it just proves for me that git is suitable not for me.</p>
    ]]></content>
  </entry>
  <entry>
    <title>Java/C++ generics/templates</title>
    <link rel="alternate" type="text/html" href="http://www.nekomancer.net/blog/archives/java-cpp-generics-templates" />
    <id>http://www.nekomancer.net/blog/archives/java-cpp-generics-templates</id>
    <published>2006-12-06T02:40:13-06:00</published>
    <updated>2008-03-28T19:36:04-05:00</updated>
    <author>
      <name>gabor</name>
    </author>
    <category term="java" />
    <category term="programming" />
    <summary type="html"><![CDATA[<p>I&#8217;ve read today this <a href="http://www.peerbox.com:8668/space/start/2006-12-04/1#Java_vs_C++_Performance">blog entry about java/c++ performance</a> .</p>

<p>i agree with most of his arguments, but the generics one&#8230;</p>
    ]]></summary>
    <content type="html"><![CDATA[<p>I&#8217;ve read today this <a href="http://www.peerbox.com:8668/space/start/2006-12-04/1#Java_vs_C++_Performance">blog entry about java/c++ performance</a> .</p>

<p>i agree with most of his arguments, but the generics one&#8230; well&#8230;</p>

<p>i wanted to post a comment on his blog, but it kept asking me to login when i wanted to post a comment, and i couldn&#8217;t find a way to register, so i am posting my &#8220;reply&#8221; here:</p>

<p>where he argues about java/c++ generics/templates, he says that the java ones are basically better.
while it might be true, that there are certain enhancements in the way java does templates,
we must not forget, that there are certain very useful things one can do with templates, but cannot with generics.</p>

<p>example</p>

<div class="geshifilter"><pre class="geshifilter-cpp"><span style="color: #339900;">#include &lt;iostream&gt;</span>
<span style="color: #339900;">#include &lt;string&gt;</span>
&nbsp;
<span style="color: #0000ff;">using</span> <span style="color: #0000ff;">namespace</span> std;
&nbsp;
<span style="color: #0000ff;">class</span> Clazz1
<span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
    string get_hello_message<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>;
<span style="color: #008000;">&#125;</span>;
&nbsp;
string Clazz1<span style="color: #008080;">::</span><span style="color: #00eeff;">get_hello_message</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">return</span> string<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;Clazz1.hello&quot;</span><span style="color: #008000;">&#41;</span>;
<span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp;
<span style="color: #0000ff;">class</span> Clazz2
<span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">public</span><span style="color: #008080;">:</span>
    string get_hello_message<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>;
<span style="color: #008000;">&#125;</span>;
&nbsp;
string Clazz2<span style="color: #008080;">::</span><span style="color: #00eeff;">get_hello_message</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0000ff;">return</span> string<span style="color: #008000;">&#40;</span><span style="color: #FF0000;">&quot;Clazz2.hello&quot;</span><span style="color: #008000;">&#41;</span>;
<span style="color: #008000;">&#125;</span>
&nbsp;
&nbsp;
&nbsp;
<span style="color: #0000ff;">template</span> <span style="color: #000080;">&lt;</span><span style="color: #0000ff;">class</span> T<span style="color: #000080;">&gt;</span>
T say_hello<span style="color: #008000;">&#40;</span>T obj<span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
    <span style="color: #0000dd;">cout</span> <span style="color: #000080;">&lt;</span> <span style="color: #000080;">&lt;</span> obj.<span style="color: #00eeff;">get_hello_message</span><span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span> <span style="color: #000080;">&lt;&lt;</span> endl;
<span style="color: #008000;">&#125;</span>
&nbsp;
<span style="color: #0000ff;">int</span> main<span style="color: #008000;">&#40;</span><span style="color: #008000;">&#41;</span>
<span style="color: #008000;">&#123;</span>
Clazz1 c1;
Clazz2 c2;
say_hello<span style="color: #008000;">&#40;</span>c1<span style="color: #008000;">&#41;</span>;
say_hello<span style="color: #008000;">&#40;</span>c2<span style="color: #008000;">&#41;</span>;
&nbsp;
<span style="color: #0000ff;">return</span> <span style="color: #0000dd;">0</span>;
<span style="color: #008000;">&#125;</span></pre></div>

<p>in this C++ program i define 2 classes, both have a method called get&#95;hello&#95;message, but the two classes are not related to each other.
then i define a function, that takes an object of any type (and calls it&#8217;s get&#95;hello&#95;message method.</p>

<p>try this in java :)</p>
    ]]></content>
  </entry>
</feed>
