<?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>Observations from Uppsala &#187; programming languages</title>
	<atom:link href="http://jakob.engbloms.se/archives/tag/programming-languages/feed" rel="self" type="application/rss+xml" />
	<link>http://jakob.engbloms.se</link>
	<description>Computer Technology: Simulation, Virtualization, Virtual Platforms, Embedded, Multicore and Multiprocessing (by Jakob Engblom)</description>
	<lastBuildDate>Sun, 29 Jan 2012 19:45:28 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.3.1</generator>
<image>
    <title>Observations from Uppsala</title>
    <url>http://jakob.engbloms.se/favicon.png</url>
    <link>http://jakob.engbloms.se</link>
    <width>32</width>
    <height>32</height>
    <description>Observations from Uppsala - http://jakob.engbloms.se</description>
    </image>		<item>
		<title>In Praise of Scripting: Something for Modeling as Well?</title>
		<link>http://jakob.engbloms.se/archives/186?&#038;owa_medium=feed&#038;owa_sid=</link>
		<comments>http://jakob.engbloms.se/archives/186#comments</comments>
		<pubDate>Sun, 03 Aug 2008 20:40:51 +0000</pubDate>
		<dc:creator>Jakob</dc:creator>
				<category><![CDATA[computer simulation technology]]></category>
		<category><![CDATA[programming]]></category>
		<category><![CDATA[virtual platforms]]></category>
		<category><![CDATA[C/C++]]></category>
		<category><![CDATA[code]]></category>
		<category><![CDATA[DML]]></category>
		<category><![CDATA[Domain-specific languages]]></category>
		<category><![CDATA[programming languages]]></category>
		<category><![CDATA[python]]></category>
		<category><![CDATA[scripting languages]]></category>
		<category><![CDATA[simulation]]></category>
		<category><![CDATA[software tools]]></category>

		<guid isPermaLink="false">http://jakob.engbloms.se/?p=186</guid>
		<description><![CDATA[In the July 2008 issue of IEEE Computer, there is short article called &#8220;In Praise of Scripting: Real Programming Pragmatism&#8220;, by Ronald P. Loui, a professor at Washington University (WUSTL). The article deals with the issue of what is the appropriate first language to teach new CS (Computer Science) students, and considers that a &#8220;scripting&#8221; [...]]]></description>
			<content:encoded><![CDATA[<p><img class="size-medium wp-image-187 alignleft" style="margin: 5px 10px;" title="ieee-computer" src="http://jakob.engbloms.se/wp-content/uploads/2008/08/ieee-computer.gif" alt="" width="89" height="71" />In the <a href="http://www.computer.org">July 2008 issue of IEEE Computer</a>, there is short article called &#8220;<a href="http://doi.ieeecomputersociety.org/10.1109/MC.2008.228">In Praise of Scripting: Real Programming Pragmatism</a>&#8220;, by <a href="http://www.cs.wustl.edu/~loui/">Ronald P. Loui, a professor at Washington University</a> (WUSTL). The article deals with the issue of what is the appropriate first language to teach new CS (Computer Science) students, and considers that a &#8220;scripting&#8221; langauge like Python or Ruby might be way better than Java (no doubt about that I think).</p>
<p>The interesting material in the article is the background on WHY he thinks that this is the case. He points to the immense popularity and rise of scripting in much of computing land. In the past ten years, it is clear to him (and I would agree with this too mostly) that languages like Perl, PHP, Awk, Ruby, JavaScript, and Python have eclipse Java and C++ as the most interesting and important programming languages for many practical tasks. Especially for web applications, where Java seems to have a presence but noone would dream of using something as clunky and impractical as C.</p>
<p>What can this teach us for the purpose of simulation and the creation of models of computer system hardware for the purpose of simulation? Maybe a fair bit&#8230;</p>
<p><span id="more-186"></span></p>
<p>The reason that scripting languages have gotten so popular is primarily that they let you get the job done faster. In web land, this is due to a few important factors listed or hinted at in the article:</p>
<ul>
<li>The overall code tends to be shorter and more to the point</li>
<li>A tendency to make any value into a string when needed (excellent debugging aid)</li>
<li>Dynamic typing, variables that just appear when needed</li>
<li>Automatic memory management</li>
<li>Ease of handling strings</li>
<li>Most tasks are pretty short</li>
<li>Performance of computation does not matter very much when processors are as fast as they are today and a single disk or network access operations is likely to dominate programming time</li>
</ul>
<p>What the article continues with a discussion that we need to focus on programming language <em>pragmatics</em> rather than syntax or semantics. How <em>practical </em>is the language for the everyday tasks of a programmer? And it seems that simple darwinian evolution has propelled scripting-style languages to the top of heap here. Purity and elegance and deep semantical properties are obviously less important than getting the job done in the shortest time possible.</p>
<p>What can this teach us modeling folks?</p>
<ul>
<li>A key takeaway is the focus on short code. Code has to be short and focused to be quick and easy to write. You should not need to consult several header files and lots of documentation to understand and formulate your code, which is an ill that keeps hitting C and C++ programs.</li>
<li>Memory management has nothing to do in a productive programming environment.</li>
<li>Basic types have to be appropriate to the task at hand.</li>
<li>Syntax has to be concise and powerful.</li>
<li>Dynamic typing is much faster to code with than static typing and variable declarations.</li>
<li>An interactive &#8220;try it out&#8221; environment is preferable to long compile/link/test cycles.</li>
</ul>
<p>Obviously, some of these do not translate well into hardware modeling. Hardware entities tend to have very-well-defined types by nature. If I have a 16-bit register containing a 13-bit counter and three status bits, I cannot very well let that counter be a dynamic variable that can take on any numeric value. Or the atom &#8220;foo&#8221;. It kind of has to be restricted in semantics to how the hardware would behave&#8230; it is not just a &#8220;value&#8221; to be manipulated quite abstractly. Which means that what you probably rather need are types well-suited for the task at hand.</p>
<p>It is also nice if variables can just pop into existence when needed, with the least amount of declaration possible. Another C-family performance killer is the annoying need to declare a function before calling it. That made sense in linearly scanning compilers back in the 1970s, but today, just let the compiler take the entire program into account and find the function. It is not that hard, especially not for the quite small and isolated context that a virtual platform device model is (few device models are more than a few thousand lines of code in my experience).</p>
<p>The interactive nature of scripting is also interesting. The ability to just write new code directly into a running system without an explicit compile usually rests on a virtual-machine approach and does have some cost in terms of performance. And unlike webservers, virtual platforms need all the raw CPU performance they can get! However, it make excellent sense to use an interactive environment to prototype and test things, and then move the resulting code to a harder compile stage.</p>
<p>Right now, we really do not have such a tool at hand. <a href="http://www.virtutech.com/whitepapers/virtutech_dml.html">Virtutech DML </a>is <a href="http://www.scdsource.com/article.php?id=166">in my opinion </a>the most promising step along this road, but it is not really &#8220;perl for modeling&#8221; at this time. SystemC has too many C++ roots to really behave well in this respect&#8230; you get all the drawbacks of explicit memory management, rampant headerfiles, and statically declared types. It might be good to compile, but it sure is an absolute pain to write.</p>
<p>And if we want virtual platforms to really fly, it is not so much &#8220;all about the models&#8221;, but really &#8220;all about model programming&#8221; &#8212; since there is a huge volume of models that need to written out there, and getting the time needed to write these models down is a primary concern. The total work invested in modeling any particular device is what we need to focus on, really.</p>
<div class="simple_likebuttons_container_small">
      <div class="simple_likebuttons_googleplus">
        <g:plusone size="medium" count="false" href="http://jakob.engbloms.se/archives/186"></g:plusone>
      </div>
    
      <div class="simple_likebuttons_twitter simple_likebuttons_twitter_s">
        <a href="https://twitter.com/share" class="twitter-share-button" data-count="none" data-url="http://jakob.engbloms.se/archives/186" data-lang="en">Tweet</a>
      </div>
    
      <div class="simple_likebuttons_facebook">
        <div id="fb-root"></div>
        <script>(function(d, s, id) {
          var js, fjs = d.getElementsByTagName(s)[0];
          if (d.getElementById(id)) {return;}
          js = d.createElement(s); js.id = id;
          js.src = "//connect.facebook.net/en_US/all.js#xfbml=1";
          fjs.parentNode.insertBefore(js, fjs);
        }(document, "script", "facebook-jssdk"));</script>
        <div class="fb-like" data-href="http://jakob.engbloms.se/archives/186" data-send="false" data-layout="button_count" data-show-faces="false" data-width="90"></div>
      </div>
    </div>]]></content:encoded>
			<wfw:commentRss>http://jakob.engbloms.se/archives/186/feed</wfw:commentRss>
		<slash:comments>4</slash:comments>
		</item>
	</channel>
</rss>

