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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Deithrian" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Deithrian
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yes, it will not cause an error to call “calc_in_centimeters(house_width_gallons)”<br>
But why would you ever type it?</p>
<p>And is this Hungarian notation? <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>
<p>defmodule Main do<br>
def handle_user_input(user_input_post) do<br>
with<br>
{:ok, user_input_post} ← Sanitize_user_input.escape_html_chars(user_input_post),<br>
{:ok, user_input_post} ← Sanitize_user_input.step_2(user_input_post),<br>
{:ok, user_input_post} ← Sanitize_user_input.step_3(user_input_post)<br>
do<br>
continue(user_input_post)<br>
else<br>
{:error, user_input_post} → game_over_man_game_over()<br>
end<br>
end</p>
</blockquote>
<blockquote>
<p>defmodule Sanitize_user_input do<br>
def escape_html_chars(user_input_post){<br>
}<br>
def step_2(user_input_post){<br>
}<br>
def step_3(user_input_post){<br>
}<br>
end</p>
</blockquote> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="50934" data-batch-url="/posts/batch_likers">
                        0
                      </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/single-responsibility-principle-what-does-it-mean-to-you-and-your-elixir-apps/8704/23">Post #22</a>
	                </div>
	            </div>
              <div id="likers-container-50934" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="50934"
                     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 #22"></div>
  </section>
</div>
    <div class="postbit" id="50936" data-post-id="50936">
  <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 no-group" data-username="Deithrian" data-post="23" data-topic="8704">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/d/bc8723/48.png" class="avatar"> Deithrian:</div>
<blockquote>
<p>But why would you ever type it?</p>
</blockquote>
</aside>
<p>Because things happen, could be an accident, a macro, any number of other things.  <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20"></p>
<aside class="quote no-group quote-modified" data-username="Deithrian" data-post="23" data-topic="8704">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/d/bc8723/48.png" class="avatar"> Deithrian:</div>
<blockquote>
<p><code>step_2</code><br>
…<br>
<code>step_3</code></p>
</blockquote>
</aside>
<p>Uh, what was that about descriptive names?  What do those even mean?!  o.O<br>
And what if you accidentally commented out, say, step_2, will step_3 break?  Does step_3 even make sense then?  Etc…</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="50936" data-batch-url="/posts/batch_likers">
                        0
                      </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/single-responsibility-principle-what-does-it-mean-to-you-and-your-elixir-apps/8704/24">Post #23</a>
	                </div>
	            </div>
              <div id="likers-container-50936" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="50936"
                     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 #23"></div>
  </section>
</div>
    <div class="postbit" id="50939" data-post-id="50939">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Deithrian" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Deithrian
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Step 2 and Step 3 are to illustrate the point for SRP, not actual names <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"><br>
And I don’t accept the provided answer for why would you ever type that <img src="https://forum.elixirforum.com/images/emoji/apple/stuck_out_tongue.png?v=15" title=":stuck_out_tongue:" class="emoji" alt=":stuck_out_tongue:" 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="50939" data-batch-url="/posts/batch_likers">
                        0
                      </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/single-responsibility-principle-what-does-it-mean-to-you-and-your-elixir-apps/8704/25">Post #24</a>
	                </div>
	            </div>
              <div id="likers-container-50939" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="50939"
                     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 #24"></div>
  </section>
</div>
    <div class="postbit" id="50942" data-post-id="50942">
  <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 no-group" data-username="Deithrian" data-post="25" data-topic="8704">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/d/bc8723/48.png" class="avatar"> Deithrian:</div>
<blockquote>
<p>Step 2 and Step 3 are to illustrate the point for SRP, not actual names <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>So what happens if they get, say, swapped?  With proper types that becomes impossible:</p>
<pre data-code-wrap="ocaml"><code class="lang-ocaml">let handle_user_input user_input_post =
  try
    let Some user_input_post = Sanitize_user_input.escape_html user_input_post in
    let Some user_input_post = Sanitize_user_input.step_2 user_input_post in
    let Some user_input_post = Sanitize_user_input.step_3 user_input_post in
    continue user_input_post
  with _ -&gt; game_over_man_game_over ()

