Is Object Oriented Programming Dead?

Object-Oriented Programming (OOP) Reconsidered

Matthew Tyson
Oct 31 · 8 min read

Here is one of the most read, and celebrated, Medium articles of all time:

Banana Monkey Jungle Problem

The Diamond Problem

Class WheeledVehicle {
}Class Automobile inherits from WheeledVehicle{
function roll() {
}
}Class Scooter inherits from WheeledVehicle {
function roll() {
}
}Class PoweredScooter inherits from Automobile, Scooter{
}

The Fragile Base Class Problem

…Encapsulation

Let’s Look at the Real World

React

class Parent extends React.Component {
render() {
return <div class=”parent”>Parent
<Child></Child>
</div>;
}
}class Child extends React.Component {
render() {
return <div class=”child”>child</div>;
}
}

Angular

class MyModule {} // Declare a module containing Angular assets
@Component({…})
class MyComponent() {}
@Directive({…})
class MyDirective() {}

Vue

@Component
export default MyBtn extends Vue {
count = 0;

handleClick() {
this.count++;
console.log('clicked', this.count);
}
}
Vue.component('my-btn', {
data() {
return {
text: 'Click me',
};
},
methods: {
handleClick() {
console.log('clicked');
},
},
render() {
return (
<button class="btn-primary" @click.prevent="handleClick">
{this.$slots.default}(clicked - {{count}})
</button>
);
},
});

Express

class Routes {
constructor(){
this.foo = 10
}

Root = (req, res, next) => {
res.json({foo: this.foo});
}
}

var routes = new Routes();
app.get('/', routes.Root);
Route.prototype._handles_method = function _handles_method(method) {
if (this.methods._all) {
return true;
}
var name = method.toLowerCase();
if (name === ‘head’ && !this.methods[‘head’]) {
name = ‘get’;
}
return Boolean(this.methods[name]);};

NodeJS

// — uv_ref, uv_unref counts are managed at this layer to avoid needless
// js/c++ boundary crossing. At the javascript layer that should all be
// taken care of.

So, All in All

Making tech choices based on how we feel about something vs. how it performs for a given purpose

Everything in life got its purpose,

find it’s reason,

in every season.



Dark Horse Group, Inc.

JavaScript in Plain English

Learn the web's most important programming language.

Matthew Tyson

Written by

www.darkhorse.tech

JavaScript in Plain English

Learn the web's most important programming language.

Welcome to a place where words matter. On Medium, smart voices and original ideas take center stage - with no ads in sight. Watch
Follow all the topics you care about, and we’ll deliver the best stories for you to your homepage and inbox. Explore
Get unlimited access to the best stories on Medium — and support writers while you’re at it. Just $5/month. Upgrade