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


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="smedegaard" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/smedegaard/120/5015_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  smedegaard
                    <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="smedegaard" data-post="31" data-topic="4567">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/smedegaard/48/5015_2.png" class="avatar"> smedegaard:</div>
<blockquote>
<p>if you posted some details of your model folks could help you place bits and pieces.</p>
</blockquote>
</aside>
<p>So I guess I’ll just post it here and see what happens…</p>
<p>Basically <code>users</code> have <code>recipes</code><br>
a <code>recipe</code> have a <code>yest_profile</code>, <code>malt_profile</code>, <code>mash_schedule</code>, <code>hop_profile</code> and <code>adjuncts</code><br>
a <code>batch</code> will have a <code>recipe</code>, <code>brew_date</code> and other batch spekecific data points<br>
I’m thinking that there should be both public and private repositories for malts, yeasts and hops</p>
<p>I have some other features in mind, but let’s leave that out for now.</p>
<p>If I was to “go the Uncle Bob way” and leave persistence out of this for as long as possible, how would I do this?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="30695" 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/do-you-really-need-a-database/4567/32">Post #31</a>
	                </div>
	            </div>
              <div id="likers-container-30695" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="30695"
                     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>
    <div class="postbit" id="30699" data-post-id="30699">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think the ‘contexts’ that Phoenix 1.3 is introducing are very much in line with the “create an interface for your app’s business domain and implement it for the persistence piece(s) you are considering.”, in that the context module is the only place where the business domain layer and the technical layer meet.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="30699" 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/do-you-really-need-a-database/4567/33">Post #32</a>
	                </div>
	            </div>
              <div id="likers-container-30699" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="30699"
                     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 #32"></div>
  </section>
</div>
    <div class="postbit" id="30910" data-post-id="30910">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="smedegaard" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/smedegaard/120/5015_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  smedegaard
                    <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>yeah. I agree. But I’m too much a noob to take all of this stuff in in one go…</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="30910" 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/do-you-really-need-a-database/4567/34">Post #33</a>
	                </div>
	            </div>
              <div id="likers-container-30910" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="30910"
                     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 #33"></div>
  </section>
</div>
    <div class="postbit" id="30911" data-post-id="30911">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="smedegaard" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/smedegaard/120/5015_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  smedegaard
                    <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>I guess what I’m struggling with is see nice pure functions and modules for this use case.</p>
<p>My mind is in object ↔ Database land…</p>
<p>Take <code>malt_profile</code>. It would have a name and some attributes like colour and such. I can’t imagine that cramming stuff like this in an <code>Agent</code> or  <code>Process</code> would have any benefits.</p>
<p>There’s no real time commutation going on. The only thing a malt would ever do is being a part of a <code>malt_profile</code>. And that in turn, would only be part of a <code>recipe</code>, which would be part of a <code>batch</code>.</p>
<p>No game dynamics. No chat. Nothing fancy (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="30911" 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/do-you-really-need-a-database/4567/35">Post #34</a>
	                </div>
	            </div>
              <div id="likers-container-30911" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="30911"
                     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 #34"></div>
  </section>
</div>
    <div class="postbit" id="30947" data-post-id="30947">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I agree with you.  There doesn’t really seem to be any reason to put those things into an Agent or process in-of-themselves.  They could just as easily be crammed in a struct:</p>
<pre><code>defmodule StrangeBrew.MaltProfile do
  defstruct name: "", base_malt: :two_row, specialty_malts: [], lovibond: 100 # etc

  def to_string(profile), do: "#{profile.name}(#{profile.lovibond}˚L)")
end
</code></pre>
<p>By the same token there’s not any particular reason to start out by tying them to a database.  In the future, should you want to try some fancy stuff (say estimating Lovibond from the particular grains in the profile) you shouldn’t have to “contaminate” your estimation logic with a bunch of stuff related to database queries and the size of table columns.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="30947" 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/do-you-really-need-a-database/4567/36">Post #35</a>
	                </div>
	            </div>
              <div id="likers-container-30947" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="30947"
                     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 #35"></div>
  </section>
</div>
    <div class="postbit" id="30954" data-post-id="30954">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="smedegaard" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/smedegaard/120/5015_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  smedegaard
                    <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>Thanks again.</p>
<p>That’s actually what I started doing yesterday. With one eye on “To spawn or not to spawn” and one eye on the Functional Web Dev book I began making modules with structs to represent my contexts/units. Let’s see where this leads <img src="https://forum.elixirforum.com/images/emoji/apple/+1/2.png?v=15" title=":+1:t2:" class="emoji" alt=":+1:t2:" 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="30954" 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/do-you-really-need-a-database/4567/37">Post #36</a>
	                </div>
	            </div>
              <div id="likers-container-30954" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="30954"
                     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 #36"></div>
  </section>
</div>
    <div class="postbit" id="30985" data-post-id="30985">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Don’t forget, <code>Kernel.put_in/3</code> is your friend when doing nested structs <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>
