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


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="mkaszubowski" data-post="31" data-topic="10583">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/mkaszubowski/48/6569_2.png" class="avatar"> mkaszubowski:</div>
<blockquote>
<p>But people are sometimes so used to databases and ORMs that they don’t think about this when using them.</p>
</blockquote>
</aside>
<p>I say ignorance isn’t an excuse for poor application design.</p>
<p>Now I’m not familiar with the Ecto codebase but I’d expect that by and large the module to give a hint as to whether or not a function call crosses the process boundary. And even when that isn’t the case the function parameters probably tell their own story - if you need to specify the repo you’re likely crossing the process boundary.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="61570" 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/elixir-enables-stateful-web-applications-is-it-wrong-to-think-like-this/10583/32">Post #31</a>
	                </div>
	            </div>
              <div id="likers-container-61570" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="61570"
                     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="61583" data-post-id="61583">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="peerreynders" data-post="29" data-topic="10583">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<p>That’s why I always feel a bit queasy when I see message handling buried inside something that looks like a simple process function call.</p>
</blockquote>
</aside>
<p>But isn’t this done everywhere in the erlang ecosystem? Do you really care if something uses a process, or an ets table or something else and how would you ever be able to change the implementation unless you hide the functionality behind an interface?</p>
<p>It is even recommended in a number of books to hide the fact that you are talking to a for example a gen_server.</p>
<p>I start with the API I want. Once that is set I can change the implementation anyway I want (and I often do because I don’t know the optimal solution up front) without having to change all the code using the library. Perhaps this is convenience over correctness but in practice I don’t see it working in any other way.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="61583" 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/elixir-enables-stateful-web-applications-is-it-wrong-to-think-like-this/10583/33">Post #32</a>
	                </div>
	            </div>
              <div id="likers-container-61583" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="61583"
                     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="61586" data-post-id="61586">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I think the answer is, as always, it depends.</p>
<p>For client-server architectures (where client can be anything short-lived, most commonly a process handling a single HTTP request), I think that most of the times it’s fine not to care about if it’s a function call of sending a message. In worst case scenario you will just time out. Of course there are various cases where this might cause a bottleneck or other problem, but I’d say that this should be the server’s concern, not the client’s.</p>
<p>The situation looks a lot different where it’s not client-server, but there’re multiple cooperating processes. Then, you are exposed to a lot of different problems (for example deadlocks) which are <strong>really hard to debug</strong>.  In this case, the difference between a function call and sending a message (and, what’s the most problematic - sending a message and <em>awaiting the answer</em>) is huge.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="61586" 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/elixir-enables-stateful-web-applications-is-it-wrong-to-think-like-this/10583/34">Post #33</a>
	                </div>
	            </div>
              <div id="likers-container-61586" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="61586"
                     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="61609" data-post-id="61609">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="cmkarlsson" data-post="33" data-topic="10583">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/cmkarlsson/48/23000_2.png" class="avatar"> cmkarlsson:</div>
