<story><title>Why OO Sucks by Joe Armstrong (2000)</title><url>http://www.cs.otago.ac.nz/staffpriv/ok/Joe-Hates-OO.htm</url></story><parent_chain><item><author>vhb</author><text>Well, I disagree with 99% of this... I&amp;#x27;m a guy that started with C, moved to functional programing, added C++, and now do all 3.&lt;p&gt;&amp;gt; Objection 1.  Data structure and functions should not be bound together&lt;p&gt;Well, in my experience, in every almost every code-base (either from functional, or imperative programing), we end up with modules, witch are a set of function taking the same type as a parameter. This is very close to binding the functions and the types...&lt;p&gt;&amp;gt; Objection 2.  Everything has to be an object.&lt;p&gt;I don&amp;#x27;t get the example. The only thing that this show, is the benefits of having a range type built in the language. Then it&amp;#x27;s just type aliases.&lt;p&gt;&amp;quot;There are no associated methods.&amp;quot;, yes, but you will need functions to manipulate those types (just translate one type into another), at the end, it&amp;#x27;s going to a module, which is almost an object.&lt;p&gt;&amp;gt; Objection 3.  In an OOPL data type definitions are spread out all over the place.&lt;p&gt;That&amp;#x27;s true. It also makes thinking about the data layout complex. That&amp;#x27;s why other paradigm have been developed (DOP), on top of OOP. Now you can also think that having those defined together makes dependency management easier.&lt;p&gt;&amp;gt; Objection 4.  Objects have private state.&lt;p&gt;False. Objects &lt;i&gt;can&lt;/i&gt; have a private state. This a problem with mutability, not oriented object programing. You can have non mutable OOP.&lt;p&gt;&amp;gt; Why was OO popular?&lt;p&gt;&amp;gt;&amp;gt; Reason 1. It was thought to be easy to learn.&lt;p&gt;The past 20 years have shown how easy it is. In fact, I actually think it&amp;#x27;s too easy, people rely too much on abstraction, without even trying to understand what&amp;#x27;s going on. I my opinion, it promotes a lazy mindset (This is my biggest criticism about OOP).&lt;p&gt;&amp;gt;&amp;gt; Reason 2. It was thought to make code reuse easier.&lt;p&gt;I would like an evidence that it&amp;#x27;s not.&lt;p&gt;&amp;gt;&amp;gt; Reason 3. It was hyped.&lt;p&gt;True, but that does not make it bad. People tried to hype every technologies... Some stayed, some went away.&lt;p&gt;&amp;gt;&amp;gt; Reason 4. It created a new software industry.&lt;p&gt;How has OOP created a software industry that would not have existed if functional programing had &amp;quot;won the fight&amp;quot;?</text></item></parent_chain><comment><author>endgame</author><text>Upvoted because it&amp;#x27;s well-articulated, even though I disagree.&lt;p&gt;&amp;gt; Well, in my experience, in every almost every code-base (either from functional, or imperative programing), we end up with modules, witch are a set of function taking the same type as a parameter. This is very close to binding the functions and the types...&lt;p&gt;There is a key distinction: If I have two subsystems that use the same data in different ways, I can keep those concerns separate by putting the functions for each concern into a different module. Binding all the functions to the type mixes the concerns together and creates objects with way too much surface area.&lt;p&gt;Also, most OO langs make a big ceremony out of each new type: create the class file, create the test file, blah blah blah. I want types to be cheap so I can make them easily and capture more meaning with less work.</text></comment>
<story><title>Why OO Sucks by Joe Armstrong (2000)</title><url>http://www.cs.otago.ac.nz/staffpriv/ok/Joe-Hates-OO.htm</url></story><parent_chain><item><author>vhb</author><text>Well, I disagree with 99% of this... I&amp;#x27;m a guy that started with C, moved to functional programing, added C++, and now do all 3.&lt;p&gt;&amp;gt; Objection 1.  Data structure and functions should not be bound together&lt;p&gt;Well, in my experience, in every almost every code-base (either from functional, or imperative programing), we end up with modules, witch are a set of function taking the same type as a parameter. This is very close to binding the functions and the types...&lt;p&gt;&amp;gt; Objection 2.  Everything has to be an object.&lt;p&gt;I don&amp;#x27;t get the example. The only thing that this show, is the benefits of having a range type built in the language. Then it&amp;#x27;s just type aliases.&lt;p&gt;&amp;quot;There are no associated methods.&amp;quot;, yes, but you will need functions to manipulate those types (just translate one type into another), at the end, it&amp;#x27;s going to a module, which is almost an object.&lt;p&gt;&amp;gt; Objection 3.  In an OOPL data type definitions are spread out all over the place.&lt;p&gt;That&amp;#x27;s true. It also makes thinking about the data layout complex. That&amp;#x27;s why other paradigm have been developed (DOP), on top of OOP. Now you can also think that having those defined together makes dependency management easier.&lt;p&gt;&amp;gt; Objection 4.  Objects have private state.&lt;p&gt;False. Objects &lt;i&gt;can&lt;/i&gt; have a private state. This a problem with mutability, not oriented object programing. You can have non mutable OOP.&lt;p&gt;&amp;gt; Why was OO popular?&lt;p&gt;&amp;gt;&amp;gt; Reason 1. It was thought to be easy to learn.&lt;p&gt;The past 20 years have shown how easy it is. In fact, I actually think it&amp;#x27;s too easy, people rely too much on abstraction, without even trying to understand what&amp;#x27;s going on. I my opinion, it promotes a lazy mindset (This is my biggest criticism about OOP).&lt;p&gt;&amp;gt;&amp;gt; Reason 2. It was thought to make code reuse easier.&lt;p&gt;I would like an evidence that it&amp;#x27;s not.&lt;p&gt;&amp;gt;&amp;gt; Reason 3. It was hyped.&lt;p&gt;True, but that does not make it bad. People tried to hype every technologies... Some stayed, some went away.&lt;p&gt;&amp;gt;&amp;gt; Reason 4. It created a new software industry.&lt;p&gt;How has OOP created a software industry that would not have existed if functional programing had &amp;quot;won the fight&amp;quot;?</text></item></parent_chain><comment><author>mikekchar</author><text>I pretty much agree with your statements, but I&amp;#x27;d like to take a stab at:&lt;p&gt;&amp;gt;&amp;gt; Reason 2. It was thought to make code reuse easier.
&amp;gt; I would like an evidence that it&amp;#x27;s not.&lt;p&gt;Mainstream OOP approaches achieve better cohesion by coupling data structures to functions.  In the worst case you end up with essentially modules that contain &amp;quot;global variables&amp;quot; local to that module.  In other words the only reason to have your instance variables is to remove the need to pass those variable to the functions as parameters.&lt;p&gt;This hurts the ability to write generic code.  In fact you see this problem all the time in OO code.  You have a base class and a bunch of basically unrelated child classes.  It&amp;#x27;s not so much that the child ISA base, it&amp;#x27;s more that the child ACTS_AS_A base.  But then, you run into all sorts of problems because one child (because it is using very different data structures) requires specialised code.&lt;p&gt;There are ways of getting around this, but often those ways end up encouraging you to implement an alphabet soup of design patterns that interact with each other -- causing more coupling rather than less.  All for the want of a generic function.&lt;p&gt;IMHO OO is actually a poor vehicle for achieving code reuse.  In fact, aiming towards this goal is usually one of the root causes I find in really poor OO designs.  What OO is really good at is separating concerns and building highly cohesive code.  This sometimes comes at the cost of increased coupling which inherently reduces reusability.  I don&amp;#x27;t actually think that&amp;#x27;s a bad thing when used appropriately, but the old school &amp;quot;OO creates reusable code&amp;quot; is just a bad idea IMHO. It&amp;#x27;s the kind of thing that several of us threw out the window in the 90&amp;#x27;s along with large inheritance hierarchies -- nice idea, but didn&amp;#x27;t work out in practice.</text></comment>