<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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/"
		>
<channel>
	<title>Comments on: Why is most science programming done in fortran?</title>
	<atom:link href="http://forthescience.org/blog/2009/02/22/why-is-most-science-programming-done-in-fortran/feed/" rel="self" type="application/rss+xml" />
	<link>http://forthescience.org/blog/2009/02/22/why-is-most-science-programming-done-in-fortran/</link>
	<description>A blog about science and programming</description>
	<lastBuildDate>Wed, 14 Mar 2012 22:38:19 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1.2</generator>
	<item>
		<title>By: Stefano Borini</title>
		<link>http://forthescience.org/blog/2009/02/22/why-is-most-science-programming-done-in-fortran/comment-page-1/#comment-9795</link>
		<dc:creator>Stefano Borini</dc:creator>
		<pubDate>Sat, 07 Aug 2010 16:49:57 +0000</pubDate>
		<guid isPermaLink="false">http://forthescience.org/blog/?p=52#comment-9795</guid>
		<description>@MSB: 

&gt; There are two methods in Fortran to solve this problem:
&gt; “use ModuleName, only: ItemName” will select only “ItemName” 
&gt; from the module “ModuleName”, so if that module has items that
&gt; you don’t need that clash with another module, they are omitted
&gt; and don’t clash. If two modules have items that you need that 
&gt; have the same name, you can rename the item: “use ModuleName, 
&gt; OrigName =&gt; NewName”. Clash gone!

yes, but you will have to specify it by hand for each routine you need to import. This can become very tedious as you have to cherry pick what you need, and write even more boilerplate code. Compare to how python solves the problem:

  import foo
  import bar

  foo.hello()
  bar.hello()

In Fortran you would have to &quot;USE foo&quot; and &quot;USE bar&quot;, plus rename the hello routines with &quot;USE foo, hello =&gt; foo_hello&quot; and &quot;USE bar, hello =&gt; bar_hello&quot;. This introduces two problems, the first is given above: you need to do it for any routine you need and clash, which can be a lot if you are, for example, using two IO modules with a standard interface for conversion among different formats.

The second problem is that if you are particularly unlucky, and instead of hello you have Conn_getRemoteServerInfo (25 chars) and the module Network (7 chars), to stay consistent in style you will have to do USE Network, Conn_getRemoteServerInfo =&gt; Network_Conn_getRemoteServerInfo which is 33 chars and therefore in excess of the standard. 

