I don't know why so many cool programmers hate Java. Sure the library is too big and sometimes is hard to find the proper stream class. Or the Date class is antiquated.
Ignoring that, what I like about java is that my programs are clear, and that once I compile my programs, they just work. I can refactor my code, and the compiler makes sure that I don forget anything. I don't love it they way I loved Perl or C. But when I write Java, I feel confident that my program is not going to break; and even if it breaks a stack exception is going to point me directly to the offending line.
Of course you don't have to use 25 Design Patterns at the same time. But lets not blame Gosling for that, that is the fault of the "Enterprise Architects", I still think you can write good tight java code.
Its largely because the solutions come out too verbose in Java. It takes far too much code even for simple tasks. After a while it gets on your nerves.
I have no problems with Java. But I have routine fits of frustration during P1 issues when I have to dig piles and piles of code to analyze simple things. Often its like there are 9-10 hierarchy of classes each doing something very simple and passing the burden of implementation to things below and down there you see more and more verbosity, boiler plate, getters/setter and pages of exception handling.
> Often its like there are 9-10 hierarchy of classes each doing something very simple and passing the burden of implementation to things below and down there you see more and more verbosity, boiler plate, getters/setter and pages of exception handling.
Totally agree.
Dijkstra wrote "a case against the goto statement" (which was renamed "Goto considered harmful" by the editor of the journal) when he saw these things happening to flow control because of GOTO.
These days Java (and C++, to a lesser but similar extent) has just as much "class spaghetti" as the "goto spaghetti" of the old days - and many programmers have no idea that it can actually be better.
> I don't know why so many cool programmers hate Java. Sure the library is too big and sometimes is hard to find the proper stream class. Or the Date class is antiquated.
The library is too verbose and over-architected. My idea of a good match would be the Java language with Python's libraries.
Java hate is overblown, but compared to say Scala (I have professional experience with both) it makes a lot of relatively trivial things (like basic data-holding classes and operations upon them) more painful and verbose than they need to be.
I agree - in particular, for advanced Scala libraries it can be hard to understand the source, which can make them hard to use without thorough documentation which is often lacking.
Forget the Enterprise Architects, it's things like having to build a pipeline of 3 objects to just append a string to a file that gave Java its bad name.
That's the whole point. Pipelines are made up of interchangeable components. When a code base has to survive what it was supposed to do today to what it has to do 5, 10 or 15 years from now, you want those pipelines.
I disagree. For that I only need the possibility of replacing something simple with a pipeline, not necessity. The pipeline I am forced to build today may not only occur unnecessary - it runs the risk of having split the components along the wrong lines.
During elementry school, did you ever have to do math using blocks?[0]
Sure, it's a fine way to do math, and you get all the same answers, and it's not really much slower. But I didn't like doing it then and I wouldn't like doing it now.
Programming in Java feels like doing math with blocks. I have all this code that needs to be there, and I understand why it's there, but I still find its inclusion frustrating. Java is a fine tool, and can be used to build great stuff, but it's not to my taste.
Do you feel is the strong typing system that gets in your way? I feel that some times. But I know that later is going save me for making mistakes when I have to refactor my code.
I also really like strong typing, for the reason you stated, though there are also lots of things I like about a "more dynamic" approach (duck typing is great, for instance).
Ignoring that, what I like about java is that my programs are clear, and that once I compile my programs, they just work. I can refactor my code, and the compiler makes sure that I don forget anything. I don't love it they way I loved Perl or C. But when I write Java, I feel confident that my program is not going to break; and even if it breaks a stack exception is going to point me directly to the offending line.
Of course you don't have to use 25 Design Patterns at the same time. But lets not blame Gosling for that, that is the fault of the "Enterprise Architects", I still think you can write good tight java code.