Funny you use this example, because using line input is thing from the past. For me it's a "smelling".
I often see people demonstrating their point with line input or regexes, both of which are misused 90% of the time.
I'm convinced that ruby leads to shorter code at equivalent behavior; however I'm far from convinced that size is everything, because of various remarks of Donald Norman in his excellent book "the design of everyday things". For example: "place constraints in the world and not in the head", so if the constraint exists, it should be visible (which doesn't imply java type system, we can imagine something shown by the IDE that would not be code).
Apart from the language war, there is a community war. I don't use many "normal" java tools, because I feel they are dumb. But I feel there is a strong base of low-educated people in the new java-critics community, people that can only count lines, repeat the leader, cannot create new thinking by their own. And this is not new, a few well-intentioned leader get spoiled by dumb masses is common thing everywhere.
But this is tragic, because where java (and C#/.net) represented a progress hover the mainstream C and C++ by using explicit typing and collection the last technology in interpretation and GC in a single product, and removing explicit pointer manipulation, python or ruby are nothing new, they are basically old tech languages, with old tech (if not dumb) interpretation. O'caml and Haskell (and the "new" bunch of logic/functional language like clean, curry etc.) did propose some innovation.
O'caml did propose a new balance for generics and side effects ("weak types"), an interesting GC, some new type systems, Haskell proposed some interesting optimizations (massive rewriting thanks to laziness) a new compromise for mixing laziness and side effects, Concurrent Clean too, with its "unique" types.
The main problem with languages is people, and it has nothing to do with the line count. Because if you count the lines to make your language choice, then you can't criticize your boss when he manages by headcount chopping, when he imposes the new fad of the moment in the project etc. because you entered his system.
In my last job we divided the codebase by 5 without changing the language, we mainly trained people (management and ourselves the "newly hired" included) and removed stuff (because shit does not only come from development). Doing shit is not a language problem, it's a people problem.
A good contrast to make between Java and other languages on over-typing is Java's lack of a way to return multiple items at a time without making a container class.
So, yes, the lack of assignment is part of the problem. But, of course, the duck-typing is half the fun of something like that. I can return anything (of any type) I want in a tuple of any size just by comma delimiting. Java arrays aren't that flexible, and worse, if you use one that holds more than one type (say Integers and Floats), you have to cast them to Object before you drop them in, and you get to cast on the way back out. Lots of type-related overhead to simulate something that should be easy.
Comments
Funny you use this example, because using line input is thing from the past. For me it's a "smelling".
I often see people demonstrating their point with line input or regexes, both of which are misused 90% of the time.
I'm convinced that ruby leads to shorter code at equivalent behavior; however I'm far from convinced that size is everything, because of various remarks of Donald Norman in his excellent book "the design of everyday things". For example: "place constraints in the world and not in the head", so if the constraint exists, it should be visible (which doesn't imply java type system, we can imagine something shown by the IDE that would not be code).
Apart from the language war, there is a community war. I don't use many "normal" java tools, because I feel they are dumb. But I feel there is a strong base of low-educated people in the new java-critics community, people that can only count lines, repeat the leader, cannot create new thinking by their own. And this is not new, a few well-intentioned leader get spoiled by dumb masses is common thing everywhere. But this is tragic, because where java (and C#/.net) represented a progress hover the mainstream C and C++ by using explicit typing and collection the last technology in interpretation and GC in a single product, and removing explicit pointer manipulation, python or ruby are nothing new, they are basically old tech languages, with old tech (if not dumb) interpretation. O'caml and Haskell (and the "new" bunch of logic/functional language like clean, curry etc.) did propose some innovation. O'caml did propose a new balance for generics and side effects ("weak types"), an interesting GC, some new type systems, Haskell proposed some interesting optimizations (massive rewriting thanks to laziness) a new compromise for mixing laziness and side effects, Concurrent Clean too, with its "unique" types.
The main problem with languages is people, and it has nothing to do with the line count. Because if you count the lines to make your language choice, then you can't criticize your boss when he manages by headcount chopping, when he imposes the new fad of the moment in the project etc. because you entered his system.
In my last job we divided the codebase by 5 without changing the language, we mainly trained people (management and ourselves the "newly hired" included) and removed stuff (because shit does not only come from development). Doing shit is not a language problem, it's a people problem.
Can you perhaps suggest a better pair of Java and Ruby programs that would serve as a counterexample?
A good contrast to make between Java and other languages on over-typing is Java's lack of a way to return multiple items at a time without making a container class.
How do other languages do it? I can't actually imagine it, odd as it sounds? You don't mean returning maps, I presume?
def return_three_values "1,2,3".split(',') end a, b, c = return_three_values
Like that?
(For the love of god, how do I get that in a pre tag?)
If you indent something a little,
Ahhh, I tried that, but apparently it doesn't work if you do it on the first line. So here it is, not on the first line.
That's just returning an array, though, which Java could also do. What Java can't do is to assign variables to array values as in your example.
So, yes, the lack of assignment is part of the problem. But, of course, the duck-typing is half the fun of something like that. I can return anything (of any type) I want in a tuple of any size just by comma delimiting. Java arrays aren't that flexible, and worse, if you use one that holds more than one type (say Integers and Floats), you have to cast them to Object before you drop them in, and you get to cast on the way back out. Lots of type-related overhead to simulate something that should be easy.
Agreed, the inflexible arrays are quite annoying, maybe THE most annoying aspect of Java.