...
module Sanitize_user_input = struct
  let escape_html user_input = ...

  let step_2 (EscapedHtml user_input) = ...

  let step_3 (Step2Completed user_input) = ...
end
</code></pre>
<p>As an example, this now makes it that you cannot mix up the order either, at compile time instead of at some random time at runtime later.</p>
<aside class="quote no-group" data-username="Deithrian" data-post="25" data-topic="8704">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/d/bc8723/48.png" class="avatar"> Deithrian:</div>
<blockquote>
<p>And I don’t accept the provided answer for why would you ever type that <img src="https://forum.elixirforum.com/images/emoji/apple/stuck_out_tongue.png?v=15" title=":stuck_out_tongue:" class="emoji" alt=":stuck_out_tongue:" loading="lazy" width="20" height="20"></p>
</blockquote>
</aside>
<p>Really?  Have you not been programming long?  o.O<br>
Innumerable times have I done something like:</p>
<pre data-code-wrap="cpp"><code class="lang-cpp">set_dimensions(height, width); // wrong swapped arguments!
</code></pre>
<p>And the arguments ended up being backwards or something trivial like that, hence why I started typing out about everything since my early C++ days, at least in the code I control.  Among a whole host of other instances and styles.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="50942" 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/single-responsibility-principle-what-does-it-mean-to-you-and-your-elixir-apps/8704/26">Post #25</a>
	                </div>
	            </div>
              <div id="likers-container-50942" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="50942"
                     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 #25"></div>
  </section>
</div>
    <div class="postbit" id="50950" data-post-id="50950">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Deithrian" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Deithrian
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Idk, some of the proposed scenarios sound like “what if my cat walked on the keyboard” <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"><br>
The swamped arguments case is also strange, because why would you call the function without being sure of the order of the arguments?<br>
If I want to use a function I must go and check to see what it expects?<br>
If a function has arity 1, 2 or 3, I must go and see what’s on offer?<br>
When you “type”, I guess you can say “first argument is of type width”, “second is of type height” and get an error when you try to pass swamped arguments. But this means that to get swamped arguments, you must call the function without being sure what the arguments are. In one case you get an error, in the other you don’t, but in both cases you must call the function without being sure what it expects, and that’s something I don’t know how it happens.</p>
<p>Yes, I’m new, but for example, after not having used a basic “web component” for a while and need to import it and extend it, I go and check what it does, what it already offers, because I can’t be sure if I remember everything about everything?</p>
<p>I think that’s the main point for SRP, not to have magic, not to be able to put anything into a single function and have a result + 30 other things happening? At least that’s how I understand it. <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"><br>
Push complexity down and break it apart until it’s impossible to get it wrong.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="50950" data-batch-url="/posts/batch_likers">
                        0
                      </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/single-responsibility-principle-what-does-it-mean-to-you-and-your-elixir-apps/8704/27">Post #26</a>
	                </div>
	            </div>
              <div id="likers-container-50950" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="50950"
                     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 #26"></div>
  </section>
</div>
    <div class="postbit" id="51025" data-post-id="51025">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>While I 100% agree with the general approaches you’ve outlined (small, modular components with limited scopes; descriptive variable names; self-documenting functions, etc.), I don’t think the conclusions you’ve drawn from them are tenable for non-trivial applications that are worked on by teams over some period of time.</p>
