Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #8651
| From | Lew <lewbloch@gmail.com> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: in praise of type checking |
| Date | 2011-10-08 09:35 -0700 |
| Organization | http://groups.google.com |
| Message-ID | <19264117.413.1318091736115.JavaMail.geo-discussion-forums@prib32> (permalink) |
| References | <noiq87l3l9umnl3a74u5jd2c0pnlq21dat@4ax.com> <9f6hhqF717U1@mid.individual.net> <82lu87t4e47t1256r1vh7ich0esreter46@4ax.com> <9fb3m5F79oU1@mid.individual.net> |
Robert Klemme wrote: > Roedy Green wrote: >> Robert Klemme wrote, quoted or indirectly quoted someone who said : >>> I'm surprised you mention the compiler and syntax checker. In my >>> Eclipse changing the return type of a method is a refactoring which will >>> easily change all affected methods in code which is part of the project. >>> Lew's caveats apply of course. >> >> I changed the return type. That meant the caller now had to deal with >> 3 possible values instead of two. There is a no way a refactor can >> handle that. It is called Change Signature in IntelliJ. It is great >> for swapping parms, or changing a type, or adding a new parm. When you >> add a new parm, you still have to visit all the invocations to touch >> up if the default value does not apply. > > Oh, yes! Of course you are right. Shouldn't have posted that late. > Sorry for the noise. > > I find interesting that the debate static vs. dynamic typing comes up > every once in a while. The static typers have the intuition on their > side that with more expressiveness in languages and stricter enforcement > of contracts less errors will happen. The dynamic typers usually refer > errors being caught with tests - which you have to write anyway - even > for programs in statically typed languages. And then the higher > productivity of dynamic languages may actually pay off. Tests find bugs after they happen. The compiler finds bugs before they happen. Tests are optional. A programmer can choose (unwisely) not to write tests; they can't choose to avoid the compiler. Tests can be incomplete; everything gets compiled. You have to write tests; you already have a compiler. In practice, the tests "which you have to write anyway" are often not written. You've worked on projects where the tests are insufficient, yes? As for "the higher productivity of dynamic languages", the facts have not been presented into evidence for that. The question involves fully defining "productivity", which must include maintenance costs else you have not internalized the costs that strongly-typed languages aim to avoid. Case in point - in one Language War of PHP vs. Java for Web applications, a PHP fanboy mentioned that they allowed exception crashes, complete with stack traces, to appear in the browser when the application fubared. Well, no wonder they were more "productive". If I could bring myself to inflict crashes on the user, I'd be far more "productive", too, even in Java. I am *not* arguing against dynamically-typed languages, nor in favor of Java. I am pointing out that any such comparison must account for the consequences and costs of each approach. Next time you have to refactor a million-plus-line software system involving dozens of programmers, think about how type safety and other compile-time checks can or should help, or not, vs. tests and other run-time techniques. Look at the state of tests on that project, and how much they cover or fail to cover. Unfortunately your conclusion flies in the face of published research. (I don't have references handy, sorry.) By all accounts, bugs found (and thus prevented!) at compile time are far, far cheaper than bugs found (and thus not prevented!) in testing, which in turn are far, far cheaper than bugs found in production (surely no one can argue that those were prevented!). This is only about bugs; the cost of maintenance, enhancement and refactoring apply as well. You have to internalize all the costs to fairly compare the approaches. -- Lew
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar
in praise of type checking Roedy Green <see_website@mindprod.com.invalid> - 2011-10-05 23:33 -0700
Re: in praise of type checking Lew <lewbloch@gmail.com> - 2011-10-06 06:43 -0700
Re: in praise of type checking Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-10-06 09:52 -0700
Re: in praise of type checking Roedy Green <see_website@mindprod.com.invalid> - 2011-10-07 12:43 -0700
Re: in praise of type checking Gene Wirchenko <genew@ocis.net> - 2011-10-07 14:57 -0700
Re: in praise of type checking Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-10-07 20:18 -0400
Re: in praise of type checking Robert Klemme <shortcutter@googlemail.com> - 2011-10-06 22:31 +0200
Re: in praise of type checking Roedy Green <see_website@mindprod.com.invalid> - 2011-10-07 12:36 -0700
Re: in praise of type checking Robert Klemme <shortcutter@googlemail.com> - 2011-10-08 16:05 +0200
Re: in praise of type checking Lew <lewbloch@gmail.com> - 2011-10-08 09:35 -0700
Re: in praise of type checking Robert Klemme <shortcutter@googlemail.com> - 2011-10-11 07:48 +0200
Re: in praise of type checking Gene Wirchenko <genew@ocis.net> - 2011-10-11 13:04 -0700
Re: in praise of type checking Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-10-11 17:52 -0300
Re: in praise of type checking Patricia Shanahan <pats@acm.org> - 2011-10-12 01:49 +0100
Re: in praise of type checking Gene Wirchenko <genew@ocis.net> - 2011-10-11 19:12 -0700
Re: in praise of type checking Lew <lewbloch@gmail.com> - 2011-10-11 19:10 -0700
Re: in praise of type checking Eric Sosman <esosman@ieee-dot-org.invalid> - 2011-10-06 20:29 -0400
Re: in praise of type checking Robert Klemme <shortcutter@googlemail.com> - 2011-10-06 23:56 -0700
Re: in praise of type checking Gunter Herrmann <notformail0106@earthlink.net> - 2011-10-07 13:57 -0400
Re: in praise of type checking Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-10-07 07:19 -0300
Re: in praise of type checking Roedy Green <see_website@mindprod.com.invalid> - 2011-10-07 12:39 -0700
Re: in praise of type checking Gene Wirchenko <genew@ocis.net> - 2011-10-07 15:03 -0700
Space probes was Re: in praise of type checking Tom Anderson <twic@urchin.earth.li> - 2011-10-11 19:26 +0100
Re: Space probes was Re: in praise of type checking Leif Roar Moldskred <leifm@dimnakorr.com> - 2011-10-12 01:15 -0500
Re: Space probes was Re: in praise of type checking Travers Naran <tnaran@gmail.com> - 2011-10-12 07:23 -0700
Re: Space probes was Re: in praise of type checking Martin Gregorie <martin@address-in-sig.invalid> - 2011-10-12 20:04 +0000
Re: Space probes was Re: in praise of type checking Gene Wirchenko <genew@ocis.net> - 2011-10-12 13:53 -0700
Re: Space probes was Re: in praise of type checking Leif Roar Moldskred <leifm@dimnakorr.com> - 2011-10-12 16:55 -0500
Re: Space probes was Re: in praise of type checking Gene Wirchenko <genew@ocis.net> - 2011-10-12 15:02 -0700
Re: Space probes was Re: in praise of type checking Leif Roar Moldskred <leifm@dimnakorr.com> - 2011-10-13 00:08 -0500
Re: Space probes was Re: in praise of type checking Arved Sandstrom <asandstrom3minus1@eastlink.ca> - 2011-10-13 07:48 -0300
Re: Space probes was Re: in praise of type checking "John B. Matthews" <nospam@nospam.invalid> - 2011-10-14 07:09 -0400
Re: Space probes was Re: in praise of type checking Martin Gregorie <martin@address-in-sig.invalid> - 2011-10-12 22:03 +0000
Re: Space probes was Re: in praise of type checking Tom Anderson <twic@urchin.earth.li> - 2011-10-14 14:14 +0100
Re: in praise of type checking RedGrittyBrick <RedGrittyBrick@spamweary.invalid> - 2011-10-07 11:50 +0100
Re: in praise of [loosey goosey] type checking) RedGrittyBrick <RedGrittyBrick@spamweary.invalid> - 2011-10-07 12:20 +0100
Re: in praise of type checking Andreas Leitgeb <avl@gamma.logic.tuwien.ac.at> - 2011-10-07 14:00 +0000
csiph-web