<div dir="ltr"><br><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 6, 2016 at 4:29 AM, Daniel Olegovich Lazarenko <span dir="ltr">&lt;<a href="mailto:danielo@opera.com" target="_blank">danielo@opera.com</a>&gt;</span> wrote:<br><div><br></div><div>..</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>* &quot;take&quot; - a typical name for collections like a blocking queue, heap and some others (usually ordered). If it&#39;s a collection&#39;s method, it&#39;s logically expected to return an item. The key distinction between fred.takeCandy() and say bowl.takeCandy() is that bowl is passive.</div></div></blockquote><div><br></div><div>That doesn&#39;t make sense to me. Why would the object &quot;bowl&quot; be passive, but not &quot;fred&quot;?</div><div><br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>We treat bowl as a passive bag of data, and expect others to take from it.</div></div></blockquote><div><br></div><div>I see. Like an actual bowl in the real world?</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>It&#39;s pretty easy to understand and remember, it makes intention more clear than say &quot;bowl.removeCandy()&quot;.</div></div></blockquote><div><br></div><div>Not to me. When I read or write object-oriented code, I think of it as sending messages of what I want done to the object. I see the object as being an intermediator performing actions on behalf of the caller. Containers and collections are classes that group a set of functions the caller needs done, so it&#39;s more convenient to view them as being a mediator, if you will, for the caller.</div><div><br></div><div>I think trying to map real-world behaviors into object interfaces is trying too hard to mirror the real world. I see it as imposing additional cognitive load on comprehension by requiring me to remember if it&#39;s passive or not. In fact, if it&#39;s passive that would violate the OOP and real-world paradigms: why would I be sending it a message?</div><div><br></div><div>Especially in this day and age of smart appliances and IoT I think it&#39;s more consistent to think of the bowl as a &quot;smart&quot; bowl that responds to my messages. &quot;Give me all the green candy&quot;, &quot;sort candy by size&quot;, etc.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div>Pure OOP style is always the right way when it comes to readability. A good example mentioned by Stroustrup once that it should be sqrt(5), not 5.sqrt().</div></div></blockquote><div><br></div><div>Do you have a link for that? The closest thing I see to that example (<a href="https://isocpp.org/blog/2014/12/myths-2">https://isocpp.org/blog/2014/12/myths-2</a>) is demonstrating the exact opposite, that a non-OOP solution provides better performance by eliminating the dereferencing of a pointer.</div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex"><div dir="ltr"><div></div><div>Naming is fun.</div></div></blockquote><div>  </div><div>Learning how to communicate across cultures of all types is fun. ;-)</div><div><br></div><div><br></div><div>--</div></div><div class="gmail_signature"><div dir="ltr">Alfonso Guerra<div>Founder/CEO</div><div>Apokalypse Software Corp.</div><div>(626) 667-4285</div></div></div>
</div></div>