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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="jsonify" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jsonify/120/810_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  jsonify
                    <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">
								<p>What a great solution. Very creative. Thank you for sharing that.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="5693" 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/exercism-bob/845/12">Post #11</a>
	                </div>
	            </div>
              <div id="likers-container-5693" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="5693"
                     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="5812" data-post-id="5812">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi All,</p>
<p>I’m also just starting out using Elixir coming from ruby and I was totally into the piping thing and created this solution:<br>
<a href="http://exercism.io/submissions/d3b3fdf89fc245f0a1c81e277f359df8" class="onebox" target="_blank" rel="noopener nofollow ugc">http://exercism.io/submissions/d3b3fdf89fc245f0a1c81e277f359df8</a></p>
<p>After I looked at all the others I was a little confused as the approach of everybody else was totally different.</p>
<p>Would love to get some feedback on my solution to hear if I am totally going off on a wrong sidepath…</p>
<p>Thanks!</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="5812" 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/exercism-bob/845/13">Post #12</a>
	                </div>
	            </div>
              <div id="likers-container-5812" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="5812"
                     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 #12"></div>
  </section>
</div>
    <div class="postbit" id="5813" data-post-id="5813">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I gave some comments on the exercise directly, short version: pipes are cool, but use them wise.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="5813" 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/exercism-bob/845/14">Post #13</a>
	                </div>
	            </div>
              <div id="likers-container-5813" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="5813"
                     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="5821" data-post-id="5821">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Thanks Norbert,</p>
<p>Basically could it be correct if I assume that you actually shouldn’t be piping with these conditionals as it is actually not about transforming data.</p>
<p>So in this case would pattern matching this solution be a more elixirian way of approaching this?</p>
<p>just tryong to wrap my head around these new concepts</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="5821" 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/exercism-bob/845/15">Post #14</a>
	                </div>
	            </div>
              <div id="likers-container-5821" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="5821"
                     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="5822" data-post-id="5822">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>It is not just an elixir thing. When working with some construct like <code>cond</code> you should alsways have short and concise conditions, which are easy to read and tell you not only how data has to look like, but what it actually means.</p>
<p>When you want to know if some property <em>p</em> of data is either <code>true</code> or <code>false</code> you really should give that property a proper name and make it a function suffixed by a questionmark and use it. Just consider how much better <code>ends_in_questionmark?(input)</code> reads compared to <code>input |&gt; String.replace(~r/[\s]/, "") |&gt; String.replace(~r/[\d]/, "") |&gt; String.last == "?"</code>, just consider how much <code>question?(input)</code> does even better suites the context of the exercise!</p>
<p>Katrina Owen (creator of exercism) gave some nice talks about refactoring in ruby, one of these talks was even about our friend bob: <a href="https://www.youtube.com/watch?v=qLpvc5r6Bb0" rel="nofollow">Katrina Owen – Overkill; 2014</a>. There is much stuff one can transfer to elixir. Propably not the stuff about extracting into various classes, but it would make sense to extract the predicates into separate modules. Haven’t done it so far in my own solutions though, since I’ve watched Katrinas talks just 14 days ago.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="5822" 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/exercism-bob/845/16">Post #15</a>
	                </div>
	            </div>
              <div id="likers-container-5822" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="5822"
                     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="5825" data-post-id="5825">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Here is mine solution, so far <a href="http://exercism.io/submissions/5896120477d44e048c136807ba851b4d" rel="noopener nofollow ugc">http://exercism.io/submissions/5896120477d44e048c136807ba851b4d</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="5825" 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/exercism-bob/845/17">Post #16</a>
	                </div>
	            </div>
              <div id="likers-container-5825" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="5825"
                     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 #16"></div>
  </section>
</div>
    <div class="postbit" id="5917" data-post-id="5917">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group quote-modified" data-username="jsonify" data-post="1" data-topic="845">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jsonify/48/810_2.png" class="avatar"> jsonify:</div>
<blockquote>
<p>defp shout_numbers?(message) do<br>
message<br>
|&gt; String.upcase()<br>
String.ends_with?(message, “?”)<br>
end</p>
</blockquote>
</aside>
<p>I’m confident that you meant:</p>
<pre><code>defp shout_numbers?(message) do
  message
  |&gt; String.upcase
  |&gt; String.ends_with?("?")