<blockquote>
<p>But isn’t this done everywhere in the erlang ecosystem?</p>
</blockquote>
</aside>
<p>I would expect a <em>competent</em> Erlang developer to realize on a conscious and subconscious level that (synchronous) API calls are in fact:</p>
<ul>
<li>blocking</li>
<li>subject to a possible timeout capable of terminating the process</li>
</ul>
<p>while at the same time using the “let it crash” philosophy and the tools of process links, exits (+ trapping), monitors, supervision, etc. to manage potential termination in <em>some</em> reasonable fashion.</p>
<blockquote>
<p>Do you really care if something uses a process</p>
</blockquote>
<p>I would at least prefer to know up front whether a function call has the potential to block process execution. Because at that point the decision needs to be made whether it <em>makes sense</em> for the process to be blocked - and if it <em>isn’t</em>, it’s time to spawn a separate process for the express purpose of being blocked (instead).</p>
<p><a href="https://forum.elixirforum.com/t/genserver-docs-handle-cast-should-be-used-sparingly-why/4908" rel="nofollow">Elsewhere</a> I already expressed my puzzlement about some places suggesting to choose “call” as a <em>default</em> over “cast”. All too often a “default” is interpreted as a strong preference or worse, a “99% of the time” choice - often accepted to avoid having to <em>actually understand</em> the nuanced <strong>consequences</strong> of all the available choices.</p>
<p>I think one of the best uses of <em>process state</em> is to store context and correlation information for pending asynchronous requests (i.e. cast messages expected to eventually result in some kind of return message or timeout).</p>
<p>Synchronous API calls have their place but my concern is that <em>mindless adoption</em> (for the sake of convenience) will waste valuable opportunities in process architectures.</p>
<p>In terms of Erlang vs. Elixir - in my experience Erlang educational resources tend to dwell much more on the details of working with the primitives of spawning new processes, sending and receiving (asynchronous) messages - giving the learner a better <em>perspective</em> how different (from more mainstream platforms) the BEAM environment actually is.</p>
<p>Elixir resources seem all too eager to instead impress with agents, tasks etc., without building a sense and appreciation of <em>how really asynchronous</em> the fundamentals are (sometimes leaving neophytes with a false sense of familiarity <em>and security</em>).</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="61609" data-batch-url="/posts/batch_likers">
                        6
                      </span>
                      <!-- <span class="thread-count js-solved-indicator" title="Marked as solution"></span> -->
	                </div>
	                <div class="go-to-post">
	                  <a title="Go to post" alt="Go to post" href="https://forum.elixirforum.com/t/elixir-enables-stateful-web-applications-is-it-wrong-to-think-like-this/10583/35">Post #34</a>
	                </div>
	            </div>
              <div id="likers-container-61609" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="61609"
                     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="95706" data-post-id="95706">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>There are some very articulate thoughts about when it does and does not make sense to use processes to hold state above.</p>
<p>I have some intuition myself about this, mostly leading to using process state for ongoing interactions when the interaction model is time-bound and matches a single connexion or session. Those would be some types of games, web sessions, etc.</p>
<p>However I would be grateful if you could apply your opinion re. whether or not it’s a good idea to use process state to various examples just to make sure I understand what you mean. Especially if <a class="mention" href="/u/peerreynders" rel="nofollow">@peerreynders</a> and <a class="mention" href="/u/hubertlepicki" rel="nofollow">@hubertlepicki</a> could chime in, that would be very useful <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>
<ul>
<li>
<p>In his online Elixir course (non-free, <a href="https://codestool.coding-gnome.com/courses/elixir-for-programmers" rel="noopener nofollow ugc">Elixir for Programmers</a>) Dave Thomas uses one stateful GenServer holding the state of a Hangman game (letters already guessed, game status, turns left, etc.) for each connected client.</p>
</li>
<li>
<p>Lance Halvorsen, in line with his book that got recommended on this forum on several occasions (<a href="https://pragprog.com/book/lhelph/functional-web-development-with-elixir-otp-and-phoenix" rel="noopener nofollow ugc">Functional Web Development with Elixir, OTP, and Phoenix</a>) presented his <a href="https://www.youtube.com/watch?v=1IOobarmwQg&amp;list=PLqj39LCvnOWaxI87jVkxSdtjG8tlhl7U6&amp;index=4" rel="noopener nofollow ugc">Elixir at a Walking Pace</a> talk at ElixirConf US 2018. In it, he describes how he uses one process per item to be tracked in a wharehouse / shipping system, complete with on-demand cold start (read state from disk). Albeit he admits this is going to be hell to scale to a multi-node system in the talk and does not really give an applicable solution for this, he seems to see quite a few benefits in doing this in terms of architecture.</p>
</li>
</ul>
<p>EDIT: There is a reference by <a class="mention" href="/u/peerreynders" rel="nofollow">@peerreynders</a>  to a thread on the PragProg forums that might address this at least partially (<a href="https://forum.elixirforum.com/t/genserver-docs-handle-cast-should-be-used-sparingly-why/4908" rel="nofollow">GenServer docs: “handle_cast … should be used sparingly” Why?</a>) but those forums seem to be closed now and I could find no cache of this thread elsewhere.</p>
<ul>
<li>On several occasions on this forum, it has been suggested that GenServers are a good fit for holding DDD-aggregate type state, my understanding being a GenServer per aggregate instance, similar to Lance Halvorsen’s example, and not simply a stateless implementation of business logic, for example <a href="https://forum.elixirforum.com/t/domain-driven-design-aggregate-roots-as-elixir-processes-genserver/4372" rel="nofollow">Domain Driven design : Aggregate roots as Elixir Processes/GenServer</a>.</li>
</ul>
<p>On that last one, I’d especially would love to get feedback from <a class="mention" href="/u/hubertlepicki" rel="nofollow">@hubertlepicki</a>, as you seem in agreement above with not using processes to hold state as some default model, but at the same time seemed to agree that using them to maintaing aggregates is fine. I might be seeing a contradiction that does not exist there, and would really like to hear it from the horse’s mouth <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>All this I guess eventually boils down to the (already mentionned above) excellent <a href="https://www.theerlangelist.com/article/spawn_or_not" rel="noopener nofollow ugc">To spawn, or not to spawn?</a> by <a class="mention" href="/u/sasajuric" rel="nofollow">@sasajuric</a></p>
<p>To frame it in terms of that article, is using a GenServer per DDD aggregate not a pure “thought concern” (red flag reason for using a process to maintain his state) because its role is to serialize access to that aggregate, and thus is a legitimate concurrency unit?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="95706" 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/elixir-enables-stateful-web-applications-is-it-wrong-to-think-like-this/10583/36">Post #35</a>
	                </div>
	            </div>
              <div id="likers-container-95706" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="95706"
                     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="95766" data-post-id="95766">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<blockquote>
