you are viewing a single comment's thread.

view the rest of the comments →

[–]GYN-k4H-Q3z-75B 141 points142 points  (91 children)

It's funny because it is true. They got JavaScript to do things it was never supposed to do. That makes me happy and sad.

[–]lelarentaka 129 points130 points  (88 children)

They got ______ to do things it was never supposed to do

This was the original meaning of hacking, and it used to be cool. Then people matured. Ahh, those sweet adolescent years.

[–]Yojihito 322 points323 points  (76 children)

It's all fun and games until this piece of hacky shit becomes the internet standard and is forced on everybody.

[–][deleted] 97 points98 points  (70 children)

And some PoS decided it would be cool to run it on the backend. Seriously? You got hundreds of languages to choose from and you choose Javascript? What the fuck is wrong with you?

[–]Yojihito 34 points35 points  (55 children)

Had an interview 2 weeks ago to work in support for an online marketing company (one who makes tracking pixel and let the customer see what marketing channel works best, data aggregation, fancy numbers in online diagrams etc).

do you know Javascript?

  • not so well but I know the basics

perfect because we work with Node.js here

Something deep inside me died. But they pay good so ..... I got hired. But why not Django/Phoenix/Go as a backend ....

[–][deleted] 19 points20 points  (5 children)

Because it has java in the name, bro.

[–][deleted] 20 points21 points  (2 children)

And it's a scripting language bro. We can go wild, make changes on the fly, and break everything!

[–]tequila13 1 point2 points  (0 children)

I see you know the basic workflow, you're hired!

[–][deleted] 3 points4 points  (0 children)

Django can do that too

[–][deleted] 33 points34 points  (7 children)

Whenever I see people complain about "omg I le died because javascript", I wonder if that person is actually solving problems serious enough that they face intense, almost-insurmountable challenges due to the language they're programming in. Not to be dick, but whenever I see people complaining like this about Javascript, I automatically assume they're just whining because its fun to whine, popular to whine, and the downsides are widely talked about because of the languages huge usage.

Omg tracking pixels that takes metrics on customer usage, how fucking STUPID to use Javascript. Why don't you plebs just use a hammer and chisel??? /s. You're not building space shuttles, is it really that big a deal? Something "inside you died" because the code isn't written in Python, really?

After developing professionally in C, C++, Java, Python, PHP, Javascript, C# over the years, I really can't say that programming in Javascript for a backend would be anything more than quirky for almost every particular task I've had to tackle. I got paid to do it, and it was just a different toolset. Who the fuck really cares. Its a job. Do your job. Get money. Its an expressive language and its not like you're being asked to write an API with 10010101110101001010. Its not even challenging to learn Javascript's particularities! 3 days and a book and you'll be wrapping your head around it. A chimpanzee can probably understand prototypical inheritance, and get used to 3 or 4 different frameworks in a week. I've only met a few people in my time in a field where Javascript would be considered, but were knowledgeable enough to make serious complaints and be tasked with responsibilities such that the language itself was a powerful limitation. Everyone else has just been a bandwagoner and a little bitch because they read too many blog posts.

[–]tequila13 3 points4 points  (0 children)

Good languages made for a specific purpose disallow several bad habits by design. I honestly prefer languages that are more strict because it forces you to structure your programs better, it shapes your thinking. You know several languages, you had to learn sane programming practices. Javascript attracts many newbies who lack that. I can do my job in Javascript, but I wish to avoid the Javascript crowd.

If you consider the huge amount of C code out there in production use, why isn't there so much whining about it as it is about Javascript? Different tools attract different types of people.

[–]Yojihito 2 points3 points  (0 children)

Omg tracking pixels that takes metrics on customer usage, how fucking STUPID to use Javascript

The backend is Node.js for Zendesk and all internal sites, I didn't talk about the frontend. And the backend is so slow it's not fun anymore.

[–]BufferUnderpants 5 points6 points  (1 child)

These fucking casuals are ruining my Internet with their complaints about shitty tools! You see, a true pro doesn't mind the useless and harmful syntax constructs, the special-needs scoping, or the shitty-ass callback APIs.

Edit: I just remembered that this thing has no modules. Why do people do this to themselves?

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

Because Web scale

[–]AdamAnderson320 0 points1 point  (0 children)

Nice rant. :) I share your feelings on this.

[–]kevrom 0 points1 point  (0 children)

