1. Advertising
    y u no do it?

    Advertising (learn more)

    Advertise virtually anything here, with CPM banner ads, CPM email ads and CPC contextual links. You can target relevant areas of the site and show ads based on geographical location of the user if you wish.

    Starts at just $1 per CPM or $0.10 per CPC.

Classes, Prototypes and OOP

Discussion in 'JavaScript' started by scu8a, Jan 11, 2020.

  1. #1
    I smell smoke. I'm pretty sure it's coming from my ears. I think I blew a circuit and lost a good 10,000+ neurons or so.

    Before these so-called JavaScript "classes", and "prototypes" and...

    OK...I can't compute why anyone would want to turn a malformed dumpster fire of a scripting language into a pseudo-object-orientated sort of "structure" (using the term loosely, here)... I dunno, fubar thinger?

    First, WHY?

    So if I want to build my custom objects, or instantiations of objects or pseudo-instanciations, or whatever the f*** JavaScript says they are, what do I use? Do I use the prototype? Do I declare classes?

    What's the proper way to do this? It's like I turn my head away for a moment, and before I look back, JavaScript drinks too much CSS and vomits XML all over its <body> and its child window's <head> (poor child window). It's like JavaScript has formed some sort of cancerous growth on top of cancerous growth, and it's still alive. At the same time, it appears to have involuntarily emptied the contents of its bowels. A mean <section> looks to have been dumped out onto the <canvas> causing a huge mess. In a way, you could sort of say that nothing has really changed. The dumpster fire just keeps growing.
     
    Solved! View solution.
    scu8a, Jan 11, 2020 IP
  2. #2
    The sad part is much of what "classes" brings to JS was already possible, just people coming from other languages didn't like the syntax.

    ... and that's the problem with a LOT of the new ECMAScript stuff is that it reeks of people trying to shoe-horn into the language concepts that don't fit, JUST because it makes it work more like whatever language they're already comfortable with like C# or Java. This has only gotten worse with node.js becoming flooded with people from other languages because it's the latest hotness. That will likely be dropped like a hot potato when the next "latest hotness" comes along.

    Those coming into the language from Java, C++, C#, Ruby, etc, etc server-side seem to "want" to use JavaScript, but then piss and moan when it doesn't line up with what they've already learned in other languages. Hence out comes Al Bundy with his horn and a spraycan of canola oil trying to shove a 500 pound cow's hoof into a ladies size 5.

    I mean apart from the syntax difference, what's REALLY different between making a function and function.prototype, and the new "class" structure? It literally feels like the only reason "classes" were added to JS was that people didn't like the existing syntax.

    JavaScript has always been object based, and that's why the new object syntax is nothing more than a pointless redundancy... which of course is why it's popular, pointless redundancies have been the go-to methodology for 80%+ of all web dev language changes of the past decade.

    Much like how arrow functions seem to exist just for the people who go "wah wah, I can't keep track of scope and am too lazy to type the word 'function'"

    But then given the lastest flavors of ECMAScript's raging chodo for callbacks -- one of the most inefficient coding methodologies -- all bets are off on how insane things are going to get. Callbacks are great for event handlers, but doing a "Array.each" for a half-line arrow function when we have a perfectly good "for of" structure? DERP. Even derpier when an iterated for with assignment is still the fastest way to loop things like nodelists.

    Bottom line though, most if not all of these changes exist because people who abandoned other languages for JS via node.js piss and moan about how it doesn't work like the languages they kicked to the curb... but rather than tell them to "adapt or perish" the ECMA has bent over backwards even when it makes little to no sense to add all this junk to satisfy them.

    Seriously, if these folks didn't like how JavaScript worked, why did they all flock to it in the first place? Oh, that's right, mouth-breathers who'll believe almost any propaganda and gravitate towards the latest hotness whether it fits the task at hand or not.
     
    Last edited: Jan 12, 2020
    deathshadow, Jan 12, 2020 IP
    scu8a likes this.
  3. scu8a

    scu8a Greenhorn

    Messages:
    81
    Likes Received:
    20
    Best Answers:
    0
    Trophy Points:
    15
    #3

    Interesting. Thanks for taking the time for sharing your expertise on this, @deathshadow. It appears to me that javascript took the steroids but never bothered to lift the weights. JavaScript should be renamed WFT++
     
    scu8a, Jan 13, 2020 IP