Coffeehouse Thread

15 posts

JavaScript & C# explained

Back to Forum: Coffeehouse
  • 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?

  • Bas

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

  • 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...

  • 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

  • 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

  • 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
  • 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?

  • 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

  • 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
  • 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
  • cbae

    , magicalclick wrote

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

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

    (lower your volume)

  • 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
  • elmer

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

  • 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.

  • 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.

Comments closed

Comments have been closed since this content was published more than 30 days ago, but if you'd like to continue the conversation, please create a new thread in our Forums, or Contact Us and let us know.