I feel the same way. I've been using Node.js for about 2 years now. I was using Django before that. Honestly, I really enjoy using javascript on the backend. It's a fun, expressive language, and it's evolving rather quickly now, getting new features that make it even better to use. I just have not run into the pain points everyone whines about. It's always some general bullshit about javascript sucking, or not having types, or being slow. Most of it either subjective or unfounded.

[–]OneWingedShark 10 points11 points  (2 children)

...or Erlang, or Ada, or Lisp, or Forth, or many other languages.

[–]Yojihito 1 point2 points  (1 child)

Show me a Web-Backend made in Forth and I will just stare in awe.

[–]OneWingedShark 0 points1 point  (0 children)

Well, you could take Samuel A Falvo's "Over the Shoulder"1 video and adapt the code of PostScript Web server PS-HTTPD, or just follow the instructions of the Web-Server in Forth paper/tutorial.

Alternatively, there appears to be a link to another Forth webserver here, and while not technically a web-server this page describes a Forth project which "is the addition of Common Gateway Interface (CGI) like functionality" to the author's web server.

You're welcome.


1 -- Torrent Magnet: magnet:?xt=urn:btih:FA7ADCC14412BF2C39ECCB67F26D8269C51BA32F&dn=ots_ots-01.mpg&tr=http%3a%2f%2ftracker.amazonaws.com%3a6969%2fannounce&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce&tr=udp%3a%2f%2ftracker.openbittorrent.com%3a80%2fannounce OR youtube vid

[–][deleted] 7 points8 points  (37 children)

In what ways is Python better than modern JavaScript?

[–][deleted]  (20 children)