<p>Comments, tests (<strong>!!</strong>), types, and specs are all very important tools for dealing with complexity. These aren’t things that are pursued simply to adhere to some strict formalities of ‘good software’, but rather because they are effective ways of identifying, describing, and reasoning about the complexity and correctness of systems. Over the lifecycle of any given project you may have new features, new bugs (same difference), plenty of human error, shifting requirements, employee turnover, etc. The software and the people writing it will grow throughout the project’s lifetime and I think it’s important to treat this growing complexity as a first class citizen. Comments, tests, types, specs, etc. are all ways of acknowledging this. You have to recognize from the start that a project will be too complex for a single person (or multiple) to hold in their mind all at once, and respond by putting in place the appropriate safeguards and ‘crutches’ to accommodate for this.</p>
<aside class="quote no-group" data-username="Deithrian" data-post="17" data-topic="8704">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/d/bc8723/48.png" class="avatar"> Deithrian:</div>
<blockquote>
<p>So when I read my code I go to the main file and look at the module names to recall what’s going on. Then it’s just a matter of following the module names and function names down the line to add or change stuff.</p>
</blockquote>
</aside>
<p>This only works when there is a well defined ‘main’ file, but often you will have multiple ‘main’ entry points, each to different parts of the system that are reached under different circumstances. You might also be dealing with code that was written by another member of your team, in which case there is nothing for you to recall since you have no memories of it. Good module and function names are tremendously helpful here for explaining the ‘how’, but they can’t adequately explain the ‘why’, and understanding the ‘why’ is crucial before you start making changes that are going to have an effect on the whole system.</p>
<aside class="quote no-group quote-modified" data-username="Deithrian" data-post="17" data-topic="8704">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/d/bc8723/48.png" class="avatar"> Deithrian:</div>
<blockquote>
<p>Why write a unit test for the + sign? It will add two numbers (in every respectable language) right?<br>
…<br>
Higher level functions only describe the steps taken to solve a problem, no work is done there.  If there’s a problem, you can instantly tell where it is, because all the work is done in low level functions, and if it’s a logic problem, then it’s a logic problem, and it’s easy to spot because all low level functions must work, which they always should if done right. 1+1 should always work right?</p>
</blockquote>
</aside>
<p>The main purpose of writing tests is to avoid regressions and ensure that changes to one part of the system don’t unknowingly effect another. As systems grow it becomes increasingly more difficult to instantly tell where a problem is.  Sometimes it’s even difficult to tell where a problem is a week later, when an an unrelated part of the system is suddenly crashing or returning incorrect results. Some regressions don’t reveal themselves instantly, nor do they reveal themselves in expected ways. “Why is the FooService crashing? We’ve only been working on BarService this week?”. Integration tests help alleviate this by acting as a kind of formal contract for the interactions that happen between different subsystems.</p>
<p>Even if you have a bunch of low level functions that perform simple tasks, these functions still have to be composed together at different layers. And the more compositions you have the more dependencies you create between different parts of the system. It may be easy to reason about how changing a function will effect a single specific composition, but what about the other 30? and what about the 15 or so higher layer constructs that those 30 functions compose into?  and the 7 above that?  You don’t get the higher layer functions risk free just because their lower layers are <code>1 + 1</code>.</p>
<aside class="quote no-group" data-username="Deithrian" data-post="17" data-topic="8704">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/d/bc8723/48.png" class="avatar"> Deithrian:</div>
<blockquote>
<p>In other words, I feel like “comments”, “unit tests”, “types”, “specs”, and so on, are the crutches of the lazy programmer, who didn’t break the top problem into small modules,didn’t write functions that describe the steps taken to solve the problem, didn’t write low level functions that are so simple it’s impossible to have an error,</p>
</blockquote>
</aside>
<p>Hey, what’s wrong with being lazy. I usually get called lazy for <em>not</em> writing these things. I guess it’s ‘damned if you do, damned if you don’t’ <img src="https://forum.elixirforum.com/images/emoji/apple/wink.png?v=15" title=":wink:" class="emoji" alt=":wink:" loading="lazy" width="20" height="20">. I don’t agree with the implication that these these are used by less abled programmers in lieu of following good development principles (in fact, I think these things are a critical part of those principles), but on the other hand I say “what’s wrong with a crutch?”. Things get hard and complicated sometimes and being able to lean on these fundamentals enables you to deal more confidently with complexity. Though I would say these things are more like snow shoes than crutches, and building a complex system is like climbing a mountain. And code is like snow… (or something?).</p>
<aside class="quote no-group" data-username="Deithrian" data-post="17" data-topic="8704">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/d/bc8723/48.png" class="avatar"> Deithrian:</div>
<blockquote>
<p>Anyway, I bet I’ll get some heat for this, but it’s ok <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"> I write my code, I love my code, I love, love, love, my code.</p>
</blockquote>
</aside>
<p>I’m throwing a little heat (<img src="https://forum.elixirforum.com/images/emoji/apple/fire.png?v=15" title=":fire:" class="emoji" alt=":fire:" loading="lazy" width="20" height="20">), but in general I agree with the underlying principles you’ve outlined: small pieces are much easier to reason about; things should be grouped together logically by their purpose in the system; design things as layers of composable interfaces; descriptive naming is an absolute necessity. But in my experience no matter how good your names are, or how small your functions are, or how impeccably contextualized your boundaries are, complexity will rear its ugly head at some point and you have to be prepared to take it on. And I don’t think relying merely on your ability to write a bunch of aptly-named small things that are “impossible to have any errors” is sufficient when that complexity grows large. Sometimes neither are specs, comments, and tests, but they certainly make it more manageable than the alternative.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="51025" data-batch-url="/posts/batch_likers">
                        5
                      </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/single-responsibility-principle-what-does-it-mean-to-you-and-your-elixir-apps/8704/28">Post #27</a>
	                </div>
	            </div>
              <div id="likers-container-51025" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="51025"
                     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 #27"></div>
  </section>
