Austin:>> Strong typing does not impose discipline, any more than language-enforced formatting imposes discipline (e.g., Python). The people who impose Java and Java-based solutions do not do so because of strong typing (which isn’t necessarily the case anyway), but because of strong marketing and strong-arming. The same applies to C#.
Gavin:> It is often said that Java makes it difficult to write bad code. It sort of forces everyone to use a similar - incredibly dull - style. The string typing definitely imposes some discpline.
Austin: I’m not sure that I agree. IMO, Java hasn’t helped programming discipline at all; it’s only increased the incidence of RSI. The insane package proliferation suggests that, if nothing else. Java does protect you from the sillier C++ errors involving pointers, but the fundamental differentiation between objects and primitive types is nearly as big a pitfall. (I will, at least partially, concede your point on Strings. I find, though, that those who find it an annoyance just use StringBuffers.)
Gavin:> It’s like a seatbelt. Even smart programmers
like this safety sometimes because they don’t trust the self-imposed discipline
of their colleagues.
Austin: That’s what unit tests and code reviews are for. I hold to my basic statement that you canNOT trust the language to impose discipline. I’ve seen C that looks like Pascal (I wrote some when I was first learning C). I have seen Java that looks like bad C++.
Gavin: > In this way, Java’s blandness is a blunt tool for project management. Dumb-arse managers […] then get this mindset that all Java programmers are replaceable because the language is
so “easy”… but I digress.
Austin: True. Of any language, though. Too many non-programmers don’t have clue one about programming effort or skills. I have seen this most often when said managers override a programmer’s estimate.
Gavin:> Like so many comments in this thread about the supposed competitiveness (or
superiority) of Ruby compared to everything else and in every way, your point
about bondage and discipline not actually being related is high on theory but
barely registers with my experience.
Austin: Interesting. It actually ranks very high in my experience – it was not a theoretical for me. I have programmed in Ada and a derivative, PL/SQL. These languages are VERY strongly typed, but I have seen undisciplined code in both of these languages.
Gavin:> The world is not full of smart programmers.
Too true. I’m convinced that there are too many “clever” programmers.
Gavin [re my suggestion on ways to subvert Java’s string typing]:> You could but you don’t. There, with respect, goes that argument. It is more pertinent to point out the absense of type-safety in collections, but even then
things crash (ClassCastException) immediately rather than possibly executing unintentional methods (or method_missing). Type “safety” cannot be discarded:
it is designed so the compiler catches errors, which can be handy in a large project (even if only to remind you of your intention sometimes). It’s just
that the bondage and discipline involved is counter-productive, and we all love Ruby’s point of difference here.
Austin: When doing certain types of distributed programming or even some “plug-in” functionality (a la JDBC), you have to start from reflection. It isn’t as clear or as clean as it could or should be.
Sent from my Treo