<p>Dave Thomas uses one stateful GenServer holding the state of a Hangman game</p>
</blockquote>
<p>In my view it’s an acceptable implementation largely because the state is ephemeral, i.e.:</p>
<ul>
<li>Most of the time “it just works” and you can discard the process when the game is over.</li>
<li>If the process crashes that game is lost but that doesn’t effect any other game that is in progress and the lost process be easily replaced, however it’s previous state can’t be recreated. But in some situations that is a good thing because the state could have been corrupted and caused the crash in the first place.</li>
</ul>
<blockquote>
<p>he seems to see quite a few benefits in doing this in terms of architecture.</p>
</blockquote>
<p>The primary problem would be finding the relevant state if you don’t know where it lives.</p>
<ul>
<li>A PID always includes the node the process lives on, so you’re OK until the process dies.</li>
<li>If the process is named you can always get to it even if it has been replaced.</li>
</ul>
<p>However in most cases it is just simpler to stick with a single node solution. Because the BEAM is so resource efficient you can pack a lot of stuff on a single node. Also keep in mind that multi-node solutions are primarily a reliability measure, i.e. maintaining availablity in the face node hardware failure. Distributing heterogenous task across nodes is possible but not the primary focus of BEAM distribution and can quickly get complicated if you don’t want a single node failure to cripple your system (because that node was the <strong>only</strong> node to provide some critical services).</p>
<blockquote>
<p>it has been suggested that GenServers are a good fit for holding DDD-aggregate type state</p>
</blockquote>
<p>I think the point is that they can be under certain circumstances, i.e. <em>it depends</em>.</p>
<p>Ultimately state is simply data and you will have functions in modules to inspect that data and to create new versions that evolve that data as a result of the sequence of events that the state has been exposed to over time.</p>
<p>That is all you need to represent state because that data can be handed to a function wishing to inspect the current state.</p>
<p>Placing that data inside a process gives it a <em>location or place</em> where the containing process can “evolve” the state while the process itself be contacted by other processes.</p>
<p>I think classifying a process as a container of state is an oversimplification - it makes it sound like the process only serves to maintain state. A process exists to enact a protocol in concert with other processes and the state contained by all the participating  processes serves the protocol (or whatever the protocol is trying to accomplish).</p>
<p>Viewing processes merely as containers of state could easily lead to “ask-style” architectures (<a href="https://pragprog.com/articles/tell-dont-ask" rel="noopener nofollow ugc">Tell, Don’t Ask</a>) which would be far from optimal.</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="95766" 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/elixir-enables-stateful-web-applications-is-it-wrong-to-think-like-this/10583/37">Post #36</a>
	                </div>
	            </div>
              <div id="likers-container-95766" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="95766"
                     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="95925" data-post-id="95925">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Many thanks for taking the time to share your insights.</p>
