<turbo-stream action="append" target="posts_list"><template>    <div class="postbit" id="97112" data-post-id="97112">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="LostKobrakai" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/LostKobrakai/120/3072_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  LostKobrakai
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Afaik phoenix opted out of the convention to prevent having tons of <code>.Controller</code> and <code>.View</code> modules.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="97112" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/module-naming-conventions/16636/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-97112" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="97112"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #11"></div>
  </section>
</div>
    <div class="postbit" id="97152" data-post-id="97152">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="peerreynders" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/120/5826_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  peerreynders
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="boydm" data-post="11" data-topic="16636">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/boydm/48/582_2.png" class="avatar"> boydm:</div>
<blockquote>
<p>I would prefer a module name of <code>MyAppWeb.Controller.Page</code> , which (to me) denotes that it is a single controller.</p>
</blockquote>
</aside>
<p>My perspective on <code>MyAppWeb.Controllers.Page</code>:</p>
<ul>
<li><code>Page</code> module</li>
<li>in the <code>MyAppWeb.Controllers</code> “namespace”</li>
<li>therefore I expect <code>Page</code> to be a single controller - one among many in the <code>MyAppWeb.Controllers</code> “namespace”.</li>
</ul>
<p>So the pluralization isn’t in the service of a good folder or module name but to create the sense of a namespace.</p>
<p>Now when it comes to the wisdom of having separate <code>MyAppWeb.Controllers</code> and <code>MyAppWeb.Views</code> namespaces given how tightly coupled controllers and views tend to be - that is a separate discussion (as I recall there are technical reasons for this as views require very different build processing from controllers - I’ve never been fond of the Rails convention of collecting “like things” under the same namespace (when we are not dealing with a (standard) library); I’m more of a <em>put things that work as a cohesive whole under the same namespace</em> sort of guy).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="97152" data-batch-url="/posts/batch_likers">
                        7
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/module-naming-conventions/16636/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-97152" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="97152"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></div>
  </section>
</div>
    <div class="postbit" id="97155" data-post-id="97155">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="AstonJ" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/AstonJ/120/15_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  AstonJ
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="boydm" data-post="10" data-topic="16636">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/boydm/48/582_2.png" class="avatar"> boydm:</div>
<blockquote>
<p>In general, I’ve been trying to follow the non-plural forms. The only exception has been the Scenic.Primitives and Scenic.Components modules, which are collections of helper files to instantiate those data structures.</p>
</blockquote>
</aside>
<aside class="quote no-group" data-username="boydm" data-post="11" data-topic="16636">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/boydm/48/582_2.png" class="avatar"> boydm:</div>
<blockquote>
<p>When it comes to Scenic, it made sense to follow the Phoenix pattern. An app will have a collection of scenes. So put those in the <code>scenes</code> folder. However, each module defines a single scene, so it would have a name like <code>MyApp.Scene.Whatever</code> .</p>
</blockquote>
</aside>
<p>Ah that makes total sense. (For some reason I was thinking about automatic pluralisation (and conventions) that happen in frameworks like Rails (and not in Phoenix) of modules/schemas etc, rather than the generated structure on creation.)</p>
<aside class="quote no-group" data-username="boydm" data-post="11" data-topic="16636">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/boydm/48/582_2.png" class="avatar"> boydm:</div>
<blockquote>
<p><code>lib/my_app_web/controllers/page_controller.ex</code> contains <code>MyAppWeb.PageController</code> instead of <code>MyAppWeb.Controller.Page</code> or <code>MyAppWeb.Controllers.Page</code></p>
</blockquote>
</aside>
<p>I quite like that too!</p>
<p>Thinking about it, and I remember it was discussed somewhere but not sure where now - does anyone know why in Phoenix we dropped the <code>web</code> folder for <code>MyAppWeb</code>?  I think <code>Web.Controller.Page</code> or <code>Web.Controllers.Page</code> is much cleaner.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="97155" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/module-naming-conventions/16636/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-97155" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="97155"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #13"></div>
  </section>