The identifier issue I raise however is a minor point and unfortunate case, though. It is not representative, you can work around it, but during actual programming we did hit it. The root cause was forcing a namespacing-like workaround to keep things organized and programming OO-style without doing OO at all (don&#039;t ask, I fought against it but sometimes a compromise is needed), in a language that does not support nested namespaces.</description>
		<content:encoded><![CDATA[<p>@MSB: </p>
<p>> There are two methods in Fortran to solve this problem:<br />
> “use ModuleName, only: ItemName” will select only “ItemName”<br />
> from the module “ModuleName”, so if that module has items that<br />
> you don’t need that clash with another module, they are omitted<br />
> and don’t clash. If two modules have items that you need that<br />
> have the same name, you can rename the item: “use ModuleName,<br />
> OrigName => NewName”. Clash gone!</p>
<p>yes, but you will have to specify it by hand for each routine you need to import. This can become very tedious as you have to cherry pick what you need, and write even more boilerplate code. Compare to how python solves the problem:</p>
<p>  import foo<br />
  import bar</p>
<p>  foo.hello()<br />
  bar.hello()</p>
<p>In Fortran you would have to &#8220;USE foo&#8221; and &#8220;USE bar&#8221;, plus rename the hello routines with &#8220;USE foo, hello => foo_hello&#8221; and &#8220;USE bar, hello => bar_hello&#8221;. This introduces two problems, the first is given above: you need to do it for any routine you need and clash, which can be a lot if you are, for example, using two IO modules with a standard interface for conversion among different formats.</p>
<p>The second problem is that if you are particularly unlucky, and instead of hello you have Conn_getRemoteServerInfo (25 chars) and the module Network (7 chars), to stay consistent in style you will have to do USE Network, Conn_getRemoteServerInfo => Network_Conn_getRemoteServerInfo which is 33 chars and therefore in excess of the standard. </p>
<p>The identifier issue I raise however is a minor point and unfortunate case, though. It is not representative, you can work around it, but during actual programming we did hit it. The root cause was forcing a namespacing-like workaround to keep things organized and programming OO-style without doing OO at all (don&#8217;t ask, I fought against it but sometimes a compromise is needed), in a language that does not support nested namespaces.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: MSB</title>
		<link>http://forthescience.org/blog/2009/02/22/why-is-most-science-programming-done-in-fortran/comment-page-1/#comment-9289</link>
		<dc:creator>MSB</dc:creator>
		<pubDate>Fri, 29 Jan 2010 03:51:58 +0000</pubDate>
		<guid isPermaLink="false">http://forthescience.org/blog/?p=52#comment-9289</guid>
		<description>An ISO Technical Report defined a standard addition for variable length strings.  An open source implementation exists since 2003.   You &quot;use&quot; iso_varying_string.  Deferred length allocatable scaler strings (Fortran 2003) provide dynamic length strings.  Some compilers supporter this already, e.g., Intel ifort since mid-2009.

Re: &quot;When you use USE, you import every symbol in your scope, meaning that if you have two different modules, but with the same symbol name inside, they will clash. Unless thereâ??s a trick I donâ??t know about, this means you cannot import them at the same time.&quot;   

There are two methods in Fortran to solve this problem:
&quot;use ModuleName, only: ItemName&quot; will select only &quot;ItemName&quot; from the module &quot;ModuleName&quot;, so if that module has items that you don&#039;t need that clash with another module, they are omitted and don&#039;t clash.   If two modules have items that you need that have the same name, you can rename the item: &quot;use ModuleName, OrigName =&gt; NewName&quot;.   Clash gone!


&quot;short identifier limit&quot;?  31 characters in Fortran 95, 63 in Fortran 2003.   Longer than this, the lines of the program will get rather long...</description>
		<content:encoded><![CDATA[<p>An ISO Technical Report defined a standard addition for variable length strings.  An open source implementation exists since 2003.   You &#8220;use&#8221; iso_varying_string.  Deferred length allocatable scaler strings (Fortran 2003) provide dynamic length strings.  Some compilers supporter this already, e.g., Intel ifort since mid-2009.</p>
<p>Re: &#8220;When you use USE, you import every symbol in your scope, meaning that if you have two different modules, but with the same symbol name inside, they will clash. Unless thereâ??s a trick I donâ??t know about, this means you cannot import them at the same time.&#8221;   </p>
<p>There are two methods in Fortran to solve this problem:<br />
&#8220;use ModuleName, only: ItemName&#8221; will select only &#8220;ItemName&#8221; from the module &#8220;ModuleName&#8221;, so if that module has items that you don&#8217;t need that clash with another module, they are omitted and don&#8217;t clash.   If two modules have items that you need that have the same name, you can rename the item: &#8220;use ModuleName, OrigName =&gt; NewName&#8221;.   Clash gone!</p>
<p>&#8220;short identifier limit&#8221;?  31 characters in Fortran 95, 63 in Fortran 2003.   Longer than this, the lines of the program will get rather long&#8230;</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Stefano Borini</title>
		<link>http://forthescience.org/blog/2009/02/22/why-is-most-science-programming-done-in-fortran/comment-page-1/#comment-8708</link>
		<dc:creator>Stefano Borini</dc:creator>
		<pubDate>Sat, 05 Dec 2009 05:28:32 +0000</pubDate>
		<guid isPermaLink="false">http://forthescience.org/blog/?p=52#comment-8708</guid>
		<description>&gt; 1) a lot of code to perform a task ??
&gt; let me give a counter example
&gt; Java (cold be C or C++):
&gt; 
&gt; float[10][10] a;
&gt; for (int i=0; i&lt;a .length; i++) for(int j=0; j&lt;a[i].length; j++)  rel=&quot;nofollow&quot;&gt; a[i][j] = 0;
&gt; 
&gt; Fortran:
&gt; 
&gt; real::a(10,10)
&gt; a = 0

The example you present specifically addresses one strength of fortran (90): handling arrays. For any other task, it will take more code. I cannot show you real examples here, but you are welcome to download the Q5Cost library for real cases of bloat code to perform trivial tasks such as exception handling.
By the way, if the example you gave was C, I would not zero an array the way you did, I would simply use bzero().

&gt; 2) modular programming is easy with fortran 95, Object 
&gt; programming is with fortran 2003.

Not really. Modular programming is &quot;easy&quot; once you know how it works, but the way is implemented makes it a pain to handle. Namespacing is limited to basically one level, and you cannot rename your module import. When you use USE, you import every symbol in your scope, meaning that if you have two different modules, but with the same symbol name inside, they will clash. Unless there&#039;s a trick I don&#039;t know about, this means you cannot import them at the same time. This breaks havoc if you want to use two different modules with the same interface but with different implementation (for example, if you want to read data from a file format and store it into another file format). 

&gt; 3) if fortran has IMPLICIT, it also have IMPLICIT NONE and
&gt; each compiler has flags to prevent implicit statement.

Yes, but they are not turned on by default. This is one case where backward compatibility should have been dropped for the sake of forcing a bit of proper coding style. We would have much better code around now.

&gt; 4) Dynmic memory allocation, aggregation: not missing any more
&gt; since fortran 90

Except for strings.

&gt; 5) dynamic strings: foreseen in fortran 2003, not yet 
&gt; implemented by compilers. The only cons so far.

well, last time I checked we are in 2009 ;)

