DEV Community

Discussion on: OOP a software development mass psychosis

peerreynders profile image

Then why did even React use inheritance?

It didn't

// React 0.14.7 early 2016
var Example = React.createClass({
  render: function () {
    return (
Enter fullscreen mode Exit fullscreen mode

React.createClass(): "Create a component given a specification."

Component Specifications: "When creating a component class by invoking React.createClass(), you should provide a specification object that contains a render method and can optionally contain other lifecycle methods described here."

Clearly the React team wasn't immune to fashion influences as that factory function would have been more appropriately called React.createComponent() especially as for all intents and purposes the component instance's this.props and this.state were owned and managed by React - not the object instance itself as one would expect with standard class-based object orientation.

This style was advocated by Douglas Crockford as class-free object orientation at least as far back as 2008 (JavaScript the Good Parts).

The component specification simply contained what was unique about that particular component.

It was the later alignment with the ES2015 class template for creating objects that brought in extends React.Component.

jwp profile image
John Peters • Edited on

For years this was common dude or are you too new?

class Car extends React.Component {

render() {


Hi, I am a Car!



Thread Thread
lukeshiru profile image
Luke Shiru

That being discouraged nowadays in favor of using functions and hooks.

Thread Thread
peerreynders profile image
peerreynders • Edited on

or are you too new?

Apparently you are "too new" because the React.createClass() factory function was the standard way (2013-05-29) stateful React components were created before React supported the ES2015 class syntax.

At the time a constructor function would have been the standard way of implementing a template for creating objects. That would have supported prototypal inheritance out of the box but there were other inheritance schemes around (combination inheritance, parasitic inheritance and parasitic combination inheritance).

The entire point of class-free object orientation was to get away from inheritance and use composition exclusively.

But the truth is that inside a factory function the React team could do whatever they wanted. ES2015 classes weren't supported until 0.13 (2015-03-10) which finally introduced React.Component (but of course IE never supported ES2015 classes in the first place).

React.createClass() wasn't deprecated until React 16 (2017-09-26) and the factory function was relocated to create-react-class.

James Coplien
"How many of you do object-oriented programming? What language? Java is the only language in which you cannot do object-oriented programming. Huh? Other languages. Smalltalk - no. C# - no. Python - no. No. Any JavaScript programmers here? Here are my object-oriented programmers - they're writing objects - the rest of you are writing classes."

Teaching OO: Putting the Object back into OOD (2003)
"Almost everyone who teaches object orientation uses the class as a fundamental building block. Such an approach misses the central point of object orientation: the objects themselves, and what they portend for flexibility and effective design. This weblog is a case study in teaching object orientation."

Why OO Sucks by Joe Armstrong

Ralph Johnson, Joe Armstrong on the State of OOP (2010)
"He said object oriented languages aren't object oriented. I might think, though I'm not quite sure if I believe this or not, but Erlang might be the only object oriented language because the 3 tenets of object oriented programming are that it's based on message passing, that you have isolation between objects and have polymorphism.

Alan Kay himself wrote this famous thing and said 'The notion of object oriented programming is completely misunderstood. It's not about objects and classes, it's all about messages'. He wrote that and he said that the initial reaction to object oriented programming was to overemphasize the classes and methods and under emphasize the messages and if we talk much more about messages then it would be a lot nicer. The original Smalltalk was always talking about objects and you sent messages to them and they responded by sending messages back."

Thread Thread
jwp profile image
John Peters

The mass psychosis is in the wording of this article and the author's intent to elicit attention. It has no regard for anyone still using OOP and is simply a lie. Why bash OOP when you could have written an article about FP.

Thread Thread
peerreynders profile image
peerreynders • Edited on

Why bash OOP when you could have written an article about FP.

You said it yourself "attention". Look how many comments there already are.

It has no regard for anyone still using OOP and is simply a lie.

Lie is perhaps a strong word but it's a rather biased rehash of previously known limitations. Every paradigm has limitations and it's important to be aware of them and know how to deal with them. To some degree it plays on the one language theme—in a "one paradigm" way.

Otherwise just ignore it.

If for whatever reason I was tied to the C# ecosystem right now I'd be paying more attention to Mark Seeman (Code that fits in your Head)

He's a veteran in the OO space and is simply looking for better solutions to real problems.

(And beyond that Scott Wlaschin.)

Thread Thread
jwp profile image
John Peters

I read Seeman over 25 years ago, he's nothing special. All OOP winds up functional. What? Yes SRP guarantees it. So all your noise shows you are unaware of that.

Thread Thread
peerreynders profile image

After 25 years you should have stopped clinging to SRP by now.

It's a place to start ... not dogma.

With statements like that you are just feeding into the author's argument.

Thread Thread
polterguy profile image
Thomas Hansen Author

The "point" isn't "to win", the point is to find the best argument ...

Thread Thread
jwp profile image
John Peters

Clinging is a word you picked. My word is working. The code style employed everyday I write it, works perfectly. More importantly it's maintainable even years later. Proof? Yes, I have code running world wide every day. I use SRP and Open Closed exclusively. As well as Compositional techniques. If it ain't broke don't fix it right?

BTW the video is ridiculous to me.