<?xml version="1.0" encoding="utf-8"?>
<rss version="2.0" xmlns:atom="http://www.w3.org/2005/Atom">
	<channel>
		<title><![CDATA[Approximatrix Forums — Best strategy for source file structure?]]></title>
		<link>https://forums.approximatrix.com/viewtopic.php?id=302</link>
		<atom:link href="https://forums.approximatrix.com/extern.php?action=feed&amp;tid=302&amp;type=rss" rel="self" type="application/rss+xml" />
		<description><![CDATA[The most recent posts in Best strategy for source file structure?.]]></description>
		<lastBuildDate>Fri, 08 Aug 2014 18:11:32 +0000</lastBuildDate>
		<generator>PunBB</generator>
		<item>
			<title><![CDATA[Re: Best strategy for source file structure?]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1476#p1476</link>
			<description><![CDATA[<p>These comments on this subject have appeared on LinkedIn:</p><p>Arjen Markus<br />consultant at Deltares (former name: WL|Delft Hydraulics)<br /><a href="https://www.linkedin.com/groups?viewMemberFeed=&amp;gid=145550&amp;memberID=4046922">https://www.linkedin.com/groups?viewMem … ID=4046922</a></p><p>8000 lines or 40 files are not all that much, as far as I am concerned, but since you find it hard to cope with, I will try to give you at least some suggestions: <br />- Make sure you store the sources and build scripts in a version control system. Probably best after rearranging the files. There is a wide choice of VCS&#039;s nowadays. <br />- Make sure you have one or more Makefiles/Solutions+project files/whatever is appropriate for your development environment, so that building the program is started merely by pressing a button in the IDE or typing a single command. <br />- You can probably divide the sources in separate directories, grouped logically according to the nature of the code. That will reduce the clutter. <br />- You may consider putting several source files into one, but I would do that only if they are related strongly enough, not just for the purpose of reducing the number of files. <br />- Make sure the files have relevant names, so that you can easily recognise them. </p><p>But, perhaps most practical of all, get to know the contents of these source files, so that you can easily find the one you need. </p><p>------------</p><p>Jouni Karjalainen<br />PhD student at University of Oulu/Dept. of Physics<br /><a href="https://www.linkedin.com/groups?viewMemberFeed=&amp;gid=145550&amp;memberID=14139594">https://www.linkedin.com/groups?viewMem … D=14139594</a></p><p>I agree 100 % to what Arjen Markus wrote. My current project is roughly double the size with about 110 files and 17000 lines of code, excluding libraries written by others. I do not consider it large at all. </p><p>I use CVS for version control and GNU Autotools for the build process etc. but there are probably more sophisticated, modern or simpler options available. </p><p>I would not recommend using &#039;include&#039; for adding regular subroutines. In case you want to separate the implementation from the interface, a better way is to define the interfaces in modules and use separate source files for the implementations. Possibly you could move the implementations to a separate folder/folders if desired? That may slightly complicate the compilation/build, though.</p>]]></description>
			<author><![CDATA[null@example.com (JohnWasilewski)]]></author>
			<pubDate>Fri, 08 Aug 2014 18:11:32 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1476#p1476</guid>
		</item>
		<item>
			<title><![CDATA[Re: Best strategy for source file structure?]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1414#p1414</link>
			<description><![CDATA[<p>Hello to All...</p><p>It&#039;s a bit late for more comments on this subject, but I was rereading this stuff and remembered a technique that I used some time ago.&nbsp; </p><p>I built &quot;index&quot; modules which contained nothing but INCLUDE statements, each with any necessary verbal descriptions as comments.&nbsp; Most of the includes were commented out, however.&nbsp; If I needed a particular module, it was easy to look at the descriptions, and uncomment the associated INCLUDE.&nbsp; I seldom had to search for anything.</p><p>You can even make overlapping modules, with some common routines present in 2 or more &quot;index&quot; modules, as needed.</p><p>I once worked with a guy who was a believer in keeping ALL of his subroutines in his &quot;MASTER&quot; program.&nbsp; Over time, the thing approached unmanagable size, and was difficult for an outsider to follow, since so much code was irrelevant.&nbsp; So, one of the<br />criteria that is involved in the structuring of source files is &quot;Who is going to maintain the code after I&#039;m gone?&quot;</p>]]></description>
			<author><![CDATA[null@example.com (xbits)]]></author>
			<pubDate>Thu, 29 May 2014 17:41:41 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1414#p1414</guid>
		</item>
		<item>
			<title><![CDATA[Re: Best strategy for source file structure?]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1267#p1267</link>
			<description><![CDATA[<p>First, we should think about the&nbsp; &quot;module&quot; feature. Indeed, &quot;Perhaps grouped together by subject relevance&quot; has a strong link with modules. However, and unfortunately, only one compiler implements the &quot;sub-module&quot; F2008 feature : the Cray compiler (AFAIK). This usually leads to either big modules (when the programmer wants to hide some internal things, declaring them as &quot;private&quot;) or many chained modules (but in this case, it is not possible to declare as &quot;private&quot; some structure fields -- e.g. components of a derived type -- which must be used by other modules of the same developper). In my numerical library MUESLI, I chose to split the big module into several small modules and got hidden things for the user by compiling twice the modules&#039; chain: the first time from the first module to the last and the second time in the reverse direction, storing the created MOD files in two separated folders (ok, it&#039;s a bit difficult to explain in one sentence).</p><p>Second, a practical remark: I prefer to distinguish &quot;physical file sources&quot; from &quot;logical units&quot;. IMHO, each source file should not be longer than, let&#039;s say, few hundred lines. In that case, we can use the &quot;include&quot; facility of F90 (or even the &quot;#include&quot; preprocessing command) to split the routines of a big module in separated physical files.</p>]]></description>
			<author><![CDATA[null@example.com (ecanot)]]></author>
			<pubDate>Wed, 12 Feb 2014 08:38:15 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1267#p1267</guid>
		</item>
		<item>
			<title><![CDATA[Re: Best strategy for source file structure?]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1257#p1257</link>
			<description><![CDATA[<p>I would say the easy answer is &quot;it depends&quot;.&nbsp; It truly depends on the size of your project.</p><p>With our recent project of over 200 modules, it would be totally unwieldy to do either (1) or (3).&nbsp; Using (2), you have the option of grouping like &quot;routines&quot; in modules so that they could be easily used by other projects, for example.&nbsp; Or having a structure so that the modules look similar (certain kinds of routines in each module).</p><p>For very small projects, I usually choose option 1.&nbsp; I probably would never choose option 3.</p>]]></description>
			<author><![CDATA[null@example.com (lklawrie)]]></author>
			<pubDate>Mon, 10 Feb 2014 15:04:10 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1257#p1257</guid>
		</item>
		<item>
			<title><![CDATA[Re: Best strategy for source file structure?]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1253#p1253</link>
			<description><![CDATA[<p>Thanks for the reply.&nbsp; I think you&#039;re right.<br />I&#039;ve been using strategy (2) but I was considering changing to strategy (3) because it&#039;s sometimes hard to remember where everything is.</p><p>See also my new post today under, &#039;Keeping track of current subprogram whilst editing&#039;.<br />--- <br />John</p>]]></description>
			<author><![CDATA[null@example.com (JohnWasilewski)]]></author>
			<pubDate>Tue, 04 Feb 2014 09:43:12 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1253#p1253</guid>
		</item>
		<item>
			<title><![CDATA[Re: Best strategy for source file structure?]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1249#p1249</link>
			<description><![CDATA[<p>Hi, John...</p><p>In reply to your question, I am not sure that the IS ONLY ONE answer.&nbsp; Doesn&#039;t the strategy<br />depend in great part on the characteristics of the incoming work flow?&nbsp; For example, compare<br />the programming requirements for a utility company which does the same thing day after day<br />for years at a time, with those of a software firm that produces quick responses to a variety<br />of requests that bear some similarity.</p><p>In the first case, the programs are likely to remain static for long periods.&nbsp; In the second, the<br />programmer has a short turnaround time to produce program(s) which are likely similar to<br />the stuff he did 2 or 3 months ago.</p><p>So, in one case there is no need for variety and speed, but in the other it requires that the code<br />be easy to get at and easy to modify -- and right under your nose.</p>]]></description>
			<author><![CDATA[null@example.com (xbits)]]></author>
			<pubDate>Tue, 04 Feb 2014 01:26:43 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1249#p1249</guid>
		</item>
		<item>
			<title><![CDATA[Best strategy for source file structure?]]></title>
			<link>https://forums.approximatrix.com/viewtopic.php?pid=1215#p1215</link>
			<description><![CDATA[<p>Three strategies :</p><p>(1)&nbsp; Only one source file for a project. <br />&nbsp; &nbsp; &nbsp; &nbsp;Main program and all subroutines in the same file.</p><p>(2)&nbsp; Multiple source files for a project.<br />&nbsp; &nbsp; &nbsp; &nbsp;Multiple subroutines in each source file.<br />&nbsp; &nbsp; &nbsp; &nbsp;Perhaps grouped together by subject relevance.</p><p>(3)&nbsp; Separate source files for main program and every subroutine.</p><br /><p>Are there any more?</p><p>I think (1) is a poor strategy to use.<br />I tend to use (2) but I&#039;ve been thinking for a long while that it would have been better to use (3).</p><p>What do others say?<br />--- <br />John</p>]]></description>
			<author><![CDATA[null@example.com (JohnWasilewski)]]></author>
			<pubDate>Thu, 09 Jan 2014 23:45:09 +0000</pubDate>
			<guid>https://forums.approximatrix.com/viewtopic.php?pid=1215#p1215</guid>
		</item>
	</channel>
</rss>