<aside class="quote no-group quote-modified" data-username="peerreynders" data-post="37" data-topic="10583">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<blockquote>
<p>Dave Thomas uses one stateful GenServer holding the state of a Hangman game</p>
</blockquote>
<p>In my view it’s an acceptable implementation largely because the state is ephemeral, i.e.:</p>
</blockquote>
</aside>
<p>OK, that connects with what I had in mind as well, re. this being time-bound and not having strong persistence requirements .</p>
<aside class="quote no-group quote-modified" data-username="peerreynders" data-post="37" data-topic="10583">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<blockquote>
<p>he seems to see quite a few benefits in doing this in terms of architecture.<br>
The primary problem would be finding the relevant state if you don’t know where it lives.</p>
</blockquote>
</blockquote>
</aside>
<p>Yes, I’ve spent a lot of time during the last years doing distributed-systems related work, and despite the ambient kool-aid my advice to customers is to avoid at all cost doing distribution if they can avoid it. The BEAM is indeed a good tool to stretch what one can do on a single node, and even with Erlang/Elixir I tend to design by default for stateless server farms when horizontal scalability and/or HA and disaster recovery are required.</p>
<p>But that being said, all “stateful process” situations do not create that situation, a good example would be stateful client channels with Phoenix, as already mentionned in this thread.</p>
<aside class="quote no-group quote-modified" data-username="peerreynders" data-post="37" data-topic="10583">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<blockquote>
<p>it has been suggested that GenServers are a good fit for holding DDD-aggregate type state</p>
</blockquote>
<p>I think the point is that they can be under certain circumstances, i.e. <em>it depends</em> .</p>
</blockquote>
</aside>
<p>Haha, yes, of course. This is interesting to get back to the good old “it depends” there, as the stateful vs stateless question tends to trigger some pretty dogmatic point of views if my recent online readings are any indication. No silver bullet etc.</p>
<aside class="quote no-group" data-username="peerreynders" data-post="37" data-topic="10583">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<p>Viewing processes merely as containers of state could easily lead to “ask-style” architectures (<a href="https://pragprog.com/articles/tell-dont-ask" rel="noopener nofollow ugc">Tell, Don’t Ask </a>) which would be far from optimal.</p>
</blockquote>
</aside>
<p>I get the dumb container anti-pattern, and was exposed to the TellDontAsk / LawOfDemeter / OneResponsibilityRule corpus of principles years ago.</p>
<p>However, approching that set of issues from the “Tell, don’t ask” angle when using remote and/or message-passing systems and not strictly in the context of neo-OO (Java, C++) often leads me to some peripheral (to this problem) considerations, close to Steve Vinosky’s stance on RPC.</p>
<p>It’s actually quite funny that you choose to point to Alec Sharp’s take on it and not one of the more commonly linked articles from Martin Fowler or even the c2 pages. He probably talks about it with a Smalltalk-centric vision. Which for me, in an Elixir context makes the idea that CSP / Agents / Erlang processes might be the purest implementation of the Alan Kay vision of objects resurface. Which might seem paradoxical, because as mentionned in the article you linked, the TDA principle often is coined as being a reminder that Objects are bundles of data + functions at their core, which depending on how you read and interpret it might be at odds with Alan Kay’s “The important thing about objects is message-passing”.</p>
<p>Is this just a surface, language-level-trick apparent contradiction in your opinion or is there something more profound at work there?</p>
<p>EDIT: I reread myself and it seems that I was just rambling, feel free to ignore me <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="95925" 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/elixir-enables-stateful-web-applications-is-it-wrong-to-think-like-this/10583/38">Post #37</a>
	                </div>
	            </div>
              <div id="likers-container-95925" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="95925"
                     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="95927" data-post-id="95927">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<aside class="quote no-group" data-username="jxm" data-post="38" data-topic="10583">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/letter_avatar_proxy/v4/letter/j/ee59a6/48.png" class="avatar"> jxm:</div>
