<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>nightski</author><text>I didn&amp;#x27;t down-vote you, but in my opinion it&amp;#x27;s not meaningless because it makes it inherently more testable.  Try testing an opaque class without any accessibility into its state.  It is much more difficult.  If it takes in the state, performs an operation, and returns a new version of that state (ideally an immutable copy) then it becomes much easier to test and validate.&lt;p&gt;The reason information hiding is&amp;#x2F;was advocated was for reduced coupling.  But in reality I find that this coupling becomes implicit which is arguably worse.  But this is just my opinion.</text><parent_chain><item><author>woah</author><text>Seems like kind of a meaningless gesture to pass in your own “this” just because you don’t like OOP. If you need a class, why not write it the idiomatic way?</text></item><item><author>amw-zero</author><text>You don’t agree with an idea so it’s silly? Passing around state via variables is no more tedious than the extra syntax for class definitions, constructors, member variable access, extra semantics related to objects, extra keywords related to visibility, etc.&lt;p&gt;You can encapsulate functionality without objects. There is nothing that you can do with an object that you can’t do with a closure, and the closure version will be 1&amp;#x2F;10th the size and have 1&amp;#x2F;10th the semantic programming language elements. That is why you see ‘object-hating’ all over the industry. It hasn’t lived up to its promise.&lt;p&gt;Objects aren’t simpler, inherently. It’s just what you know, today, and you’re unwilling to acknowledge your biases.</text></item><item><author>JoeAltmaier</author><text>Sure, you can build your own object and pass the &amp;#x27;this&amp;#x27; pointer around manually. You could use C for everything, and tediously do everything again that objects do for free.&lt;p&gt;But why?&lt;p&gt;There&amp;#x27;s a lot of object-hating going around. Its silly. Use objects to encapsulate functionality, they are good at that and everybody understands what it means.</text></item><item><author>amw-zero</author><text>None of these situations require an object to do. You can always have a function that takes in an extra ‘state’ argument. You can then do everything you said by passing in the corresponding state values.</text></item><item><author>dataflow</author><text>Counter-point: while in many situations this isn&amp;#x27;t the right approach, it&amp;#x27;s worth recognizing when this &lt;i&gt;is&lt;/i&gt; the right approach, because they can look awfully similar. An example of this is graph searching, e.g. BFS or Dijkstra&amp;#x27;s algorithm. The typical implementation is a function. But if you make Dijkstra a class, with (say) a function to iterate through nodes, it lets you do several things that would be difficult with a function: (a) you can now re-use the same object for computing distances to multiple vertices, which allows incremental search, (b) you can now fork&amp;#x2F;copy the object and continue searching on &lt;i&gt;different&lt;/i&gt; extensions of the original graph, (c) you can now save &amp;amp; restore the searcher state to pause the search &amp;amp; continue it later, (d) you can do multiple searches across one or more graphs &lt;i&gt;in lockstep&lt;/i&gt;. IMHO these are very much &lt;i&gt;not&lt;/i&gt; obvious, and to someone who doesn&amp;#x27;t recognize what&amp;#x27;s going on, a class for something like BFS will look &lt;i&gt;exactly&lt;/i&gt; like an &amp;quot;OO antipattern&amp;quot;, when in reality it&amp;#x27;s actually providing significant additional functionality for more complicated situations.</text></item></parent_chain></comment><story><title>The use of `class` for things that should be simple free functions</title><url>https://quuxplusone.github.io/blog/2020/05/28/oo-antipattern/</url></story>
<instructions>Your goal is to analyze the following comment and estimate how highly it will be upvoted by the Hacker News community.</instructions><comment><author>rashkov</author><text>Maybe I&amp;#x27;m mis-reading it, but it seems that your comment is just a re-statement of what your parent comment is replying to. It’s like,
“Why A”
“Because B”
“But why A?”</text><parent_chain><item><author>woah</author><text>Seems like kind of a meaningless gesture to pass in your own “this” just because you don’t like OOP. If you need a class, why not write it the idiomatic way?</text></item><item><author>amw-zero</author><text>You don’t agree with an idea so it’s silly? Passing around state via variables is no more tedious than the extra syntax for class definitions, constructors, member variable access, extra semantics related to objects, extra keywords related to visibility, etc.&lt;p&gt;You can encapsulate functionality without objects. There is nothing that you can do with an object that you can’t do with a closure, and the closure version will be 1&amp;#x2F;10th the size and have 1&amp;#x2F;10th the semantic programming language elements. That is why you see ‘object-hating’ all over the industry. It hasn’t lived up to its promise.&lt;p&gt;Objects aren’t simpler, inherently. It’s just what you know, today, and you’re unwilling to acknowledge your biases.</text></item><item><author>JoeAltmaier</author><text>Sure, you can build your own object and pass the &amp;#x27;this&amp;#x27; pointer around manually. You could use C for everything, and tediously do everything again that objects do for free.&lt;p&gt;But why?&lt;p&gt;There&amp;#x27;s a lot of object-hating going around. Its silly. Use objects to encapsulate functionality, they are good at that and everybody understands what it means.</text></item><item><author>amw-zero</author><text>None of these situations require an object to do. You can always have a function that takes in an extra ‘state’ argument. You can then do everything you said by passing in the corresponding state values.</text></item><item><author>dataflow</author><text>Counter-point: while in many situations this isn&amp;#x27;t the right approach, it&amp;#x27;s worth recognizing when this &lt;i&gt;is&lt;/i&gt; the right approach, because they can look awfully similar. An example of this is graph searching, e.g. BFS or Dijkstra&amp;#x27;s algorithm. The typical implementation is a function. But if you make Dijkstra a class, with (say) a function to iterate through nodes, it lets you do several things that would be difficult with a function: (a) you can now re-use the same object for computing distances to multiple vertices, which allows incremental search, (b) you can now fork&amp;#x2F;copy the object and continue searching on &lt;i&gt;different&lt;/i&gt; extensions of the original graph, (c) you can now save &amp;amp; restore the searcher state to pause the search &amp;amp; continue it later, (d) you can do multiple searches across one or more graphs &lt;i&gt;in lockstep&lt;/i&gt;. IMHO these are very much &lt;i&gt;not&lt;/i&gt; obvious, and to someone who doesn&amp;#x27;t recognize what&amp;#x27;s going on, a class for something like BFS will look &lt;i&gt;exactly&lt;/i&gt; like an &amp;quot;OO antipattern&amp;quot;, when in reality it&amp;#x27;s actually providing significant additional functionality for more complicated situations.</text></item></parent_chain></comment><story><title>The use of `class` for things that should be simple free functions</title><url>https://quuxplusone.github.io/blog/2020/05/28/oo-antipattern/</url></story>