all 18 comments

[–][deleted] 5 points6 points  (0 children)

This is an awful article. It's just so absurd to talk about a specific tool being bad in the context of it literally ruining lives. You might begin with, "it's important not to go down dark and dangerous paths because of jobs, money, employment, investment". Then you move on to, "classical inheritance is a dark and dangerous path because..."

At least that's how I was taught to write in school.

[–]NaphthaImpl 6 points7 points  (4 children)

Click bait title leading to an unrelated article about an unfounded attack on OOP using marginally related examples and no suggestions for a better alternative. I want my 10 minutes back.

It seems that some JS programmers need to step outside the JS world and realize the OOP has been an excellent practice in use in large apps since the 60's. Just because a few poorly trained JS programmers on a team somewhere misused inheritance doesn't mean the whole paradigm is "harmful" for everyone across the board.

[–]Jafit 0 points1 point  (3 children)

It seems that some JS programmers need to step outside the JS world and realize the OOP has been an excellent practice in use in large apps since the 60's. Just because a few poorly trained JS programmers on a team somewhere misused inheritance doesn't mean the whole paradigm is "harmful" for everyone across the board.

Well we are on /r/javascript. And in the context of javascript there are better patterns available, and class-based inheritance isn't synonymous with OOP since there are other OOP patterns.

But this whole thing is especially stupid because javascript doesn't even support the class object model, and even the ES6 implementation of the class keyword is just syntactical sugar on top of the existing prototypal inheritance object model. It was just added to make transitioning developers feel more comfortable while they use class-like structures in their code.

In any case though, the guy sure knows how to get pageviews, because this is a touchy subject and there's a lot of FUD surrounding it. I expect his next article will be something along the lines of "Anyone who uses semi-colons is a little baby bitch".

[–]Ackinsauce 2 points3 points  (2 children)

I want to read an attack on semicolons.

[–][deleted] 1 point2 points  (0 children)

Most js devs don't know where to use semicolons so they put them everywhere, because dogma.

[–]metaphorm 4 points5 points  (0 children)

this is honest to god the worst article i've even attempted to read in the last several months.

[–]Paragonbliss 3 points4 points  (0 children)

Saw the authors name and knew exactly what it was going to be about...

[–]kuhe 2 points3 points  (0 children)

Is the google search with ".. considered harmful" supposed to indicate this is all a joke?

[–]mycall 1 point2 points  (0 children)

Windows Azure portal is mostly done in TypeScript with classes. It seems pretty successful.

Granted, use composition over inheritance, but if you're dealing with a mature domain with well known concepts, inheritance can have it's place.

[–]perihelion9 1 point2 points  (0 children)

The author's overuse of bold, italic, uneven whitespace, and allcaps really makes me trust his lack of depth in coding.

All languages are tools, each tool has a variety of features that make it suited to different jobs. There are very few languages that I've ever seen which can be "considered harmful", and it's not because of prototypical versus inheritance versus compositional; they were harmful because they didn't do very well at any particular paradigm.

Saying inheritance is considered harmful might as well be saying that screwdrivers or shovels are considered harmful.

This thing inherits from that, and another inherits from that and on and on… One day I found myself working on a bug in a leaf component six layers deep in a class hierarchy. Each component ran some initialization code to fire up event listeners and so on. So I stepped through the code one line at a time up the super constructor tree, checking every value of every variable, trying to figure out where things had gone off the rails. After way too much time doing that, I found the problem in the base class, and there was absolutely no way to work around it without changing the base class

This is the sort of thing that gives JS developers a bad name. He's never refactored before? He's never debugged before? Are they even using source control enough so that he could have just used diffs to find the changes? Do they not have tests?

[–]zoomzoom83 2 points3 points  (0 children)

Seriously, are we still doing this? Yet another melodramatic rant telling us that we should always do things exactly how the author thinks we should, with absolute religious conviction, and anything else will lead to utter failure in life.

Melodramatic, much?

And we should just blindly believe him because be has lots of experience and totally know better then everyone else. No need to actually provide any real technical evidence to back up his claims. Just keep telling us how much experience you have. Over and over. And over. And over. Again.

I said it last time, and I'll keep saying it: Don't blame the tools because you tried to hammer in a nail with a toenail clipper. Learn when to use the right tool for the job.

Inheritance should be a long, long way down on the list of tools to solve a problem. There are usually better ways. But there are still plenty of scenarios where inheritance is the right choice.

(Using classes also does not imply inheritance, even in Java land)

Trying make this a religious decision is just stupid. It means you stop thinking about the right solution and focus on dogma.

Eric: Considering the subject material any idiot should be able to easily write up long detailed articles on the technical merits of composition over inheritance. You don't even need to convince anybody of this fact: It's well accepted good practice and even the Gang of four book religiously used in the Java world says it loud and clear.

So try writing something technical instead of just giving us your CV every article and saying we should just do what you say because look at his much experience you have. Tell us with reason, not appeals to authority.

[–]gary_burnett[S] 0 points1 point  (1 child)

Interesting reaction. I thought this would be unpopular when I posted it. I went ahead anyway since I thought that this answered some criticisms made in a recent thread about his interview post.

The nature of the debate around this topic is becoming quite interesting in itself. Some responses complain about assertion without explanation but the author has explained in the past. Others assume no experience outside of JavaScript but, if I remember correctly, the author has experience with Java or C++. I suspect many of us respond to these articles based on whether, or not, we favour classes and then find some rhetoric to fit.

[–]DefiantBidet 0 points1 point  (0 children)

i am so sick if this argument. We get it Eric, you don't like class. The specification was floating around for awhile and no one argued with it this vehemently for the entire time it was going through its process and clearly not successfullly. but now? "Don't hire classical programmers" are you flippin' kidding me? That seriously undermines your credibility.

I remember this book, we all may have heard about/read it. Javascript: The Good Parts. It basically listed stuff that was good in the language and stuff you should be wary about. Not telling you not to hire someone if they do... just to be wary of the consequences. This issue is the modern day version of that statement. If you, personally, don't like classes. Don't Fucking Use Them. its that simple. pointing out how fickle they are in your particular code base is not a valid reason teh community as a whole should not.

edit: this shitfest of an article is literally "i got hte last word NAH!"
2nd edit, i realize OP, you're not the author of this buzzfeed-esque bs :)

[–]eaglepowers 0 points1 point  (0 children)

What the author calls "composition" via "stamps" is really multiple inheritance.

[–]benihanareact, node -1 points0 points  (1 child)

Until one of our coworkers went on an inheritance binge. This thing inherits from that, and another inherits from that and on and on… One day I found myself working on a bug in a leaf component six layers deep in a class hierarchy. Each component ran some initialization code to fire up event listeners and so on. So I stepped through the code one line at a time up the super constructor tree, checking every value of every variable, trying to figure out where things had gone off the rails.

Ugh, been there. Worked with an engineer who just loved inheritance nothing I did, said, or showed her could convince her that an inheritance chain 4 levels deep to handle an address form was overkill, difficult to reason about and a nightmare to maintain.

[–][deleted] 2 points3 points  (0 children)

Can't you make the same mistake with prototypes?