<blockquote>
<p>corpus of principles years ago</p>
</blockquote>
</aside>
<p>I came across the <em>idea</em> via <a href="https://www.javaworld.com/article/2073723/core-java/why-getter-and-setter-methods-are-evil.html" rel="noopener nofollow ugc">Why getter and setter methods are evil (2003)</a> - more recently Allen Holub has been going with the “Tell, Don’t Ask” moniker in his OO talks. And most sources seem to ultimately point back to pragprog.</p>
<blockquote>
<p>Steve Vinosky’s stance on RPC.</p>
</blockquote>
<p>I keep quoting <a href="http://steve.vinoski.net/pdf/IEEE-Convenience_Over_Correctness.pdf" rel="noopener nofollow ugc">Convenience over Correctness (2008)</a> hoping somebody will listen.</p>
<blockquote>
<p>interpret it might be at odds with Alan Kay’s “The important thing about objects is message-passing”.</p>
</blockquote>
<p>Alan Kay’s insight is enlightening as it moves focus away from “the mighty object” but it could still be considered myopic.</p>
<p>I’m referring to <a href="https://youtu.be/_fgaPGLGZI0?t=425" rel="noopener nofollow ugc">Protocols</a> as discussed in <a href="https://youtu.be/_fgaPGLGZI0" rel="noopener nofollow ugc">Thinking like an Erlanger</a>.</p>
<p>The software industry got caught up with CASE tools while <a href="http://c2.com/doc/oopsla89/paper.html" rel="noopener nofollow ugc">Class-Responsibility-Collaboration (CRC) Cards (1989)</a> got largely ignored. Lots of attention to Classes (Objects) and Responsibilities but the <em>dynamics</em> of Collaboration - not so much. People focusing on individual trees and ignoring the forest.</p>
<p>PS: Some <a href="https://forum.elixirforum.com/t/process-and-stateness-are-they-object/6342/9" rel="nofollow">further discussion</a> on <a href="https://www.theerlangelist.com/article/spawn_or_not" rel="noopener nofollow ugc">To spawn, or not to spawn?</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="95927" 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/elixir-enables-stateful-web-applications-is-it-wrong-to-think-like-this/10583/39">Post #38</a>
	                </div>
	            </div>
              <div id="likers-container-95927" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="95927"
                     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="95958" data-post-id="95958">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>I guess that we should wrap this up before we get moved to an other thread as being off-topic, even though I feel we’re digging in a direction directly related to the original thread topic <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>
<aside class="quote no-group quote-modified" data-username="peerreynders" data-post="39" data-topic="10583">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<blockquote>
<p>corpus of principles years ago</p>
</blockquote>
<p>I came across the <em>idea</em> via <a href="https://www.javaworld.com/article/2073723/core-java/why-getter-and-setter-methods-are-evil.html" rel="noopener nofollow ugc">Why getter and setter methods are evil (2003)</a> - more recently Allen Holub has been going with the “Tell, Don’t Ask” moniker in his OO talks. And most sources seem to ultimately point back to pragprog.</p>
</blockquote>
</aside>
<p>Well, there is quite a lot of old ideas recycling in all those well-coined modern catchphrases.</p>
<p>I distinctly remember spending a long time thinking about how splitting objects in a system would work to reduce complexity, and how to design interactions between those objects and make sure we don’t fall into the bare-objects trap by ensuring we’re not querying state but exchanging events/messages/commands. This was after reading a pre-UML book by Grady Booch, the one with the plastic tracing ruler included, for drawing model diagrams <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"> And this was probably the early 90’s, I’m quite sure that i.e. Fred Brooks touched on those topics as well with similar conclusions.</p>
<aside class="quote no-group quote-modified" data-username="peerreynders" data-post="39" data-topic="10583">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<blockquote>
<p>Steve Vinosky’s stance on RPC.</p>
</blockquote>
<p>I keep quoting <a href="http://steve.vinoski.net/pdf/IEEE-Convenience_Over_Correctness.pdf" rel="noopener nofollow ugc">Convenience over Correctness (2008) </a> hoping somebody will listen.</p>
</blockquote>
</aside>
<p>And I thank you for that, one of your links prompted me to read that one again a few days ago. A good candidate for my “read once a year” list <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>
<aside class="quote no-group quote-modified" data-username="peerreynders" data-post="39" data-topic="10583">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<blockquote>
<p>interpret it might be at odds with Alan Kay’s “The important thing about objects is message-passing”.</p>
</blockquote>
<p>Alan Kay’s insight is enlightening as it moves focus away from “the mighty object” but it could still be considered myopic.</p>
</blockquote>
</aside>