</div>
    <div class="postbit" id="97176" data-post-id="97176">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-Erlang-Core-Team" data-username="joeerl" data-post="1" data-topic="16636">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/joeerl/48/6651_2.png" class="avatar"> joeerl:</div>
<blockquote>
<p>(the name changed from <code>MyApp</code> to <code>my_app</code> seems strange – file names are UTF8 so I don’t see why camel case files names are not used)</p>
</blockquote>
</aside>
<p>I’ve noticed that myself, I’ve accidentally let slip a camel-cased filename in my folders…  ^.^;</p>
<aside class="quote group-livebook_core_team" data-username="josevalim" data-post="2" data-topic="16636">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/josevalim/48/1787_2.png" class="avatar"> josevalim:</div>
<blockquote>
<p>In Elixir, we usually follow a direct mapping from module name to file name. So a file named <code>MyApp.Sensors.Supervisor</code> should be put in <code>lib/my_app/sensors/supervisor.ex</code> .</p>
</blockquote>
</aside>
<p>A ‘direct’ mapping would be putting it in <code>lib/MyApp/Sensors/Supervisor.ex</code> though?</p>
<aside class="quote group-Erlang-Core-Team" data-username="joeerl" data-post="3" data-topic="16636">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/joeerl/48/6651_2.png" class="avatar"> joeerl:</div>
<blockquote>
<p>(actually I’d <em>really</em> like no readable file names at all - all file names should be SHA’s of the content and in a global content addressable store - but we’re not there yet <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p>
</blockquote>
</aside>
<p>Lol, so <code>git</code> without the filename part of the tag?  ^.^</p>
<p>My dream has always been a database of code personally.   Everything properly linked together, denormalized, etc…  Mmmm…</p>
<p>As something similar, OCaml uses lower-case-initial-character filenames but Modeles always start with an upper case characters.  I’ve always found that odd too.  In C++ I have the filenames match the case of the namespace/static-class that are defined in.</p>
<hr>
<p>I prefer the <code>MyAppWeb.Controllers.Page</code> style too, but that is harder to macro’ize automatic linking with Views and all as the ‘Controllers’ part could be arbitrarily higher from the current controller name if you use a hierarchy and such things, so for macro’ing reasons having it be appended seems ‘safer’.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="97176" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/module-naming-conventions/16636/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-97176" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="97176"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #14"></div>
  </section>
</div>
    <div class="postbit" id="97180" data-post-id="97180">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="boydm" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/boydm/120/582_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  boydm
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Scenic</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="OvermindDL1" data-post="15" data-topic="16636">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/overminddl1/48/2677_2.png" class="avatar"> OvermindDL1:</div>
<blockquote>
<p>I prefer the <code>MyAppWeb.Controllers.Page</code> style too, but that is harder to macro’ize automatic linking with Views and all as the ‘Controllers’ part could be arbitrarily higher from the current controller name if you use a hierarchy and such things, so for macro’ing reasons having it be appended seems ‘safer’.</p>
</blockquote>
</aside>
<p>Ah. That makes sense. I’m not trying to macro-ize anything, so am going to try to stick with the more readable name.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="97180" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/module-naming-conventions/16636/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-97180" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="97180"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #15"></div>
  </section>
</div>
    <div class="postbit" id="97185" data-post-id="97185">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="wojtekmach" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/wojtekmach/120/999_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  wojtekmach
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Hex Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I believe the reason that Phoenix has <code>PostController</code> instead of <code>Controllers.Post</code> is that it’s pretty common to alias modules and it wouldn’t be possible to have in the same module the following:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir"># contrived:
alias Controllers.Post
alias Views.Post
alias Blog.Post
</code></pre>
<p>A good example where not sticking to 1-1 mapping between file and module is in Elixir itself: <a href="https://github.com/elixir-lang/elixir/tree/master/lib/elixir/lib/calendar" class="inline-onebox" rel="noopener nofollow ugc">elixir/lib/elixir/lib/calendar at main · elixir-lang/elixir · GitHub</a>, we have <code>lib/calendar/date.ex</code> defines <code>Date</code>, instead of <code>Calendar.Date</code>. It’s very convenient to keep these files together.</p>
<p>What I personally try to do is to stick to 1-1 mapping in the vast majority of cases but sometimes, very rarely, diverge from it when it has some benefits.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="97185" data-batch-url="/posts/batch_likers">
                        20
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/module-naming-conventions/16636/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-97185" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="97185"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-most-liked cat-most-liked" title="One of the top 3 liked posts in this thread!"></div>
  </section>
</div>
    <div class="postbit" id="99100" data-post-id="99100">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="dimitarvp" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/dimitarvp/120/38664_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  dimitarvp
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p><a class="mention" href="/u/joeerl" rel="nofollow">@joeerl</a> I quite like Java’s way of enforcing the same file name as the class name (when the class is public anyway), and forcing one class per file:</p>
<aside class="onebox stackexchange" data-onebox-src="https://stackoverflow.com/questions/1841847/can-i-compile-a-java-file-with-a-different-name-than-the-class/1841880#1841880">
  <header class="source">

      <a href="https://stackoverflow.com/questions/1841847/can-i-compile-a-java-file-with-a-different-name-than-the-class/1841880#1841880" target="_blank" rel="noopener nofollow ugc">stackoverflow.com</a>
  </header>

  <article class="onebox-body">
      <a href="https://stackoverflow.com/users/171061/steven-schlansker" target="_blank" rel="noopener nofollow ugc">
    <img alt="Steven Schlansker" src="https://www.gravatar.com/avatar/891e2f14eb568ff3e5b290fbd2fb4e05?s=256&amp;d=identicon&amp;r=PG" class="thumbnail onebox-avatar" width="256" height="256">
  </a>

<h4>
  <a href="https://stackoverflow.com/questions/1841847/can-i-compile-a-java-file-with-a-different-name-than-the-class/1841880#1841880" target="_blank" rel="noopener nofollow ugc">Can I compile a java file with a different name than the class?</a>
</h4>

<div class="tags">
  <strong>java</strong>
</div>

<div class="date">
  
  answered by
  <a href="https://stackoverflow.com/users/171061/steven-schlansker" target="_blank" rel="noopener nofollow ugc">
    Steven Schlansker
  </a>
  on <a href="https://stackoverflow.com/questions/1841847/can-i-compile-a-java-file-with-a-different-name-than-the-class/1841880#1841880" target="_blank" rel="noopener nofollow ugc">06:25PM - 03 Dec 09 UTC</a>
</div>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>Go has conventions that the compiler enforces:</p>
<aside class="onebox stackexchange" data-onebox-src="https://stackoverflow.com/questions/25161774/what-are-conventions-for-filenames-in-go/25162021#25162021">
  <header class="source">

      <a href="https://stackoverflow.com/questions/25161774/what-are-conventions-for-filenames-in-go/25162021#25162021" target="_blank" rel="noopener nofollow ugc">stackoverflow.com</a>
  </header>

  <article class="onebox-body">
      <a href="https://stackoverflow.com/users/32880/mr-pink" target="_blank" rel="noopener nofollow ugc">
    <img alt="Mr_Pink" src="https://www.gravatar.com/avatar/7728fc825d24a338b763bfa32b2aea9f?s=256&amp;d=identicon&amp;r=PG&amp;f=y&amp;so-version=2" class="thumbnail onebox-avatar" width="256" height="256">
  </a>

<h4>
  <a href="https://stackoverflow.com/questions/25161774/what-are-conventions-for-filenames-in-go/25162021#25162021" target="_blank" rel="noopener nofollow ugc">What are conventions for filenames in Go?</a>
</h4>

<div class="tags">
  <strong>go, naming-conventions</strong>
</div>

<div class="date">
  
  answered by
  <a href="https://stackoverflow.com/users/32880/mr-pink" target="_blank" rel="noopener nofollow ugc">
    Mr_Pink
  </a>
  on <a href="https://stackoverflow.com/questions/25161774/what-are-conventions-for-filenames-in-go/25162021#25162021" target="_blank" rel="noopener nofollow ugc">01:44PM - 06 Aug 14 UTC</a>
</div>

  </article>

  <div class="onebox-metadata">
    
    
  </div>

  <div style="clear: both"></div>
</aside>

<p>I don’t quite like the more liberal approach of Elixir because I’ve seen people put 4 modules in a single file and the name of the file does not even reflect the purpose of the bunch of modules. Granted that’s not often the case but IMO the tooling should not give you the ability to shoot yourself in the foot.</p>
<p>Conventions are only good for as long as the inhabitants of the ecosystem are willing to comply with them.</p>
<p>I understand some of the counter-arguments though – like convenient aliasing and naming consistency for the sake of macro automation / code generation.</p>
<hr>
<aside class="quote group-Erlang-Core-Team" data-username="joeerl" data-post="1" data-topic="16636">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/joeerl/48/6651_2.png" class="avatar"> joeerl:</div>
<blockquote>
<p>also since module names are unique we can put all the modules in the same directory (people tend not to do this - but I do, since it makes the problem of deciding a directory name go away).</p>
</blockquote>
</aside>
<p>I would absolutely do this. It gets tiring chasing files in directories even with an IDE. When a project grows beyond a certain point however, a single directory becomes unsustainable (I’d say if you go beyond 40-50 files; the whole thing has to be human-friendly after all). But right now I think that having separate directories for 1-2 modules (usually the root of your app – <code>lib/my_app/my_app.ex</code>) is taking it too far and is unnecessary. Same for the separate directory for 1-2 supervisors. Configuration and tests do make a lot of sense in where they are now, but nothing much else really.</p>
<p>I’d like to see more conventions inside the <code>lib/</code> or <code>lib/my_app</code> directory contents, like <code>supervisors/</code> or <code>background_workers/</code>. And a flatter directory structure overall.</p>
<p>I can’t argue a directory hierarchy is very useful for Phoenix projects though. Or umbrella projects where you can have an app for Phoenix site, GraphQL gateway, REST gateway etc.</p>
<p><strong>EDIT:</strong><br>
In a recent project I had these two files in <code>lib/</code>: <code>my_app.ex</code> and <code>cli.ex</code>, where the latter file contained a module named <code>MyApp.CLI</code>. Still not sure if the CLI file should be named <code>my_app.cli.ex</code> or be forced to <code>my_app/cli.ex</code>. I lean toward the former because I think Elixir projects have too many directories with too few files in them.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="99100" data-batch-url="/posts/batch_likers">
                        1
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/module-naming-conventions/16636/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-99100" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="99100"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #17"></div>
  </section>
</div>
    <div class="postbit" id="99102" data-post-id="99102">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="axelson" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/axelson/120/26351_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  axelson
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Scenic Core Team</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>If you want to use credo to enforce the module name there’s a PR up for that feature: <a href="https://github.com/rrrene/credo/pull/587" rel="nofollow">https://github.com/rrrene/credo/pull/587</a></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="99102" data-batch-url="/posts/batch_likers">
                        4
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/module-naming-conventions/16636/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-99102" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="99102"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #18"></div>
  </section>
</div>
    <div class="postbit" id="99109" data-post-id="99109">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="joeerl" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/joeerl/120/6651_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  joeerl
                    <span class="op-star" title="Thread Starter">
                      <img alt="OP" class="op-star-icon" src="/assets/thread-icons/thread-icon-thread-starter-df91e872.png" />
                    </span>
                  </h3>
		          </div>
						
			          <div class="user-title">
									<span>Creator of Erlang - Fondly Remembered</span>
			          </div>
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Just a followup - over the years I have tried many different ways of organising files - non of them are good.</p>
<p>What I currently do (or am tending towards) is the following:</p>
<p>a) All modules that I think I might reuse are put in the same directory (called Dropbox/elib) with hopefully meaningful module names.</p>
<p>The advantage of this is I can grep for things in this directory and easily find things.</p>
<p>The Dropbox bit means my files are synced across all the machines I use - so for shared code there is one version (the latest) with a unique name on all machines.</p>
<p>It’s not even in GIT - I don’t want all old versions of the code  just the latest and I’ll change the name if I make significant changes to the code - (and I’m not collaborating with anybody here - for collaborative code I do use GIT - but for private projects I don’t care about branches and saving old versions - just the latest is fine)</p>
<p>(I should add that I’m old-school - I learned to program <em>before</em> revision control systems where invented - so we developed strategies based on file naming that were useful - these strategies are a lot simpler than things like GIT and are fine for personal projects - but not for big collaborative projects)</p>
<p>b) All projects go into a sub-directory of Dropbox/experiments with a meaningful name</p>
<p>c) Inside a project directory (say Dropbox/experiments/transluder) local modules are just stored anywhere - but modules using the shared code in lib I just add as symbolic links.</p>
<p>This has a few advantages - my <code>ls</code> command colors symbolic links so I can see they are shared. The editor always edits the master version (in lib) - all experiments using the shared library get to see the same version of the code.</p>
<p>What I actually hate is having multiple versions of a file with the same name in different directories. These files endup with different sizes and modification dates. Some go back 30 years and all are slightly different.</p>
<p>I also hate the idea that files with the same name (in different directories) can have different contents. It’s ok for a file with a unique name in a single directory to have time varying content - I’m usually only interested in the latest version.</p>
<p>Before GIT (and friends) I used to name files with names like lib_this_vsn1 lib_this_vsn2<br>
etc. bumping the version when appropriate. This was great - all the old versions were frozen and we knew that the greatest vsn could change without warning. This was how erlang was developed <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"> - there was no GIT <a class="mention" href="/u/rvirding" rel="nofollow">@rvirding</a>  and I worked on a module until we got fed uo and then mailed the latest version to each other.</p>
<p>GIT etc hides this so we just say lib_this - the problem here is this fails the “telephone test” - ie if we were to tell somebody "code code is in the file XYZ’ two people could view the file at the same time (both see it is called XYZ) but they are looking at a different version of the code and are not aware of this fact. This has happened to me so many times since files get them selves detached from their revision control systems (for example by send in mails) and is large source of errors.</p>
<p>Actually there this is a symptom of a much deeper problem - but there is not room here to explain this (short version - the problem lies in editors, they do not record where the data in the file came from in the first place)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="99109" data-batch-url="/posts/batch_likers">
                        6
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/module-naming-conventions/16636/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-99109" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="99109"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #19"></div>
  </section>