</div>
    <div class="postbit" id="51087" data-post-id="51087">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="Deithrian" src="/assets/icons/user-9f439610.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  Deithrian
                  </h3>
		          </div>
						
						</div>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I strongly believe that complexity is created and is not there inherently.</p>
<p>SRP, for me, is like having bricks. With bricks, I feel I can build an infinite wall.<br>
Other approaches feel like trying to build a wall with bricks, balloons, giraffes, wind, and good wishes.<br>
In that case there’s definitely the need for support beams to hold the thing together.</p>
<p>It sounds idealistic, but in my limited experience with my personal project, it’s actually how things have been working.<br>
The only time I got into trouble is when I decided to take the “easy/lazy” route and used innerHTML with a div instead of creating a brand new web component for the job.<br>
In a system with bricks, one must stick with bricks, or one balloon and the whole thing goes down or support beams are needed, and with support beams people go crazy and star building with sound waves ; )<br>
Btw, I must mention how much I love web components, it’s like processes and message passing in the browser <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"> &lt;3<br>
Anyway, I hope I don’t have to meet the mentioned monsters from the OO world and captain SRP with FP will win the day <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="51087" data-batch-url="/posts/batch_likers">
                        0
                      </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/single-responsibility-principle-what-does-it-mean-to-you-and-your-elixir-apps/8704/29">Post #28</a>
	                </div>
	            </div>
              <div id="likers-container-51087" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="51087"
                     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 #28"></div>
  </section>
</div>
    <div class="postbit" id="51116" data-post-id="51116">
  <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
                    <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>
					
					</div>

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="AstonJ" data-post="3" data-topic="8704">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/astonj/48/15_2.png" class="avatar"> AstonJ:</div>
<blockquote>
<p>I’m not sure if this counts as part of the SRP, but apps being split into components could be closely related as well.</p>
</blockquote>
</aside>
<p>A little later in the course Dave confirms this:</p>
<blockquote>
<p>A thread that runs through this course is the idea of designing for decoupling using the Single Responsibility Principle. As we’ve seen, this applies equally to individual functions, to complete modules, and to entire applications.</p>
</blockquote> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="51116" data-batch-url="/posts/batch_likers">
                        0
                      </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/single-responsibility-principle-what-does-it-mean-to-you-and-your-elixir-apps/8704/30">Post #29</a>
	                </div>
	            </div>
              <div id="likers-container-51116" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="51116"
                     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 #29"></div>
  </section>
