-1

While I like benefits of strong typing system, there is one thing that worries me the most. I think of strong type system as means of forcing design choices. If a team builds a system unaware of its poor design, types will only reflect bad design choices.

For example, a programmer often finds he needs to access (hopefully only read) a variable not declared in type of the function. This function may be used in many places where this constraint was implicit and fine. A signature change triggers a snowball effect. Change escalates until it hits main method or close to it. On top of that, we create a problem of compatibility and even merging becomes an issue.

In an impure (or object oriented) context, programmer will find his way to capture this variable. And I agree none of them will be pretty. But he can make progress without breaking stuff (most of the time). It's a form of technical debt, but people will (often rightfully) argue that it's beneficial to the project.

Has anyone experienced this kind of issues?

closed as primarily opinion-based by gnat, Scant Roger, user40980, GlenH7, Ixrec Jan 10 '16 at 12:10

Many good questions generate some degree of opinion based on expert experience, but answers to this question will tend to be almost entirely based on opinions, rather than facts, references, or specific expertise. If this question can be reworded to fit the rules in the help center, please edit the question.

  • 3
    By "this kind of issues", are you referring to the problem that the programmer can get away with using a global variable in impure languages, or the "problem" that the programmer doesn't have the option of using a global variable in pure languages? – Ixrec Jan 9 '16 at 13:32
  • ask Cy D. Fect of SICP – gnat Jan 9 '16 at 13:37
  • 1
    Hi, please check what is on-topic here and maybe this post about subjective questions. – Benni Jan 9 '16 at 18:39
  • Strong typing doesn't force design choices, it forces correct code. – gardenhead Jan 10 '16 at 3:14
  • The interesting thing I've found about strongly typed, pure functional programming is it causes this kind of pain much, much earlier. This might sound like a bad thing, but really it helps you catch the bad design before it's baked in. – Karl Bielefeldt Apr 7 '16 at 18:56
6

First of all, pure functional programming does not necessarily require static typing. Pure programs can be written quite easily in Lisp, and there are other languages that are specifically designed to support pure dynamic programming.

Also, the kind of hack you're talking about in order to gain access to resources that are not explicit in the type of an object are the kind of techniques that lead to programs that are impossible to change because they are too highly coupled. They are the very antithesis of agility. To keep software agile, one needs explicit dependencies so that changes can be made safely.

A common approach is the use of dependency injection, a technique which can be performed with functional languages as well as object oriented.

Not the answer you're looking for? Browse other questions tagged or ask your own question.