&gt; Nevertheless, charaster(100) and Character(101) are more like
&gt; an double and a float than an int and a string, as thay can be
&gt; compared and assinged to each other…

In other words, they are like two different datatypes, with forced implicit coercion.

&gt; 6) GUI programming, Networking, DB access, real time, 
&gt; inter-process communication and much more… Yes, I&#039;ve done that
&gt; in Fortran 15 years ago when I was programming Satellite
&gt; control center, with high requirements on reliability.

Interesting. Using what public available libraries ? I guess they were internally produced in your case. This unfortunately limits its access to the rest of the world, making adoption of fortran for these tasks basically nil. 

&gt; Conclusion: The language is secondary and you cannot say
&gt; &quot;Don&#039;t use that or that language&quot;. There are Pros and cons
&gt; for all of them, and it always depends on the programmer…

Exactly what I said, and I totally agree with you. I would not use python for a low level device driver and I would not use Fortran to access a MySQL database.&lt;/a&gt;</description>
		<content:encoded><![CDATA[<p>> 1) a lot of code to perform a task ??<br />
> let me give a counter example<br />
> Java (cold be C or C++):<br />
><br />
> float[10][10] a;<br />
> for (int i=0; i<a .length; i++) for(int j=0; j<a[i].length; j++)  rel="nofollow"> a[i][j] = 0;<br />
><br />
> Fortran:<br />
><br />
> real::a(10,10)<br />
> a = 0</p>
<p>The example you present specifically addresses one strength of fortran (90): handling arrays. For any other task, it will take more code. I cannot show you real examples here, but you are welcome to download the Q5Cost library for real cases of bloat code to perform trivial tasks such as exception handling.<br />
By the way, if the example you gave was C, I would not zero an array the way you did, I would simply use bzero().</p>
<p>> 2) modular programming is easy with fortran 95, Object<br />
> programming is with fortran 2003.</p>
<p>Not really. Modular programming is &#8220;easy&#8221; once you know how it works, but the way is implemented makes it a pain to handle. Namespacing is limited to basically one level, and you cannot rename your module import. When you use USE, you import every symbol in your scope, meaning that if you have two different modules, but with the same symbol name inside, they will clash. Unless there&#8217;s a trick I don&#8217;t know about, this means you cannot import them at the same time. This breaks havoc if you want to use two different modules with the same interface but with different implementation (for example, if you want to read data from a file format and store it into another file format). </p>
<p>> 3) if fortran has IMPLICIT, it also have IMPLICIT NONE and<br />
> each compiler has flags to prevent implicit statement.</p>
<p>Yes, but they are not turned on by default. This is one case where backward compatibility should have been dropped for the sake of forcing a bit of proper coding style. We would have much better code around now.</p>
<p>> 4) Dynmic memory allocation, aggregation: not missing any more<br />
> since fortran 90</p>
<p>Except for strings.</p>
<p>> 5) dynamic strings: foreseen in fortran 2003, not yet<br />
> implemented by compilers. The only cons so far.</p>
<p>well, last time I checked we are in 2009 <img src='http://forthescience.org/blog/wp-includes/images/smilies/icon_wink.gif' alt=';)' class='wp-smiley' /> </p>
<p>> Nevertheless, charaster(100) and Character(101) are more like<br />
> an double and a float than an int and a string, as thay can be<br />
> compared and assinged to each other…</p>
<p>In other words, they are like two different datatypes, with forced implicit coercion.</p>
<p>> 6) GUI programming, Networking, DB access, real time,<br />
> inter-process communication and much more… Yes, I&#8217;ve done that<br />
> in Fortran 15 years ago when I was programming Satellite<br />
> control center, with high requirements on reliability.</p>
<p>Interesting. Using what public available libraries ? I guess they were internally produced in your case. This unfortunately limits its access to the rest of the world, making adoption of fortran for these tasks basically nil. </p>
<p>> Conclusion: The language is secondary and you cannot say<br />
> &#8220;Don&#8217;t use that or that language&#8221;. There are Pros and cons<br />
> for all of them, and it always depends on the programmer…</p>
<p>Exactly what I said, and I totally agree with you. I would not use python for a low level device driver and I would not use Fortran to access a MySQL database.</a></p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Magermans</title>
		<link>http://forthescience.org/blog/2009/02/22/why-is-most-science-programming-done-in-fortran/comment-page-1/#comment-8680</link>
		<dc:creator>Magermans</dc:creator>
		<pubDate>Wed, 02 Dec 2009 14:44:08 +0000</pubDate>
		<guid isPermaLink="false">http://forthescience.org/blog/?p=52#comment-8680</guid>
		<description>Perhaps the comment is late, but it is , I think, relevant.