</div>
    <div class="postbit" id="51128" data-post-id="51128">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Deithrian" data-post="29" data-topic="8704">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/d/bc8723/48.png" class="avatar"> Deithrian:</div>
<blockquote>
<p>I strongly believe that complexity is created and is not there inherently.</p>
</blockquote>
</aside>
<p>Yet Fred Brooks pointed out in <em>The Mythical Man-Month</em> (in the 1970’s) how there’s both inherent and accidental complexity. We should avoid accidental complexity, sure, but there are problem domains with inherent complexity too. I suspect you haven’t encountered them yet.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="51128" 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/single-responsibility-principle-what-does-it-mean-to-you-and-your-elixir-apps/8704/31">Post #30</a>
	                </div>
	            </div>
              <div id="likers-container-51128" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="51128"
                     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 #30"></div>
  </section>
</div>
    <div class="postbit" id="51131" data-post-id="51131">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="Deithrian" data-post="29" data-topic="8704">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/d/bc8723/48.png" class="avatar"> Deithrian:</div>
<blockquote>
<p>I strongly believe that complexity is created and is not there inherently.</p>
</blockquote>
</aside>
<p>I think it’s certainly possible to create complexity where there is none, and distilling a complex set of requirements into non-complex code is the “name of the game” for us as developers, but the complexity present in networks of interconnected systems is more of a natural phenomena than it is a side-effect. It’s not about whether or not it’s avoidable or exists, but how it can be minimized and managed effectively.</p>
<p>I will use WebComponents as a example, but from a different angle. Take a look at the specs browsers are required to implement for web components:</p>
<p><a href="https://html.spec.whatwg.org/multipage/scripting.html#the-template-element" rel="noopener nofollow ugc">Template Element</a><br>
<a href="https://html.spec.whatwg.org/multipage/custom-elements.html#custom-elements" rel="noopener nofollow ugc">Custom Element</a><br>
<a href="https://dom.spec.whatwg.org/#shadow-trees" rel="noopener nofollow ugc">Shadow Trees</a><br>
<a href="http://w3c.github.io/webcomponents/spec/shadow/" rel="noopener nofollow ugc">Shadow DOM</a><br>
<a href="http://w3c.github.io/webcomponents/spec/imports/" rel="noopener nofollow ugc">HTML Imports</a><br>
<a href="https://drafts.csswg.org/css-scoping/" rel="noopener nofollow ugc">CSS Scoping</a></p>
<p>Now imagine something like firefox, which is <a href="https://www.openhub.net/p/firefox" rel="noopener nofollow ugc">almost 18 million lines of code</a> that have been worked on by over 5000 contributors. These are features that touch on several of the fundamental subsystems of the browser: the dom, rendering engine, and javascript engine. These are features that have over a decade of active code that is being relied on by millions of users. Even in the most ideal of systems where SRP is strictly adhered to and state is managed following the principles of FP, you will have unavoidable complexity.</p>
<p>I personally agree that the principles behind SRP and FP are great ways to minimize this, but I don’t think they replace good test coverage, formal specifications, and descriptive comments.</p>
<p>Web components are sweet though. I wish I could write erlang/elixir in the browser. Being able to represent a web component as GenServer would be amazing.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="51131" 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/single-responsibility-principle-what-does-it-mean-to-you-and-your-elixir-apps/8704/32">Post #31</a>
	                </div>
	            </div>
              <div id="likers-container-51131" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="51131"
                     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 #31"></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/8704/load_more?page=4">Load more posts (1 remaining)</a>
</div></template></turbo-stream>