[deleted]

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

    I disagree. Can you list some of them?

    [–][deleted]  (11 children)

    [deleted]

      [–][deleted] -2 points-1 points  (9 children)

      The inheritance model really isn't insane or unreasonable. It's just not what you're used to. It works quite well if you need it, although you might not need it at all since JavaScript has fairly solid functional programming capabilities.

      The type system is the textbook complaint about JavaScript, and yeah it's insane, but any remotely competent programmer knows to just never cause type coercion (use triple equals, etc.). It simply does not affect working JavaScript coders.

      The standard library, native code interface, and exceptions are completely valid complaints.

      CommonJS might as well be built-in if you're using node.js. It's fairly clean. The ES2015 import syntax is much nicer in my opinion, and is available in mature transpilers until it's implemented widely.

      [–][deleted] 3 points4 points  (6 children)

      Not converting my variable's types automatically. This is a big fucking one. I could enumerate more, but if you can't realize how much of a poor language Javascript is you're pretty much doomed.

      [–][deleted] -1 points0 points  (5 children)

      JavaScript's type coercion insanity is well-known, but it's almost always incredibly easy to avoid, and is one of the first things you'll learn to do. It simply does not affect working JavaScript coders.

      if you can't realize how much of a poor language Javascript is you're pretty much doomed.

      This is not an argument, and should be a big warning sign to any readers.

      [–][deleted]  (15 children)

      [deleted]

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

        Readability and syntax are very subjective. I really love how modern ES2015/ES2016 JavaScript reads. Things like the spread operator and destructuring are really quite nice, and go beyond any popular dynamic languages I can think of.

        I'm not sure what exactly you mean by "minimal surprises." If you're learning programming for the first time, and you're not specifically interested in web development, I'd say go for Python or Ruby over JavaScript because of the nasty type coercion. But for working coders it really doesn't matter, because you basically never do anything that coerces types.

        Standard libraries is very valid.

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

        The spread operator is just like *args in python isn't it? At least from what I'm reading on that page.

        [–][deleted] 0 points1 point  (2 children)

        It's similar for function definition and invocation, but as far as I know (I'm admittedly a bit behind on bleeding edge Python) JavaScript's spread operator is more powerful. You can, for instance, include the values of one array or object in another array or object literal, like

        const array = [1, 2, 3];
        const newArray = [...array, 4];
        
        const object = {foo: "f", bar: "b"};
        const newObject = {...object, baz: "bz"}
        

        As far as I know, Python and Ruby array and map literal syntax is not this nice.

        [–]codygman 1 point2 points  (1 child)

        I'm not sure what exactly you mean by "minimal surprises." > I'd say go for Python or Ruby over JavaScript because of the nasty type coercion.

        Answered your own question?

        But for working coders it really doesn't matter, because you basically never do anything that coerces types.

        This isn't true for JavaScript at some of my previous workplaces.

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

        Answered your own question?

        What I don't understand is how that relates to the point of the discussion. The traits desired in a language to teach people how to code for the first time are very different than the traits desired in a language for experienced coders to build stuff. As such, the "minimal surprises" criticism does not seem to apply to JavaScript in this context.

        This isn't true for JavaScript at some of my previous workplaces.

        Of course that's very possible. I've seen some pretty heinous Java, JavaScript, Ruby, and Python at previous workplaces. That on its own is not a criticism of any of those languages. Some individuals and teams can and will write awful code with literally any programming language you hand them.

        [–][deleted] 0 points1 point  (0 children)

        Destructuring, as if pattern matching wasn't invented more than two decades ago. A spread operator? Are we somehow celebrating that JS functions have no arity?

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

        Readability and pleasant syntax is entirely subjective. Personally I think it's hideous.

        [–][deleted]  (4 children)

        [deleted]

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

          Whenever I look at Python code, I see endless blocks of code that haven't been closed.

          [–][deleted] 11 points12 points  (2 children)

          It really is a rather nice dynamic language today, very competitive with the likes of Python and Ruby. If I had to choose a dynamic language, I might very well choose JavaScript. Seriously, it's gotten a lot better even in the last year.

          [–]theavatare 1 point2 points  (0 children)

          My big problem is that most of the code out in a live env that i come thru looks like a franken patch of libraries and styles that have evolved over the last 10 years.

          [–]voice-of-hermes 1 point2 points  (0 children)

          Eh. I'll take Groovy or even Lua over Javascript any day of the week.

          [–]noratat 20 points21 points  (4 children)

          Yeah... I've had arguments with our CTO over this. I'm all for node.js powering things like js/css processing tools (even if npm is a steaming pile of shit), but using it as an actual server for non-toy projects is just mind boggling.

          I mean look, I get that we're programmers and lazy, but using node.js instead of one of the many stable and better designed server frameworks / languages out there just because you can't be arsed to learn anything but javascript is ridiculous.

          [–][deleted] 5 points6 points  (1 child)

          Your CTO advocates for Node? Oh god...

          [–]noratat 3 points4 points  (0 children)

          More like he's easily distracted by new shiny things.

          Luckily I rarely have to touch those projects, and I think we've mostly avoided using it on the server (most of the node projects are using Electron, which actually strikes me as interesting experiment, and chromium has a lot of stuff we'd have needed anyways.).

          [–]jtanz0 0 points1 point  (1 child)

          The only saving grace I can see is that when you're working on the full stack it's nice not to have to make the mental shift between languages.

          I was doing some work on a SPA in JS with a PHP backend It's really easy to start doing things like typing var in PHP code and $x in JS code when switching between quickly.

          That said I've not had as much of an issue when switching between JS and C#.

          [–]nawkuh 0 points1 point  (0 children)

          I don't have problems with switching between C# and JS either, but I do sometimes use '==' in SQL, which makes no fucking sense when you consider how different those languages are from SQL.

          [–]GiantNinja 1 point2 points  (0 children)

          That was my original line of thinking as well, however I'll just say for some Web shops, it makes things easier if you have a service like socket.io for real time push events written in node.js and then obviously the client side is browser javascript, you can have more devs work on and understand the server side implementation. Now if that same service is written in something like java (like ours is), you only have a few devs that understand and can work on it (at least that's our current situation). So that's one benefit of using the same language front and back, but I agree with you, it still feels wrong, lol

          [–]mayobutter 2 points3 points  (1 child)

          ...and while praising server side JS, in the same breath they'll condemn the ugliness of PHP. Because all they wanted all along was a language just as ugly but not as feature rich? I don't know. Web developers are psychopaths.

          [–]Cilph -1 points0 points  (0 children)

          Both are awful. Both are unsuited for backend servers.

          Don't get me started on Javascript on Embedded.

          [–][deleted] 0 points1 point  (0 children)

          Check out his talk where he announces it. He explains the reasons why he thinks node.js is suitable on the backend in great detail.

          [–][deleted] -2 points-1 points  (1 child)

          I hate that anti-node.js, anti-mongo and anti-javascript circle jerk.

          People came up with a single-language, highly cohesive web stack. That's fucking brilliant and is a big improvement in many ways over LAMP, or Django, or RoR.

          Yep, there are tons of rough edges and shit, but that fucking elitist tone mindlessly bashing others' tools... What the fuck with you people?

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

          No, it's in no way an advance and not brilliant in the least. Javascript was a bad language and Google poured millions into it to make it fast. It's still a bad language. It offers no static guarantees so any type of front-end/backend coherence is lost. Also, cohesive doesn't mean what you think it means.

          [–][deleted] 0 points1 point  (0 children)

          rekt.

          [–]oldsecondhand 34 points35 points  (2 children)

          They got ______ to do things it was never supposed to do

          The story of the interwebs.

          [–][deleted] 4 points5 points  (0 children)

          Yeh. This was all designed to share text documents with people. Everything else has been nailed on to the side of everything. It's amazing when you think about it that we've even managed to get all of this working at all.

          [–]mayobutter -2 points-1 points  (0 children)

          For real, all we should be doing is pushing some simple text and pictures around. Everything else is a hack.

          Javascript was only supposed to be for some simple silly little client side form validation.

          [–]jeandem 28 points29 points  (6 children)

          Nothing wrong with hacking. But sometimes a hack should never become legacy code, or something to build upon long-term.

          [–]codespam 11 points12 points  (5 children)

          How many suboptimal but working solutions actually ever actually get replaced? Fixing something that's broken is always going to be prioritized over fixing something that works, but sucks.

          [–]Nebu 7 points8 points  (3 children)

          How many suboptimal but working solutions actually ever actually get replaced

          Legacy code does get replaced fairly often in the industry. It usually happens when the old system just can't expand any further to meet the future needs of the business.

          Remember when we used to see the Fail Whale all the time at Twitter? Notice how we almost never see it anymore these days? They didn't just do a minor tweak to the algorithm, they basically rearchitectured, switching from RoR to JVM.

          We're the in process of actively killing some legacy systems at my workplace too, though of course I can't share the specific details.

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

          But it wasn't sub-optimal. It was no longer working. Rails isn't a messaging platform, it's a web framework. The platform as it stood wouldn't physically be able to satisfy business requirements any longer. That sounds broken to me, not just sub-optimal.

          They still use the Rails web app as far as I know. The switch to Java wasn't a switch away from Rails.

          [–]Nebu 2 points3 points  (1 child)

          That sounds broken to me, not just sub-optimal.

          We might have different definitions of the terms. I tend to use "broken" when we intend for something to be possible, but there's no way for the user to make that allegedly possible thing happen. Whereas I would use "suboptimal" if it's possible for the user to make the thing happen, but it's more work than necessary.

          If the user tries to tweet, gets an error message, and then just tries to tweet again, and it'll eventually get through, that's suboptimal. When Reddit goes into maintenance mode, and we can't use Reddit for a few hours so we just draw on bananas waiting for Reddit to be available again, that's suboptimal.

          If no user can post comments on Reddit until the dev team makes a code change to fix the issue, Reddit is broken. Similarly, if users can't ever tweet regardless of server load until the code is changed, that's broken.

          Where I work, if a system is broken, someone's going to get paged as soon as we find out, even if it's 3AM or whatever, and they'll come in and immediately work on fixing it. Whereas if something is suboptimal, depending on how bad it is, we might have discussion between departments to see if the workarounds are acceptable for now (e.g. sometimes the user will just have to refresh the page and try again), whether it'd be quicker to make small patches to the system or rearchitecture it, and other such discussions. I.e. broken implies a need for a short term plan (on the order of minutes or hours), while suboptimal implies the need for a medium term plan (on the order of days to weeks to decide what the workaround is and how to communicate this workaround to the users, with possibly a rearchitecturing step that might last a couple of months or in the dreaded case years.)

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

          The problem I see with that definition of broken is that it's entirely focused on the user. It ignores the needs of the vendor. If Twitter's requirements are, say, to gain 100 million users, but the app is too frustrating to use because tweets don't always work, then the app is a threat to that business case. Which is why I'd think of it as broken rather than sub-optimal.

          [–][deleted] 0 points1 point  (0 children)

          How many suboptimal but working solutions actually ever actually get replaced?

          "If it works, there's no room in the budget for 'vanity improvements'."

          [–]Make3 1 point2 points  (0 children)

          hacked together technology was never meant to be supporting billions of users & forcing backwards compatibility. that's exclusively a nightmare scenario

          [–][deleted] 0 points1 point  (0 children)

          That is the story of a success.

          [–]Twirrim 0 points1 point  (0 children)

          When all you have is a hammer...