end
</code></pre>
<p>And, in:</p>
<aside class="quote no-group quote-modified" data-username="jsonify" data-post="1" data-topic="845">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/jsonify/48/810_2.png" class="avatar"> jsonify:</div>
<blockquote>
<p>defp capitals_letters?(message) do<br>
message<br>
|&gt; String.split(" “)<br>
|&gt; String.capitalize<br>
Enum.join(” ")<br>
end</p>
</blockquote>
</aside>
<p>You actually meant:</p>
<pre><code>defp capitals_letters?(message) do
   message
   |&gt; String.split(" ")
   |&gt; String.capitalize
   |&gt; Enum.join(" ")
end
</code></pre>
<p>If I’m mistaken or you corrected it already, I apologize.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="5917" 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/exercism-bob/845/18">Post #17</a>
	                </div>
	            </div>
              <div id="likers-container-5917" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="5917"
                     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="6566" data-post-id="6566">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I believe that the top-level function (the cond) should be a restatement of the problem specification. It should be written using terms in the problem domain (teenagers) not the solution domain (whitespace, upper case, etc.). E.g.:</p>
<pre><code>  def hey(input) do
    cond do
      question?(input) -&gt; "Sure."
      yell?(input)     -&gt; "Whoa, chill out!"
      nothing?(input)  -&gt; "Fine. Be that way!"

      true -&gt; "Whatever."
    end
  end
</code></pre>
<p>See how that code pretty much reads like the assignment for the problem. This is a big advantage of functional programming.</p>
<p>The implementation of these should then be done at gradually lower levels of abstraction. Here’s my solution: <a href="http://exercism.io/submissions/e7f0b1696ed14eaa99bc72bf882f2459" rel="noopener nofollow ugc">http://exercism.io/submissions/e7f0b1696ed14eaa99bc72bf882f2459</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="6566" 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/exercism-bob/845/19">Post #18</a>
	                </div>
	            </div>
              <div id="likers-container-6566" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="6566"
                     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="12356" data-post-id="12356">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Hi <a class="mention" href="/u/dogweather" rel="nofollow">@dogweather</a>. I like your ‘hey’ function but have a few thoughts. Recently I’ve been coming round to the idea that, in general, fewer functions is better. Why? Because more functions = more surface area for your code which makes understanding/maintaining it more difficult. This view has been articulated (in some form) by Linus, Carmack, and Blow which lends it some credibility. That is not to say that monolithic, ginormous functions are good, but that perhaps programmers have been underestimating the costs of abstracting into multiple functions. Your solution has 7 functions. For contrast here’s my single-function solution:</p>
<pre data-code-wrap="elixir"><code class="lang-elixir">defmodule Bob do
  def hey(input) do
    cond do
      String.ends_with?(input, "?") -&gt; "Sure."
      String.upcase(input) == input and String.downcase(input) != input -&gt; "Whoa, chill out!"
      String.trim(input) == "" -&gt; "Fine. Be that way!"
      true -&gt; "Whatever."
    end
  end
end
</code></pre>
<p><a href="http://exercism.io/submissions/03d9b6c8dbba45f79ac817ecd356a65a" rel="noopener nofollow ugc">http://exercism.io/submissions/03d9b6c8dbba45f79ac817ecd356a65a</a>.</p>
<p>This might be overthinking a simple exercism exercise, but that’s the point of them. To start discussion! <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="12356" 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/exercism-bob/845/20">Post #19</a>
	                </div>
	            </div>
              <div id="likers-container-12356" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="12356"
                     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="12360" data-post-id="12360">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Yeah, your solution is quite common throughout various tracks on exercism, but it has its drawbacks.</p>
<p>We do only have 4 cases here, of which one is a fallback, so we have 3 “real” cases. Now our customer chimes in and has a CR: “Change bobs reply to yelling to ‘NOT YELL AT ME’”.</p>
<p>Looking at your code it will take me a while to actually figure out which of the clauses does actually belong to yelling, but other solutions like <a class="mention" href="/u/dogweather" rel="nofollow">@dogweather</a>’s do give you proper hints were you need to change. They do not require you to understand the conditions, all you need to now is some plain english.</p>
<p>Very similar reasoning applies when there is a request to change the condition for a question. Which one belongs to questions here?</p>
<p>Extrtacting that conditions into predicates does increase readability and maintainability of the code alot. This applies even more on a larger codebase. And thats what exercism is about, giving small problems and requiring you to find solutions for that small problem that scale when the problem grows.</p>
<p>Especially for this exercise, there was a talk given by Katrina Own (founder of exercism), <a href="https://www.youtube.com/watch?v=qLpvc5r6Bb0" rel="nofollow">https://www.youtube.com/watch?v=qLpvc5r6Bb0</a> (I think this one was it, just waded through my browsers history and skimmed the video)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="12360" 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/exercism-bob/845/21">Post #20</a>
	                </div>
	            </div>
              <div id="likers-container-12360" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="12360"
                     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/845/load_more?page=3">Load more posts (10 remaining)</a>
</div></template></turbo-stream>