Live data from Hacker News

Stop hating Java

andrzejonsoftware.blogspot.com

101–110 of 158 posts

Re: Stop hating Java

#101
post #55

Long live the JVM and here we go again comparing Java to Rails the framework. I've seen the pros and cons of both Java and Ruby. From an organizational standpoint it's hard to beat Java. The performance is there and in a team setting statically typed languages really shine. You can argue about the quality of programmers that flock to Java quoting pg ad nauseaum but we don't live in a lisp world. Elegant code is writt…

> Elegant code is written by good programmers—not the language. But some languages make writing elegant code easier than others (compare C to Python, for example).

For some task-specific definition of elegance. For me, elegance is not just about how terse the syntax is, but how well it solves the problem at hand and responds to changes around it. For me, some problems require a performant solution as well, and the elegant option is the one that does this without requiring a bunch of rewriting or adding hard to discover dependencies.

I can write some terse AND elegant list comprehension code in Python that takes lines and lines of crappy looping in Java, but I can also write some seriously terse code to centralize business logic via a web service with automatic transaction and security management and have it perform an order of magnitude faster than a similar implementation in Ruby or Python (JEE 6). To me, that is elegant.

Likewise, I can do some elegantly maintainable things with .NET generics that I can't do with Java's lame erasure based implementation.

Of course, you could always just takes Einstein's opinion :) "If you are out to describe the truth, leave elegance to the tailor."

Re: Stop hating Java

#102

Earlier quoted context omitted.

Java, by design, imposes an upper-bound on cleverness/productivity that can be feel stifling to some. Thus, it becomes a badge of honor to graduate to sharper tools, such as Ruby. Whether they're cutting themselves (and others around them) with them is another story, of course. We need more devs who are not so emotionally invested in their tools. Not that they shouldn't care about them, but the loud-mouthed, posturin…

I'm totally fine with different strokes for different folks. But I don't buy the productivity argument. For any reasonably sized project, productivity tends to level out regardless of language or platform.

I think it's not really the size of the project per se but the proportion of domain complexity.

For problems with low domain complexity but involve a lot of boiler plate code, a more expressive language wins out. Likewise, if you spend the majority of your time thinking about the problem and little time on the actual implementation, then the language may not be your bottleneck.

Re: Stop hating Java

#103

First, let me point out that once again we are comparing Java - a runtime, a language platform and an entire ecosystem comprising many frameworks - with Rails, a specific web framework designed with a specific philosophy (opinionated defaults that work in 90% of cases, YAGNI, etc.) for a specific range of uses ("rapidly prototyping a small-to-moderately sized web site"). So just because Rails developers hate somethin…

I agree with the you. While it's mean, I dislike the current state of the Java community for the reasons zeemonkee stated in http://news.ycombinator.com/item?id=2793472

The tough part about languages like Scala and Clojure is that the existing Java ecosystem bleeds through heavily. For instance, while Scala boils away a lot of repetitious code, it's still there under the hood. It feels like an architectural band-aid. That may change as the ecosystem around each language evolves and writes frameworks and libraries in Scala/Clojure rather than reusing them from Java. However in Scala's case it's as if the language is being marketed as the next evolution of Java-as-a-language with a heavy emphasis on reusing existing Java frameworks and libraries, so I expect the people writing code in the existing Java community to migrate to Scala.

Elitest? Maybe. But I think it's a realistic view.

The newer JVM languages are great if you already have an existing Java codebase, however I'm struggling to find sound reasons to use Scala on a geen field project.

Re: Stop hating Java

#104
post #12

It's been my experience that most people who put down Java or C++ or [your language here] have never seriously used the language and are insecure about learning a new language so they make fun of other languages to hide their insecurity. Edit: I'll also add that this is not limited to the Ruby community. One last edit: General Patton once said, "Find what a man is cynical about, and you will know his weaknesses." or…

Ok, I'll bite. I think insecurity is different than dislike. If you asked me today what language would I use for a new web project, I don't think I'd pick a C based language. I don't really have much against that class - I use Objective-C every day. But I think it really comes down to the frameworks and libraries. I spent the better part of the dot com coding in Java and C++. Towards the end of my Java days, the time…

If you ever do want to try out a new app server, what I do is use embedded Jetty. It's not an app server that you deploy your web app to, but rather your web app becomes a runnable application. This makes deployment to something like EC2 completely trivial. Just copy your app there and hit run.

Re: Stop hating Java

#105
post #60

Earlier quoted context omitted.

