Link Details

Our ESP isn't working very well. Login and vote now.
Link 6477 thumbnail
User 208458 avatar

By zoat
via mindview.net
Published: Nov 09 2006 / 08:38

Many people observe that type checking is a religious discussion best avoided...
  • 13
  • 0
  • 2259
  • 830

Comments

Add your comment
User 198480 avatar

fauigerzigerk replied ago:

1 votes Vote down Vote up Reply

I agree with him on the safety part - you need to test anyway. But where his argument completely falls down is readability. I wonder when was the last time Bruce Eckel had to maintain a code base of any significant size created by someone else. How do you find out what the latent type of an instance variable is? You have to read every single line of code in the entire class. That's how. The standard reply by advocates of dynamic typing is "why do you need to know what the latent type is? Just pass some object and you'll see whether it works or not". But that's not how you learn about the purpose of a code base you don't know.

User 190346 avatar

ilazarte replied ago:

0 votes Vote down Vote up Reply

Classic Architects Syndrome. These days it doesn't seem that the "thought leaders" are actually even coding. "Ohh look, my high level conclusion looks great on paper!" A lot of authors and so-called "Agilists" fall into it this trap...

As someone who *has* maintained a > 100K scripted environment, I can say, comfortably please don't touch my Java code.

User 179375 avatar

Ricky Clarkson replied ago:

0 votes Vote down Vote up Reply

Bruce has an irritating habit of selectively neglecting to mention things he knows about.

In the section called "Flexibility vs. (Perceived) Safety", he really should point out type inference. It's possible to have static typing without extra finger-typing, as Haskell shows.

Let's make a function that squares a number:

square x=x*x

Done. What is the function signature of that? Well, we don't need to write it, but it's inferred, and we can see it:

> :t square
square :: Num a => a -> a

This means that square is a function that takes one value and returns another of the same type, and that the type is some kind of Num.

Add your comment


Html tags not supported. Reply is editable for 5 minutes. Use [code lang="java|ruby|sql|css|xml"][/code] to post code snippets.