Stories
Slash Boxes
Comments

SoylentNews is people

posted by cmn32480 on Tuesday October 11 2016, @12:03PM   Printer-friendly
from the noscript-makes-this-tougher dept.

Depending on who you ask, right now JavaScript is either turning into a modern, reliable language, or a bloated, overly complex dependency hell. Or maybe both?

What's more, there's just so many options: Do you use React or Angular 2? Do you really need Webpack? And what's this month's recommended way of dealing with CSS?

Like you, I spent far too many hours reading about all this, and at the end I still wasn't sure. So I decided to create a survey to see what everybody else thought. It seems like I must've hit a nerve, because I got over 9000 answers in just over two weeks!

Further down in the article, the survey results are listed, though not in an easily scrape-able format. Oddly enough, the site degrades gracefully, and does not require Javascript to be enabled.

http://stateofjs.com/2016/introduction/

-- submitted from IRC


Original Submission

 
This discussion has been archived. No new comments can be posted.
Display Options Threshold/Breakthrough Mark All as Read Mark All as Unread
The Fine Print: The following comments are owned by whoever posted them. We are not responsible for them in any way.
  • (Score: 2) by tibman on Tuesday October 11 2016, @05:29PM

    by tibman (134) Subscriber Badge on Tuesday October 11 2016, @05:29PM (#413014)

    hah, nice jab : ) Only when you need to be explicit about type though. If you don't care, then don't bother with it. Most of the time it doesn't matter. Values you get from html forms or JSON should probably be Number()'d. But "var someValue = 3;" wouldn't need it.
    http://www.w3schools.com/jsref/jsref_number.asp [w3schools.com]

    3+3 //=6
    3+'3' //=33
    3+Number('3') //=6

    --
    SN won't survive on lurkers alone. Write comments.
    Starting Score:    1  point
    Karma-Bonus Modifier   +1  

    Total Score:   2  
  • (Score: 3, Funny) by Snotnose on Tuesday October 11 2016, @05:55PM

    by Snotnose (1623) on Tuesday October 11 2016, @05:55PM (#413028)

    Did you just say that most of the time you don't need to worry about what type a variable is when you use it? Cuz that has to be the single most stupid thing I've heard in years.

    No wonder you like Javascript with this kind of mentality. If I ever interview you for a job I'll escort you right out the door with a firm 'no way in hell'.

    --
    When the dust settled America realized it was saved by a porn star.
    • (Score: 2) by tibman on Tuesday October 11 2016, @06:43PM

      by tibman (134) Subscriber Badge on Tuesday October 11 2016, @06:43PM (#413045)

      Way to get personal about something technical. Right tool for the job, man. We were specifically talking about JS.

      If i'm writing C for some embedded work then i have no choice but to care about types. Every variable is type explicit and it generates compile-time errors if typing is incorrect. If i'm writing php, javascript, or C# then a lot of typing is "magic" and you really don't care. php and JS could have type issues that would only blow up at run-time too. For example in JS, when you want to care about type:

      function(){ var x = 1; var y = 2; return x + y; } //Do you really care what the types are here? Nope.
      function(x){ var y = 2; return x + y; } //Here you should care what types are. x should be validated as a number, at a minimum.

      For the most part though you won't care much about types. Internal state is explicitly managed by the developer. If state changes are coming from the outside like from forms or ajax calls then you'll have to watch/validate the types. For example in JS:

      function(item){var ary = []; ary.push(item);} //adds an item to an array. Can't fail.
      function(ary, item){ary.push(item);} //could result in a null reference exception as ary might be anything and undefined.push() would certainly blow up.
      function(ary, item){if (Array.isArray(ary)) ary.push(item); } //Basic type validation. Can't fail but will silently eats bad calls.

      PS: I never said i liked javascript. I certainly like parts of it though. Mostly i like that so many hate it : P It's like being a software Sith Lord. If you only knew the power of the dark side...

      --
      SN won't survive on lurkers alone. Write comments.
      • (Score: 3, Insightful) by Snotnose on Tuesday October 11 2016, @06:59PM

        by Snotnose (1623) on Tuesday October 11 2016, @06:59PM (#413051)

        If i'm writing php, javascript, or C# then a lot of typing is "magic" and you really don't care.

        See, this is the mentality I'm talking about and why Javascript sucks. I don't care what language I'm in, if I try to add a string and an int I don't want it to silently convert the string to an int and add, or vice versa on a different machine. No, I want to hear "I sorry, I can't do that, Dave".

        I will never intentionally try to combine types, and if I do so it's most definitely a mistake I want to be told about.

        --
        When the dust settled America realized it was saved by a porn star.
        • (Score: 2) by tibman on Tuesday October 11 2016, @07:20PM

          by tibman (134) Subscriber Badge on Tuesday October 11 2016, @07:20PM (#413067)

          I don't think there's anything wrong with your complaint. It's very valid. Especially for people coming from a strongly typed background. But in javascript you cannot say "int x = 3;". The language doesn't permit you. So, you have to be a bit more flexible and cavalier in your thinking/programming for those languages. You can't always choose your language, unfortunately. The good news is that testing frameworks are plentiful in nearly all languages and you can prove run-time functionality in an automatic way.

          C# and PHP are a middle-ground of sorts where you can do either int or var. In C# the compiled results are identical and type-checked at compile-time. Very safe. Dynamic type being the exception but let's ignore it. PHP would only give you run-time type errors, unfortunately. But you can at least be explicit with your typing if you want. C only gets a mention here because we know it is strictly explicitly typed. No idea about python, ruby, or others.

          --
          SN won't survive on lurkers alone. Write comments.
          • (Score: 1, Insightful) by Anonymous Coward on Tuesday October 11 2016, @07:42PM

            by Anonymous Coward on Tuesday October 11 2016, @07:42PM (#413082)

            The point for me is this - you can't produce reliable code without very careful testing. Why go through the hell of C++ syntax when you need to be thorough and careful at the testing point anyway. The weakly-typed cycle of is faster than the strongly-typed cycle of and gets no worse results in terms of reliability. In particular, I get hideously tied up in C++ templates and inheritance syntax whenever I want to write something general/low level. Or I just convert everything to a void*, and then why did I bother using C++ in the first place?

            ps: I never touched javascript, but I have spent many years writing C++ code and python code. I learnt C++ first and then "discovered" python. C++ I do for processing speed, python I do for ease of development.

            • (Score: 0) by Anonymous Coward on Tuesday October 11 2016, @08:12PM

              by Anonymous Coward on Tuesday October 11 2016, @08:12PM (#413094)

              it gobbled my text. Must be javascript?

              > The weakly-typed cycle of is faster than the strongly-typed cycle of and gets no worse results in terms of reliability.

              Should have been

              The weakly-typed cycle of "code" "test" is faster than the strongly-typed cycle of "code" "compile" "test" and gets no worse results in terms of reliability.