
Statically Typed Languages Encourage Bad Code - progo
http://www.python-gazette.com/blog/statically-typed-languages-encourage-bad-code
======
PilotPirx
I don't see the point in this article. quote: "The developer has to figure out
what the return types are for any methods that are called"

The developer has to figure out the return type in Python as well, since
otherwise he wouldn't know, if the returned object provides the method he is
calling on it next.

fido = puppies[0]

If puppies[0] doesn't return a "dog" the following call will fail. At run
time!

Anyway, you can alternatively break up the code in several lines without
creating a temporary variable for each step, if it's only about readability:

string fidos_name = spot.get_puppies()

    
    
                   .puppies[0]
    
                   .get_name()
    
                   .upper() + "!";

------
silentbicycle
If you're making (sweeping!) generalizations about static typing, but don't
even address languages that do it _well_ , it's a rather weak argument. That's
like dismissing dynamic typing as a whole because of bugs caused by string /
number coercion in PHP. (Or dismissing jugglers with two arms because they're
cheating.)

On the other hand, if someone seriously proficient in OCaml were to criticize
static typing (in general, not just implementation details in some given
language), I'd be all ears.

Loud ignorance + linkbait title? Flagged. Python is a fine language, it's too
bad some of its buzz is so ignorant.

~~~
sz
Yep. Haskell is a perfect counterexample (everything is inferred).

~~~
silentbicycle
Haskell has a lot of other quirks, for better and worse. Harrrrrdly perfect,
but not touching that one.

The main point is that modern static typing eliminates those stupid, tedious,
verbose type annotations, _as well as_ the stupid Python "I decided to crash
because calcVaule(input) does not exist, but OMFG how could I have _possibly_
known until I got there" errors.

The article is complaining about the problems that have been thoroughly solved
for decades. Which is totally cool; if you want me, I'll be here in the corner
howling about Nixon and Disco.

------
spooneybarger
To paraphrase Lloyd Bentsen:

I've seen bad code and that isn't bad code.

I prefer dynamic languages, but come on people. A type declaration makes
'good' code 'bad'. I can't even... I mean... really? And this got 4 points so
far? Yes, I'm having a disappointed in the world night otherwise I could
ignore those 4 points. Still... 3 people saw this recently and thought that
was a valid argument.

Sigh.

~~~
silentbicycle
For all we know, those four points on the new feed could be from bored and
drunk/coked up people waiting for more Techcrunch or Apple fanfic. The
intellectual rigor often doesn't kick in until after the single digits.

See the flag button? The glowing, shiny, happy flag button?

~~~
spooneybarger
I see the flag button. I like the flag button. It is my friend. Doesn't mean I
can't occasionally lash out and say 'wtf do I keep having to use this flag
button'. See note about 'disappointed in the world night'.

------
ggchappell
The writer has a good point, but he is also somewhat confused.

His argument is not really about the advantages of _dynamic_ typing, but
rather those of _implicit_ typing, which is a more or less orthogonal concept.

Thus, as others have pointed out, Haskell, with its implicit static typing,
does not have this problem.

Even C++(0x), with the new use of the "auto" keyword, allowing for implicit
static typing, would not have the problem.

And Python, with its implicit dynamic typing, does not either.

But Java, with _explicit_ static typing, does have the problem.

------
gazetteer
There is an inferred point in this post, touched on in the last paragraph:
that this tendency to lump a lot of operations into one line is less about bad
language design and more about lazy programmers. I never stated that
statically typed languages ARE bad, but that they ENCOURAGE (lazy) programmers
to write bad code. A lazy programmer might see that as bad code but not fix it
because he doesn't want to go through the work mentioned in the post. A lazy
programmer may not know the IDE functions that would do the work for him.

