I am a fan of Guava, not just as a very useful library, but as a way to read really good Java code. Check the source out, it is imo a must if you are a java dev.
One thing I'm not a fan of is the functional stuff. The idea is good, but java is just too verbose. Without real lambdas, like C# has now, it ends up being not so useful.
I'm a big fan of the functional stuff. Writing transform statements using for loops is painful and error prone in comparison to a quick anonymous function using Collections2. Yes, it looks ugly, but at least there's less duplication, and if you're using code completion in an IDE (which you are, because it's java), it's actually faster to write.
The whole Java is too verbose argument is starting to sound like a broken record. With an IDE and tools like ProjectLombok around, you don't need to type much more than most other languages. I code a lot in CoffeeScript and Java and I type less in Java because at least it has static types and code completion. Try renaming a method or variable in CoffeeScript. ;-) ctrl-space (code completion) and annotations are your friends. Obviously Java8 makes the whole argument go away and now that the multi-year stalemate on Java7 is over, we know that Sunacle is focused on getting Java8 out as well.
This whole "with IDEs, you don't need to type that much" argument is starting to sound like a broken record. First off, it's good you don't need to type that much with modern IDEs because they all suck at keeping up with a programmer typing at a decent clip.
As others have pointed out, it's not about how much typing you need to do. It's about how quickly you can form, in your head, a conceptual model of what you see on screen and how accurate that model is. While dog-slow IDEs, half-assed Java-style static typing, etc may help you with that, Java's verbosity certainly does not.
Agreed. I spend way more time in the debugger in CoffeeScript than I do with Java, simply because I have no idea what type of object I'm dealing with at that particular instant. I also tend to write pages of Java code and it runs the first time because I can read it and see exactly what it is doing before it runs. The compiler also tells me what typos I have in my code before I even have to run it.
I don't buy this for a second for many reasons. First, in Java I have to deal with a lot of other headaches. Heaven forbid I have to customize maven! Or, I'm using some annotation based framework, let's say jax-rs, and I'm trying to figure out why the annotations I'm putting on something aren't having the effect I think they should be having. Then there is the fact that my java project will likely have more lines of xml than lines of code in the equivalent ruby project.
But, at the end of the day I'll bet money that I can write a non trivial website faster with rails using notepad than the vast majority of java people can with their favorite IDE and java framework.
Sorry, I wrote more than one comment in this thread and was referring to one of the others. Java is much more verbose and I believe that has a negative impact. Here's the example I used earlier: http://jaydonnell.com/blog/2011/08/07/is-your-idea-clearly-e...
That same code in C# would be nearly as concise as the ruby code. But there is more to it than just this. I've seen large Java projects that can't decide if they want to use interfaces or abstract classes. I don't think this is something one should spend much time on, but you're forced to in Java.
I've also see large java projects where they have some public interface that a bunch of other people are building off of, and after a couple years they realize they need to add a method to it. Ruh roh, what now? Again, why is this so painful?
Obviously these aren't problems in ruby because you can change classes at will. This scares some people, but I've done a LOT Of ruby and haven't had any serious problems with it. If you really like static typing then scala solves these problems as well and keeps the static typing.
Oh, another problem I've had in java are two frameworks butting heads over which is in the drivers seat as far as annotation based dispatch. Look back at the early days of combining guice with jax-rs.
I just wrote a 300 line Java class to replace a 30 line Python script, so I don't think the criticism is unwarranted. (Python is not an official production language. And no, it's not a hidebound corp. Proposed changes need proof)
> The whole Java is too verbose argument is starting to sound like a broken record. With an IDE and tools like ProjectLombok around, you don't need to type much more than most other languages.
The fact that you need an IDE to handle all the boilerplate for you should indicate the language is too verbose. In fact I feel like that's what it means for a language to be too verbose.
That is like saying a carpenter doesn't need a hammer. An IDE is just a tool for doing your job. You don't actually need an IDE to write Java, but it sure makes it a lot easier to build a house.
Correct. You don't actually need an IDE to write Java but unless you have one you're going to be writing a lot of boilerplate by hand. That is the point I am making. The language is verbose whether or not you have an IDE. The IDE simply helps you manage that verbosity.
It's instructive for all programmers (not just Java) because it's a beautifully designed API.
It's really difficult to design a good API and Guava didn't get to be like this overnight. It was used internally at google for years then spent years as a pre-1.0 open source project.
Check out GWT code too, similar writing and design style.
On thr other hand, I always have to pause and think a littlr bit longer when using the Guava PreConditions.checkArgument call (even the author of Guava admitted that too)
One thing I'm not a fan of is the functional stuff. The idea is good, but java is just too verbose. Without real lambdas, like C# has now, it ends up being not so useful.