<aside class="quote no-group" data-username="peerreynders" data-post="39" data-topic="10583">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<p>I’m referring to <a href="https://youtu.be/_fgaPGLGZI0?t=425" rel="noopener nofollow ugc">Protocols</a> as discussed in <a href="https://youtu.be/_fgaPGLGZI0" rel="noopener nofollow ugc">Thinking like an Erlanger </a>.</p>
</blockquote>
</aside>
<p>I did not particularly enjoy that talk, not sure why, maybe because I was already convinced <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"> But I can definitely vouch for the excellent <a href="https://www.springer.com/gp/book/9783540775409" rel="noopener nofollow ugc">Principles of Protocol Design</a> by Robin Sharp. As a consultant I tried to put the message out that thinking in terms of protocol yields many benefits (of course there are tradeoffs, as always), but with little success so far. Either I lack the proper approach / arguments or it’s simply too much of a mind-shift for my target audience.</p>
<aside class="quote no-group" data-username="peerreynders" data-post="39" data-topic="10583">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<p>The software industry got caught up with CASE tools while <a href="http://c2.com/doc/oopsla89/paper.html" rel="noopener nofollow ugc">Class-Responsibility-Collaboration (CRC) Cards (1989)</a> got largely ignored. Lots of attention to Classes (Objects) and Responsibilities but the <em>dynamics</em> of Collaboration - not so much. People focusing on individual trees and ignoring the forest.</p>
</blockquote>
</aside>
<p>Yup. And I fear all the Agile agitation this last decade, even though some of it was based on starting points that made sense, misled a generation of programmers (sorry, “craftsmen” <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"> ) to thinking that they can get away without doing any systems design and just focus on micro-optimization of their individual bricks, with the assumption that adhering to whatever communication method of the day exonerated them from thinking about the actual communication taking place, sometimes optimizing for consistence of call conventions rather than consistence in communications semantics. People coming from manufacturing systems, logistics or in general industrial computing however seem to have been more immute to that than the general public though (totally anecdotical observation, I have no proof of that).</p>
<aside class="quote no-group" data-username="peerreynders" data-post="39" data-topic="10583">
<div class="title">
<div class="quote-controls"></div>
<img alt="" width="24" height="24" src="https://forum.elixirforum.com/user_avatar/forum.elixirforum.com/peerreynders/48/5826_2.png" class="avatar"> peerreynders:</div>
<blockquote>
<p>PS: Some <a href="https://forum.elixirforum.com/t/process-and-stateness-are-they-object/6342/9" rel="nofollow">further discussion</a> on <a href="https://www.theerlangelist.com/article/spawn_or_not" rel="noopener nofollow ugc">To spawn, or not to spawn?</a></p>
</blockquote>
</aside>
<p>Thanks for the heads up, I’ve read the original article but missed the thread on these forums. Will do <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="95958" 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/elixir-enables-stateful-web-applications-is-it-wrong-to-think-like-this/10583/40">Post #39</a>
	                </div>
	            </div>
              <div id="likers-container-95958" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="95958"
                     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="263437" data-post-id="263437">
  <section>
    <div class="post-wrap">


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

	        <div class="thread-main">
	            <div class="post-body" data-turbo="false">
								<p>Is there an update on this topic which addresses the concerns raised in the thread?</p> 
	            </div>

	            <div class="base-line">
	                <div class="thread-counters">
	                    <span class="thread-count count-likes js-likers-trigger" title="Likes" data-post-id="263437" 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/elixir-enables-stateful-web-applications-is-it-wrong-to-think-like-this/10583/41">Post #40</a>
	                </div>
	            </div>
              <div id="likers-container-263437" 
                   class="likers-container"
                   data-first-post="false"
                   data-batch-url="/posts/batch_likers">
                   <div class="likers-placeholder" 
                     data-likers-post-id="263437"
                     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 #40"></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/10583/load_more?page=5">Load more posts (1 remaining)</a>
</div></template></turbo-stream>