</div>
    <div class="postbit" id="99149" data-post-id="99149">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="OvermindDL1" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/OvermindDL1/120/2677_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  OvermindDL1
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote group-Erlang-Core-Team" data-username="joeerl" data-post="20" data-topic="16636">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/joeerl/48/6651_2.png" class="avatar"> joeerl:</div>
<blockquote>
<p>The Dropbox bit means my files are synced across all the machines I use - so for shared code there is one version (the latest) with a unique name on all machines.</p>
</blockquote>
</aside>
<p>Careful with that, dropbox has been known to corrupt git repo’s like that!  I’d recommend using <a href="https://keybase.io" rel="noopener nofollow ugc">KeyBase</a>’s git storage.  It also has distributed file storage like dropbox if you need it, but it has a specialized git area that keeps consistency and safety unlike the distributed file storage style that both keybase and dropbox use.</p>
<aside class="quote group-Erlang-Core-Team" data-username="joeerl" data-post="20" data-topic="16636">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/joeerl/48/6651_2.png" class="avatar"> joeerl:</div>
<blockquote>
<p>It’s not even in GIT - I don’t want all old versions of the code just the latest and I’ll change the name if I make significant changes to the code - (and I’m not collaborating with anybody here - for collaborative code I do use GIT - but for private projects I don’t care about branches and saving old versions - just the latest is fine)</p>
</blockquote>
</aside>
<p>Ah you just keep files, well still be careful about offline synching potentially changing files versions in unexpected ways too, use git instead (github, gitlab, whatever)!  ^.^</p>
<aside class="quote group-Erlang-Core-Team" data-username="joeerl" data-post="20" data-topic="16636">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/joeerl/48/6651_2.png" class="avatar"> joeerl:</div>
<blockquote>
<p>What I actually hate is having multiple versions of a file with the same name in different directories. These files endup with different sizes and modification dates. Some go back 30 years and all are slightly different.</p>
</blockquote>
</aside>
<p>+1  I have <em>so</em> many slightly edited versions of so many files from programming 20-30 years ago…  &gt;.&gt;</p>
<p>And I even used the CVS era (I <em>still</em> have my old SVN server running…).</p>
<aside class="quote group-Erlang-Core-Team" data-username="joeerl" data-post="20" data-topic="16636">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/joeerl/48/6651_2.png" class="avatar"> joeerl:</div>
<blockquote>
<p>GIT etc hides this so we just say lib_this - the problem here is this fails the “telephone test” - ie if we were to tell somebody "code code is in the file XYZ’ two people could view the file at the same time (both see it is called XYZ) but they are looking at a different version of the code and are not aware of this fact. This has happened to me so many times since files get them selves detached from their revision control systems (for example by send in mails) and is large source of errors.</p>
</blockquote>
</aside>
<p>Precisely, that is why you say a file at commit &lt;hash&gt; (or even just <code>joe/master</code> or so), or just a link to it in your git server now.</p>
<aside class="quote group-Erlang-Core-Team" data-username="joeerl" data-post="20" data-topic="16636">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/joeerl/48/6651_2.png" class="avatar"> joeerl:</div>
<blockquote>
<p>This has happened to me so many times since files get them selves detached from their revision control systems (for example by send in mails) and is large source of errors.</p>
</blockquote>
</aside>
<p>But yeah, this is inherently disconnected so will get out of sync, everything should stay in the VCS.</p>
<aside class="quote group-Erlang-Core-Team" data-username="joeerl" data-post="20" data-topic="16636">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/joeerl/48/6651_2.png" class="avatar"> joeerl:</div>
<blockquote>
<p>the problem lies in editors, they do not record where the data in the file came from in the first place</p>
</blockquote>
</aside>
<p>Hmm…<br>
</p><div class="lightbox-wrapper"><a class="lightbox" href="https://forum.elixirforum.com/uploads/default/original/2X/d/d374bcaeae5033c4948858b82ed8c291e8563480.jpeg" data-download-href="https://forum.elixirforum.com/uploads/default/d374bcaeae5033c4948858b82ed8c291e8563480" title="image" rel="nofollow"><img src="https://forum.elixirforum.com/uploads/default/original/2X/d/d374bcaeae5033c4948858b82ed8c291e8563480.jpeg" alt="image" data-base62-sha1="uaCQXCD63MNoaqicm0buQluBSve" width="474" height="175"><div class="meta"><svg class="fa d-icon d-icon-far-image svg-icon" aria-hidden="true"><use href="#far-image"></use></svg><span class="filename">image</span><span class="informations">474×175 13.6 KB</span><svg class="fa d-icon d-icon-discourse-expand svg-icon" aria-hidden="true"><use href="#discourse-expand"></use></svg></div></a></div><p></p>
<p>Many editors now can show precisely when a line was added based on git, the commit, the message of the commit, get details about the branch, commit, server, etc…  I can literally just slide a scrollbar to go backward and forward in history.  <img src="https://forum.elixirforum.com/images/emoji/apple/slight_smile.png?v=15" title=":slight_smile:" class="emoji" alt=":slight_smile:" loading="lazy" width="20" height="20"></p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="99149" data-batch-url="/posts/batch_likers">
                        2
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/module-naming-conventions/16636/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-99149" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="99149"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-standard-post cat-standard-post" title="Post #20"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <a class="load-more-button" data-turbo-stream="true" href="/topics/16636/load_more?page=3">Load more posts (6 remaining)</a>
</div></template></turbo-stream>