I think that's a symptom of bad design than a problem with the language. The language doesn't force you to create abstractions on top of abstractions and it is not necessary. Having method calls like that is a bad code-smell.
Java does have a verbosity problem and some of it being addressed in Java 8 with lambdas.
> The resulting code is massive walls of text. 90% of that is machine generated through eclipse. This is an indication that the language idioms are unable to support the current complexities in application programming trends. And you have to interplay with them heavily to squeeze out usable programming logic.
I have never had to autogenerate code. I use IntelliJ and it doesn't generate walls of text. It does autogenerate some stuff if you want it to, but those are usually just stubs.
> That doesn't end there. Perl is older than Java, yet despite that I see Perl can support a lot of idioms far far better than Java can with its bulky frameworks.
Well, Perl is strongly typed and has a rich (and ambiguous) grammar. I don't think it's a fair comparison with Java. Furthermore, Perl has a bunch of other issues. I love Perl, but I wouldn't really think about writing a huge application in Perl; it's usually a maintenance nightmare if you don't have a shop of disciplined Perl-coders.
> The only reason to use Java these days is basically availability of super low cost devs, Legacy code, tooling etc. Basically for reasons as with any tool that has an advantage with age.
Not really. You can build lots of full-featured webapps with Java and there are a lot of new applications that use Java.
What I think is happening more and more though, is that the JVM is turning into a platform and there are numerous languages that run on it. What Java has going for it is its rich ecosystem via core APIs and numerous third-party libraries. You have access to all of this if your language runs on the JVM. For example, Nashorn (the replacement for Rhino) has access to the standard API, as do languages like Jython and JRuby which also run on the JVM.
The culture of it does. When all of the code around you is objects-as-design-pattern bad-abstraction slop, you're going to think that's the right way to do it. Which for a certain value of "right" it may be, but it still sucks. You can write "good" Java, but it's still going to be more expansive and harder to read than good C# (which aggressively trims back Java design pattern crap) or good Scala (which goes way, way further).
> that the JVM is turning into a platform
Agreed, and this will save it, but Java's not helping itself at all.
There is no "Culture of Java" that forces you to write over-abstracted code, and it's not really that much harder to write good code in Java. Java is a tool. Sure, it has flaws, but they're not so bad that they force you to write really bad code. With Java I've never felt forced to overarchitect anything just to get it to work. Of course, I have often felt constrained by the lack of expressiveness in the language, but a lot of that will be fixed in Java 8.
True, but I don't see it as a problem (for me).
> The verbosity of the code is mind boggling.
I don't find Java that verbose (especially with lambda functions in Java 8).
> method calls are 4 - 6 layers deep
I don't understand, do you mean nested method calls?
> 90% of that is machine generated through eclipse.
Definitely not 90% and lot of the generated code would have to be written manually in languages like Python.
> The only reason to use Java these days is ...
Libraries, tools, speed, multiplatformity. Also, Java is a pretty good language by itself. It lacks in many ways, but for a LOT of projects, it's a great choice. What language would you suggest as a Java alternative?
> super low cost devs
Java devs are among the most expensive.
Honestly: use something better for a while and come back and say that. Java is verbose. There is a ton of ceremony around anything in it, from ill-considered defaults that require lots of specification (see Scala's remarkable ability to strip bullshit out of its equivalent to Java code) to the cultural design-pattern mess.
It's a lowest-common-denominator programming language, and it shows because it takes such pains to spell everything out every time. JDK8 lambdas sort-of help, but the language is still fat.
> I don't understand, do you mean nested method calls?
I think that's pretty straightforward and that these two go together.. You basically have to use an IDE (and while I am comfortable in an IDE this is a negative in the general case due to the complexity it implies) because you need go-to-definition all the time due to what is, frankly, class and method bloat. This method hands off to this manager class method which hands off to this class that exists just as a temporary stateful container and all of them add more boilerplate and force you to maintain more mental state and blurgh. I was guilty of it as a younger programmer, but I've aggressively tried to move away from that; some people don't seem to ever grow out of it.
> What language would you suggest as a Java alternative?
Scala. I'm a former Java web dev, current Android developer, and if I could shoot all my Java code between the eyes and replace it tomorrow with Scala I'd be a happy man. It's a language that aggressively attacks the idea of design patterns by making the language more expressive (whereas Java just codifies them).
My new projects are exclusively Scala, and I'm turning out better, more readable code in shorter time. The JVM is fine, but Java-the-language and Java-the-culture are toxic as hell. And while it's no doubt harder to hire Scala programmers, the floor on quality is going to be a lot higher than Java programmers when I need to hire them.
While it may have become cultural, the design-pattern mess is directly related to the limitations of Java the language when applied in its typical domains of application. The reason many languages whose features evolved in light of the Java design pattern mess don't share that mess isn't purely cultural, it is because the features of those languages were designed specifically (often drawing from older languages that didn't have the same problems as Java but which weren't popular in Java's role for other reasons) to overcome the limitations that require those patterns in Java; this is perhaps nowhere as obviously the case as it is with Scala.
Totally agreed, I definitely elided some stuff there. They definitely exist to get around limitations in Java's expressiveness, and I cringe every time I end up writing them (day job is Android, and Scala there is iffy at best).
I've written code in about 20 different languages.
What language features / lack of features do you think make Java verbose?
I found Scala complex and ugly (and I'm not alone), much slower to compile than Java and Java has better tooling.
- Lack of even halfassedly reified generics means you're throwing Class objects around everywhere for no good reason. (Scala adds manifests as implicit parameters and it's not as good as .NET but it's a hell of a lot better than Java.)
- Actually, let's just go with "the type system in general". For being built upon the same shitty tools as Java, they do a lot to provide an environment where thinking about types isn't prohibited.
- Inner classes being used for nontrivial things (see also: all of Android, saved only by AndroidAnnotations; all of Swing, saved only by never having to use it).
- No comprehensions. Nuff said.
- Null by default. Option types are both safer and easier to work with functionally than imperative null boilerplate.
- Nonfunctional control constructs. For example, 'if' being a functional construct makes tons of code simpler and easier to read.
- No default parameters. Dumb. Whenever they get them I'm sure it will be something less expressive than Scala's (something like "must be resolvable at compile-time") because doing otherwise will be hard.
- Braces everywheeeeere. The ability to go "def foo() = someFunc(localVar)" is awesome. Less bullshit, more code.
- Interfaces suck when traits exist. The idea that I need to write wireup code when I have getBar and getBars methods (because any sane person will implement getBar as a hat on top of getBars with a singleton list) is utterly stupid.
- Nonfunctional core APIs (where's my map/filter/fold?) that think mutability is a good thing. Guava tries to help, but it's bolting onto a fairly stupid List/Iterable core pattern.
- Reference-reseating-by-default means doing it right adds foolish 'final' keywords everywhere.
- Private visibility (or, to be specific, not-really-private, WTF?) by default means you will be splattering 'public' everywhere, too. This and the last two combine to make objects full of weird action just for funsies; if everything's immutable by default, the cases where you need 'private' to not blow up the world shrink immensely.
- Keywords and methods where operators make sense. List.add() is derpy. "T extends SomeClass" is a traveshamockery. We're programmers, computer science should not be that foreign, there are mathematical symbols to express this in type theory--so use them, as Scala does (I'd rather they used "<." instead of "<:", but I understand why they don't).
.
Scala is complex. Nobody said it's not. But it's complex because it's expressive. It's a predictable language with expressive semantics that doesn't make you do stupid shit to get things done. The tooling has reached a point where I no longer notice it and while it is slower to compile than Java, so is C++ and that doesn't bother me either because what I get is better at what it does.
I don't much care for the look of Python, but it's better and more suited to some tasks and so I get over it and use it. You may find Scala "ugly" and I'm sure you can find plenty of entrenched Java developers to agree with you, but outside of the epistemic Blub-closure of the Java world it is rapidly becoming understood that Java is better at nothing by design.
- Null - true but Scala's approach is perhaps more verbose than Java's. I like Groovy's approach the most ().
- Functional if - definitely disagree that it makes tons of code simpler / easier to read.
- Java 8 has traits (but I'm not sure if they're equivalent to Scala's traits).
- Nonfunctional core API's – Guava helps here.
– Reference-reseating-by-default - don't know what you mean by that.
I don't think Scala is the next Java. Personally, I wish Kotlin, Ceylon or Dart would replace Java. Scala makes the wrong expressivness / simplicity tradeoff.
> outside of the epistemic closure of the Java world it is rapidly becoming understood that Java is better at nothing by design
Not true. Yammer moved back from Scala to Java: http://blog.joda.org/2011/11/real-life-scala-feedback-from-y...
And Scala isn't the next Java. Frankly, it isn't simple enough to appeal to people who have become comfortable; it isn't unchallenging enough to supplant Java. This is not a demerit.
The link you provided doesn't contradict that.
Language can be too simple or too complex. The tradeoff that gives maximum productivity is somewhere in the middle. And in my opinion, languages like Dart or Ceylon are much closer to the optimum than Scala.
I have spent a nontrivial amount of time with Kotlin and Ceylon and neither are particularly interesting to me after actually internalizing and understanding Scala; as an example, I am significantly hampered by their continued insistence on mutable-everywhere (which is basically the watchword for "barely adequate programmer"). They may very well be "the next Java", but that's a curse more than a compliment. You should not need Guava to write minimally competent code.
Meanwhile, as a sibling comment notes, Twitter's a lot bigger than Yammer and pretty vocal about going whole-hog on Scala (and I've talked to them a little about what they've done, it's insanely impressive, I'm jealous). Guess they're just making things hard on themselves for no reason though.
I believe that Ceylon is the best-designed general purpose language out there. What do you mean by "mutable-everywhere"? Ceylon's variables / attributes are immutable by default.
The only problem is from the perspective of using and developing a new skill, I would rather use a newer language which is better built for problems of our time than something 20 years back.
Java has had its day in the sun. Its primary purpose was to become an easy C++ for people who didn't get memory management and people who didn't want to get into tiny pedantic issues while trying to run their code on two different Unix'es. But these are by and large solved problems now. Over years a lot of legacy code has gathered around Java.
But if you want better employability especially if you want to work on new projects, new paradigms and new domains of problems you should likely chose newer set of languages. Not Java.
One hard lesson that I've learned over the years is to never have any hard religious feelings towards old aging tools. We must learn to move on, find new shores build new stuff there. The only projects you get with these older tools are legacy ones, and people are generally waiting just to phase them out.
Java syntax has many problems, but they are very easy to overcome thanks to IDE and many JVM tools.
I've written code in lots of different languages and I haven't found a replacement yet (C# is closest, but I mostly do Android development, on Linux).
What I found liberating in Scala is a simple proposition: "use OOP when it makes sense, and functional programming when it makes sense". It's wonderful when you don't have to reason about everything using the OOP lenses and you get to choose, very empowering.
Your criticism to Scala in the other comment seems to amount to "it's not Java", which is extremely weak as an argument. If you are looking for an exact duplicate of Java, then just use Java. Scala is more complex than Java, certainly, because it gives you more options and also because it has a way of rewarding those who master the language. And "ugliness" is a completely subjective matter, I find Java with all its boilerplate ugly and not Scala, for example.
It amounts to "Scala is too complex, ugly and slow to compile."
Yammer moved from Scala to Java BTW: http://blog.joda.org/2011/11/real-life-scala-feedback-from-y...
My ideal language would be some mix of Kotlin, Ceylon, Dart and Julia.
Some examples: Twitter, LinkedIn, Foursquare. All of them pretty big and in the same space of Yammer; they seem quite happy and don't plan to move away from Scala.
And here you can find a clarification from Yammer about that issue: http://eng.yammer.com/scala-at-yammer/
TL;DR: They liked Scala but it has rough edges, every programming language has rough edges (yes, including Java). They found Scala was not the best option for some particular situations and Java was a better fit. End of story.
That's fine and completely reasonable, I think nobody said Scala is the Holy Grail in programming languages. As for your preference, you seem to be looking for a "nicer than Java, but OOP all the way" (don't know about Julia, haven't used it), which is OK as a preference but many of us find it a kludge to work with. I found something like Scala (multi-paradigm, I mean) helps me a lot in reasoning about code. As I said, you use the paradigm that makes more sense.
For complexity and ugliness, you have my previous answer. About compile time, you have a sophisticated type system and type inference which come at a cost, but it's not such a big deal when you run it with fsc (which stands for fast scala compiler).
If you don't use an IDE, your project is not large yet.
But I can't do the same in Java; at my last job we had thousands of .java files and I was stuck fumbling around with an IDE to do anything. The verbosity and repeated ceremony of the language makes it difficult to search for anything in an effective manner and the distractingly clumsy syntax (inner classes, as an example) made trying to Vim it failure-prone enough that I'd use an IDE just for the red squiggles. Those being in and of themselves concerning at times--I'd often find myself just trying to make the red squiggles shut up rather than concentrating on writing better code. I don't find myself doing that in Scala or C# or even C++.
(Admittedly, I like what IDEs can do in static languages to catch errors early and improve productivity, but that's independent of project scale.)
The resulting code is massive walls of text. 90% of that is machine generated through eclipse. This is an indication that the language idioms are unable to support the current complexities in application programming trends. And you have to interplay with them heavily to squeeze out usable programming logic.
That doesn't end there. Perl is older than Java, yet despite that I see Perl can support a lot of idioms far far better than Java can with its bulky frameworks.
Its just that the language is beginning to show its age.
The only reason to use Java these days is basically availability of super low cost devs, Legacy code, tooling etc. Basically for reasons as with any tool that has an advantage with age.