First of all, I&#039;m a fan of Java. I also work on some simulation software written in Fortran.

1) a lot of code to perform a task ??
let me give a counter example
Java (cold be C or  C++):

float[10][10] a;
for (int i=0; i&lt;a.length; i++) for(int j=0; j&lt;a[i].length; j++) a[i][j] = 0;

Fortran:

real::a(10,10)
a = 0

2) modular programming is easy with fortran 95, Object programming is with fortran 2003.

3) if fortran has IMPLICIT, it also have IMPLICIT NONE and each compiler has flags to prevent implicit statement.

4) Dynmic memory allocation, aggregation: not missing any more since fortran 90

5) dynamic strings: foreseen in fortran 2003, not yet implemented by compilers. The only cons so far. Nevertheless, charaster(100) and Character(101) are more like an double and a float than an int and a string, as thay can be compared and assinged to each other...

6) GUI programming, Networking, DB access, real time, inter-process communication and much more... Yes, I&#039;ve done that in Fortran 15 years ago when I was programming Satellite control center, with high requirements on reliability. A lot safer than doing them in C or C++.

Conclusion: The language is secondary and you cannot say &quot;Don&#039;t use that or that language&quot;. There are Pros and cons for all of them, and it always depends on the programmer...

Pol Magermans
Software Engineer
University of Liège, Belgium.</description>
		<content:encoded><![CDATA[<p>Perhaps the comment is late, but it is , I think, relevant.<br />
First of all, I&#8217;m a fan of Java. I also work on some simulation software written in Fortran.</p>
<p>1) a lot of code to perform a task ??<br />
let me give a counter example<br />
Java (cold be C or  C++):</p>
<p>float[10][10] a;<br />
for (int i=0; i&lt;a.length; i++) for(int j=0; j&lt;a[i].length; j++) a[i][j] = 0;</p>
<p>Fortran:</p>
<p>real::a(10,10)<br />
a = 0</p>
<p>2) modular programming is easy with fortran 95, Object programming is with fortran 2003.</p>
<p>3) if fortran has IMPLICIT, it also have IMPLICIT NONE and each compiler has flags to prevent implicit statement.</p>
<p>4) Dynmic memory allocation, aggregation: not missing any more since fortran 90</p>
<p>5) dynamic strings: foreseen in fortran 2003, not yet implemented by compilers. The only cons so far. Nevertheless, charaster(100) and Character(101) are more like an double and a float than an int and a string, as thay can be compared and assinged to each other&#8230;</p>
<p>6) GUI programming, Networking, DB access, real time, inter-process communication and much more&#8230; Yes, I&#039;ve done that in Fortran 15 years ago when I was programming Satellite control center, with high requirements on reliability. A lot safer than doing them in C or C++.</p>
<p>Conclusion: The language is secondary and you cannot say &quot;Don&#039;t use that or that language&quot;. There are Pros and cons for all of them, and it always depends on the programmer&#8230;</p>
<p>Pol Magermans<br />
Software Engineer<br />
University of Liège, Belgium.</p>
]]></content:encoded>
	</item>
</channel>
</rss>