<p>(and the only reason that I’m mentioning this is that I had a hard time finding it in the docs when I needed it…)</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="30985" 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/do-you-really-need-a-database/4567/38">Post #37</a>
	                </div>
	            </div>
              <div id="likers-container-30985" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="30985"
                     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 #37"></div>
  </section>
</div>
    <div class="postbit" id="30989" data-post-id="30989">
  <section>
    <div class="post-wrap">


					<div class="post-header">
		        <div class="user-avatar">
		          <img alt="smedegaard" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/smedegaard/120/5015_2.png" width="120" height="120" />
		        </div>
					
						<div class="user-details">
		          <div class="user-name">
		            <h3>
                  smedegaard
                    <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>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="30989" 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/do-you-really-need-a-database/4567/39">Post #38</a>
	                </div>
	            </div>
              <div id="likers-container-30989" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="30989"
                     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 #38"></div>
  </section>
</div>
    <div class="postbit" id="54721" data-post-id="54721">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="smedegaard" data-post="1" data-topic="4567">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/smedegaard/48/5015_2.png" class="avatar"> smedegaard:</div>
<blockquote>
<p>Now i bassically feel like a poor noob that is getting told that</p>
</blockquote>
</aside>
<p>I am reading the same book(functional-web-development-with-elixir-otp-and-phoenix) and this exactly what I am feeling like recently. Initially I was really excited because I feel like it can be a huge performance gain since there is no more back and forth between code/logic and database.</p>
<p>I also ask some questions regarding my specific need on <a class="hashtag-cooked" href="/tag/elixir-lang/2519" data-type="tag" data-slug="elixir-lang" data-id="2519" data-style-type="icon" data-icon="tag" rel="nofollow"><span class="hashtag-icon-placeholder"><svg class="fa d-icon d-icon-square-full svg-icon svg-node"><use href="#square-full"></use></svg></span><span>elixir-lang</span></a> IRC. The specific conversation can be <a href="https://botbot.me/freenode/elixir-lang/2017-10-17/?tz=America/Los_Angeles" rel="noopener nofollow ugc">found here</a> beginning 4:06PM between users <strong>yial2</strong>(myself), <a class="mention" href="/u/radar" rel="nofollow">@radar</a>, and <strong>Zarathu</strong>. The preliminary is that <strong>GenServer process</strong> may not be suitable for my need, but I am still doing some more reading to try to find out more on my own.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="54721" 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/do-you-really-need-a-database/4567/40">Post #39</a>
	                </div>
	            </div>
              <div id="likers-container-54721" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="54721"
                     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 #39"></div>
  </section>
</div>
    <div class="postbit" id="54725" data-post-id="54725">
  <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">
								<p><a class="mention" href="/u/nobbz" rel="nofollow">@NobbZ</a>’s post sums it up for me:</p>
<aside class="quote quote-modified" data-post="3" data-topic="4567">
  <div class="title">
    <div class="quote-controls"></div>
    <img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/nobbz/48/27235_2.png" class="avatar">
    <div class="quote-title__text-content">
      <a href="https://forum.elixirforum.com/t/do-you-really-need-a-database/4567/3" rel="nofollow">"Do you really need a database?"</a> <a class="badge-category__wrapper " href="/c/chat-discussions/chat-discussions/167" rel="nofollow"><span data-category-id="167" style="--category-badge-color: #cca771; --category-badge-text-color: #FFFFFF; --parent-category-badge-color: #cca771;" data-parent-category-id="165" data-drop-close="true" class="badge-category --style-square --has-parent"><span class="badge-category__name">Discussions</span></span></a>
    </div>
  </div>
  <blockquote>
    Well, most of this thoughts about not needing a database assume a basic thing: You never shut down your application. 
If this is a fact and you can guarantee that it will never shutdown, then leave DBs completely. 
But since you can’t guarantee zero downtime, you have to persist your data somehow. 
To persist your data and getting it back into your live system, you have a couple of options: 

Put them into a databse of any kind (SQL or not doesn’t matter) and reload it when necessary
Log changes…
  </blockquote>
</aside>

<p>If it’s data you don’t mind losing in case of a system/power failure (such as temporary user settings) then there’s a good argument not to persist. But if it’s something like User account details, then I would persist.</p>
<p>Also, as you’re interested in application architecture I highly recommend <a href="https://forum.elixirforum.com/t/elixir-for-programmers-pragdave/6335" rel="nofollow">PragDave’s online course</a> - it’s sparked some really interesting discussions about approaches to development in Elixir.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="54725" data-batch-url="/posts/batch_likers">
                        3
                      </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/do-you-really-need-a-database/4567/41">Post #40</a>
	                </div>
	            </div>
              <div id="likers-container-54725" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="54725"
                     data-batch-url="/posts/batch_likers">
                  <div class="post-likers"></div>
                </div>
              </div>
	        </div>
			

    </div>

    <div class="triangle-top-right type-last-post cat-last-post" title="Last post!"></div>
  </section>
</div>
</template></turbo-stream><turbo-stream action="replace" target="load-more-container"><template><div id="load-more-container" class="load-more-container">
    <span class="all-loaded">— All posts loaded —</span>
</div></template></turbo-stream>