You are right. The GoF only promoted bloated code. Who in their right mind would use patterns like the Observer, the Adapter, or the Visitor? Not sure if you know the history, but the authors of the book really only collected the patterns that they had seen around them in Smalltalk and C++ code. They wrote a catalog so we could all refer to the same name instead of using different names for the same concept. They ide…

Exactly. What many GoF critics seem not to understand is that Design Patterns is descriptive, not prescriptive. It's "what we've seen," not "what you should use."

I've heard people say that, but if that's true, why didn't they include many of the (much more commonly used, IME) patterns like Big Ball of Mud, Stovepipe System, Spaghetti Code, etc...? There's lots of nightmarish patterns/techniques that were omitted. I find no plausible way to account for that other than that the patterns are (perhaps implicitly) prescriptive.

Re: Stop hating Java

#106
post #85

Earlier quoted context omitted.

You are right. The GoF only promoted bloated code. Who in their right mind would use patterns like the Observer, the Adapter, or the Visitor? Not sure if you know the history, but the authors of the book really only collected the patterns that they had seen around them in Smalltalk and C++ code. They wrote a catalog so we could all refer to the same name instead of using different names for the same concept. They ide…

> Observer, the Adapter, or the Visitor It depends on the programming language one uses, really. You won't find many references to these patterns on Python's mailing list (or at least I didn't when I was new to the language and used to spend a lot of time there, ~6-7 years ago). Also, when I've tried to learn Lisp or Erlang I didn't find any mentions to such particular patterns (or maybe only in passing), the focus w…

All languages have patterns. Case analysis is a common pattern in Lisp code I've seen. Another one is map-reduce. Tags are another one.

They're just not called design patterns. But note that the things in GOF weren't called design patterns in C++ until 1995 either (the GOF book largely predates real use of Java). They were called techniques, or just things you might see in multiple projects.

Re: Stop hating Java

#107

I think a lot of the Java hate is because of the architecture astronauts who hijacked the language in the last decade - J2EE/EJB, the GoF, FactoryFactoryFactory shit and so on. I remember seeing the earlier versions of the servlet API and it was very elegant and well designed; unfortunately once the astronauts were through with it writing Java web apps became such a form of mental torture (Struts, anyone?) that even…

>> a form of mental torture (Struts, anyone?)

If I had to name the single biggest class of make-work in my life in the last 10 years, that would be it: maintaining legacy Struts crap.

The creator of struts should be in Gitmo for a year or two, perhaps with access to a functional programming environment a few hours a week if he behaves himself :-)

Java: providing a job with benefits. Like the episode of "The Simpsons" where Homer has to go back to the nuclear power plant to work, to pay for his daughter -- "Do it for her."

Re: Stop hating Java

#108

I think a lot of the Java hate is because of the architecture astronauts who hijacked the language in the last decade - J2EE/EJB, the GoF, FactoryFactoryFactory shit and so on. I remember seeing the earlier versions of the servlet API and it was very elegant and well designed; unfortunately once the astronauts were through with it writing Java web apps became such a form of mental torture (Struts, anyone?) that even…

As someone who was deeply involved with Java a decade ago, I feel your pain over the "hijacking." In truth, that crowd would have hijacked anything that came their way, it is a dynamic strongly influenced by the BigCo culture, it isn't really a tool thing.

The moment you set up "throw it over the wall" processes where architects are rewarded for architecture and implementors are blamed for bugs, you are going down the road to something that looks like J2EE no matter where you start.

Re: Stop hating Java

#109
post #60

Earlier quoted context omitted.

Exactly. What many GoF critics seem not to understand is that Design Patterns is descriptive, not prescriptive. It's "what we've seen," not "what you should use."

I've heard people say that, but if that's true, why didn't they include many of the (much more commonly used, IME) patterns like Big Ball of Mud, Stovepipe System, Spaghetti Code, etc...? There's lots of nightmarish patterns/techniques that were omitted. I find no plausible way to account for that other than that the patterns are (perhaps implicitly) prescriptive.

[deleted]

Re: Stop hating Java

#110
post #52

Earlier quoted context omitted.

Well, Unit Tests also came from it (SUnit was the first Unit Test framework). Which is unsurprising, as refactoring without unit tests is quite daunting. But JUnit did make them mainstream, and so did Eclipse' refactorings.

Interestingly, refactoring usually works quite well for functional Haskell code without tests just relying on the types. (Of course the types won't help you in more imperative sections of your code, i.e. it's hard to guarantee a specific order of actions in the IO Monad with types only.)

You mean just like in Java?
Post reply on HN