4

This question already has an answer here:

Coming from Java, I've never used a language with dynamic typing. I'm very used to the static-typing way of thinking.

My question is, how much does the use of dynamic typing as opposed to static typing influence the overall design of programs written using languages with that kind of typing?

Does the kind of typing (static/dynamic) influence the design of programs significantly? Working with a dynamically-typed language, would you structure your application differently than working with a statically-typed language? Or is it merely a language characteristic that affects mainly local implementation details, but doesn't affect overall designs?

marked as duplicate by gnat, Bart van Ingen Schenau, jwenting, user40980, Kilian Foth May 23 '14 at 12:28

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • Design of programs as in how the various high-level components fit together, or design of programs as in how the various high-level components that make up the program look? – user7043 May 22 '14 at 22:05
  • @delnan Actually I'm referring to both. But mainly the second one, regarding the implementation of high level components. – Aviv Cohn May 22 '14 at 22:06
  • It's a bit hard to judge, because statically typed languages have traditionally had poor or no support for first-class functions (e.g. Java only just now got support for lambda expressions), sum types/tagged unions (you kinda get this for free in dynamic languages), tuples and records (none of C++, Java, or C# have them as far as I know) or syntax sugars like list comprehensions. These sorts of things do matter; you didn't see much functional programming being done in Java before, but passing functions around is no big deal in Python. But none of this is inherent to either type system. – Doval May 22 '14 at 22:14
  • 3
    @Doval What about the numerous functional languages with quite powerful type systems (Haskell for example has everything you mention since 1990)? Of course the functional paradigm has a huge impact independently of the typing discipline, but there are dynamic predominantly-functional languages too, so this would make a nice case study. There might be a shortage of data points regarding large, enterprisey projects though, as FP is historically... less popular. – user7043 May 22 '14 at 22:20
  • 1
    @Doval: Your C# knowledge seems to be a bit dated. C# has had first-class functions (delegates) since the beginning. Tuples are available, as are list comprehensions (Linq). The rest of the things you mentioned can almost certainly be simulated. – Robert Harvey May 22 '14 at 22:35