Coffeehouse Thread

15 posts

Forum Read Only

This forum has been made read only by the site admins. No new threads or comments can be added.

JavaScript & C# explained

Back to Forum: Coffeehouse
  • User profile image
    vesuvius

    How would you explain to a non-programmer what the difference is between a statically typed language like C#, and a dynamic language like JavaScript?

    I was recently asked this question by a very smart technical person, and found that I ended up using words like statically typed and dynamically typed that lacked the clearness to allow the user to understand what the differences are. Why would you use one over the other?

  • User profile image
    Bas

    You'll make mistakes in both, but in a statically typed language the compiler catches more of them for you.

  • User profile image
    Sathyaish Chakravarthy

    I would say: variables in dynamically typed languages are like husbands. They will take anything in their stride. Throw anything at them and they will keep quiet and work with it.

    Variables in statically typed langauges ask a lot of questions before you give them anything. And they still throw errors sometimes even if you make a slight mistake. They're very unforgiving. You know, just like the...

  • User profile image
    Dr Herbie

    , Sathyaish Chakravarthy wrote

    I would say: variables in dynamically typed languages are like husbands. They will take anything in their stride. Throw anything at them and they will keep quiet and work with it.

    Variables in statically typed langauges ask a lot of questions before you give them anything. And they still throw errors sometimes even if you make a slight mistake. They're very unforgiving. You know, just like the...

    ... just like the programmers?

    Herbie

  • User profile image
    Sathyaish Chakravarthy

    Just like the programmers. That's right, Dr. Herbie. It was so obvious I didn't bother completing the sentence. Thanks for the help. Smiley

  • User profile image
    magicalclick

    Var a = 1 + "one"; is ok in Javascript, but, not ok in C#. If you think it is ok, then, use Javascript.

    Leaving WM on 5/2018 if no apps, no dedicated billboards where I drive, no Store name.
    Last modified
  • User profile image
    vesuvius

    , magicalclick wrote

    Var a = 1 + "one"; is ok in Javascript,

    when you use the Var in javascript that has just been consumed, I take it the application blows up at runtime?

  • User profile image
    cbae

    , magicalclick wrote

    Var a = 1 + "one"; is ok in Javascript, but, not ok in C#. If you think it is ok, then, use Javascript.

    Uh, that is OK in C#.

    var a = 1 + "one";Console.WriteLine(a); //1one

  • User profile image
    magicalclick

    @cbae: lol, oops, my bad, I totally get owned.

    Leaving WM on 5/2018 if no apps, no dedicated billboards where I drive, no Store name.
    Last modified
  • User profile image
    magicalclick

    @vesuvius: I am not Javascript expert. But I thought it would never blow up at runtime because it is always valid. Just more like incorrect logic giving you unsatisfying result. Have no idea what this would do, var a = 1 * "one";

    Leaving WM on 5/2018 if no apps, no dedicated billboards where I drive, no Store name.
    Last modified
  • User profile image
    cbae

    , magicalclick wrote

    @cbae: lol, oops, my bad, I am totally get owned.

    http://magicalclick.just.got.owned.aninote.com/

    (lower your volume)

  • User profile image
    magicalclick

    @cbae: lol it actually has a page.

    Leaving WM on 5/2018 if no apps, no dedicated billboards where I drive, no Store name.
    Last modified
  • User profile image
    elmer

    @vesuvius: C#  is a PITA to write, while JScript is a PITA to debug

  • User profile image
    Bass

    Dynamic typed languages tend to utilize duck typing for polymorphism, while static-typed languages use interfaces and class-based taxonomy. In dynamic languages, values are usually typed, in static typed languages, variables are usually typed.

  • User profile image
    Sathyaish Chakravarthy

    Sometimes, all the excitement about JavaScript seems pretentious to me.

    I understand that most of the enthusiasm displayed is conspicuous, learned behavior. In other words, developers pretend to be in love with JavaScript just because they see, hear or read other developers pretend to be in love with it, who pretend because they see, hear or read other developers...you get the idea.

    Reading and debugging JavaScript code is a serious, unremitting pain in the posterior. I don't understand why this alone shouldn't reduce its popularity with developers.

Conversation locked

This conversation has been locked by the site admins. No new comments can be made.