Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Well, is Java a clean, beautiful powerful language that people love programming in?


I don't think that Steve Yegge quite got his conservative-liberal categorization right, but I think he was on to something. And you're a flaming liberal. As another flaming liberal, I completely agree with what you said. But I am weird about trying to see things through other people's eyes, and I can see why others might not agree. Particularly if they are towards the conservative end of the scale.

For those who don't remember offhand what Steve Yegge said, https://plus.google.com/114613808538621741268/posts/fnhfBGry... gives you how I would draw the distinction. Basically conservatives are willing to put up with ceremony to get benefit. And liberals avoid ceremony.

My categorization of pg is because his top desires for code seem to be that it works acceptably well, is short, was fast to write, and is easy to change. None of these goals are compatible with having much excess ceremony.


I don't think it has much to do with the liberal-conservative distinction. I'm at the conservative end (Clojure, Haskell) and prefer a lot of liberal languages over Java.


The languages that you just named are in the case where Steve Yegge and I would disagree about categorizations. Steve looked at them, looked at the kinds of guarantees that they provide, and concluded "conservative". I look at them, and notice that people using those languages don't actually go through a lot of ceremony to get those benefits. Thus they can attract people who by my definition might be anywhere in the political spectrum.

My guess would be that you don't like having a lot of excess ceremony. If so, you'd be a liberal by my definition, and would prefer liberal languages over Java.

You're in a better position than I am to say whether that shoe fits, or whether you think that my attempted categorization criteria is entirely bunk. Either way, I'd appreciate feedback because I'm always trying to improve the ways that I understand the world.


Yeah by your definition i would be a liberal.

I can see good reasons for every position on Steve Yegge's spectrum. But i have a way harder time seeing a good reason to be conservative on your spectrum. Which makes IMO Steve Yegge's spectrum better for value neutral discussions.


Read http://www.fastcompany.com/28121/they-write-right-stuff and get back to me on whether there are valid reasons for someone to be a software conservative by my definition.

To me your response justifies the way I look at the world. The whole point of seeing things as "software politics" is to try to divide developers up into groups who each thinks that they are so obviously right that no justification is needed, and think that the others are so obviously wrong that you don't even know where you'd begin a discussion. And once you know what pressure point divides them, then you can actually try to start a productive discussion.

Speaking personally, I would die in an organization like that. I can look at it, see what's at stake, can accept that they are doing the right thing for their problem. But I am very glad that I can find things to do where the cost of smoking out the very last bug in my software is not as important as the profit from making the next thing that I'm going to make.


When human lives or expensive equipment are at stake then it makes sense to be software conservative by your definition. But for these kinds of requirements Java is way to lenient.


I have been developing Java since 1996. I have a written a lot of Java so I'm probably a pretty strong example of a Java developer. I'm an above average developer (and that might be generous) but not much of a hacker.

So let's get to it.

Is Java clean and beautiful? Sure, it's easy to read and just about anyone who has read any other language can figure out what's going on.

Is Java powerful? You can do just about whatever you want with it. Early on it was pretty tough to get to the native level but that has become less of an issue over the years. It still doesn't do graphics all that well so it's never been a great option for game development.

Do people love programming it? Programming is tedious work and good languages help reduce the tedium. I'm not sure Java reduces the tedium enough, it may even increase it. But this is what makes it cleaner than other other languages. Sometimes the tedium that it doesn't reduce is how others can come in and know what I was thinking then I developed it. However, POJOs with getters and setters are tedium no one explicitly needs.

I'm currently working on a new project (in Java) that I found I was building more classes than I felt I needed. A lot of getters and setters, object managers for each object, DAOs for each object, and each object itself. All that before anything even makes it into or out of a database. I thought if it would be easier in any other language and the answer was yes, but only temporarily. Once this boilerplate stuff is done I would have a very robust application that is easy to refactor if necessary and just about anyone can add to it will little trouble.

That said, I've been meaning to try out scala and python. I tried ruby but found it a little too young (but that was a couple years ago). I also said I'm not much of a hacker so I tend to spend my free time doing things other than development. I'll probably get around to learning those languages right after I learn to play the piano and can speak fluent German.


>Is Java clean and beautiful? Sure, it's easy to read and just about anyone who has read any other language can figure out what's going on.

Easy to read? What? Let me do a simple comparison. Let's say there's a site, ycombinator.com, that wants to ban anyone who posts "First post!" on a story. Here is what the python code would look like:

  if "first post!" in comment.text.lower():
      comment.user.ban()
Here's what the Java code would look like:

  public static void class PostPunisher extends PostHandler raises Exception {
    public void PostPostHook(Comment comment) {
      if (comment.text.to_string().to_lowercase().contains_substring("first post!")) {
        comment.User.Banner.execute();
      }
    }
  }
Well, I left off a few factory factories there, but you get the picture.


You're being obtuse just to be obtuse. This is exactly the type of nonconstructive feedback that does no one any good.

There is no difference in your python code than the Java code that someone would write:

  if(comment.getText().toLowerCase().contains("first post!"))
  {
    comment.getUser().ban();
  }
Java doesn't require a class, it doesn't require a method, it doesn't require a factory. There is literally zero difference between the python example and my Java example except the syntax between the languages.

You just felt the need to unnecessarily obfuscate the code to suit your argument.


Do you disagree that Java typically requires the additional boilerplate I showed?


I believe my last post clearly showed that I disagree.

There is no 'boilerplate' required with Java. Anyone can obfuscate Java, or any language, and make code that is overly and unnecessarily complicated. Some do it because they don't know better. Some, like yourself, just do it to be an ass.


I wasn't doing it to be an ass. Even if you are allowed to manipulate the class function you're dealing with (and so spare new classes), most java code does look like the example I gave: lots of verbiage, having to create special classes (including [verb]-er classes). Very, very unpleasant to read, and not big on beauty either.


One of the reasons that I really like the Groovy language as an alternative to Java is that it's features often save you typing (for example getters/setters on a POJO) but still allow you to get in and override the default behavior. So it increase productivity, and reduces pain without reducing the expressiveness.


It has fewer keywords than almost any other language, and the overwhelming majority of its library is written in pure Java.

It has warts, like the way closures are broken, and the lack of map-literals, some native syntax map stuff would be nice too. Functional programming with lambdas, etc is in fact possible (and awesome, passing around Callables through java's excellent concurrency libraries is quite elegant once you get past the ugly syntax).

Most importantly, it's IMO one of the best languages for team projects, the verbosity that people lament turns into a huge asset when you're reading other people's code. The interface system they have isn't quite as good as Go's but it allows really powerful abstractions as long as you don't go down blind alleys of implementation inheritance from your OO 101 freshman year.

That said, the JVM aside, Go seems to address all of its sweet spots a little bit better. Their only lack is some sort of generics and I'm pretty sure that they've delayed implementing it precisely because of Java's ugly edge cases in generic usage.

And if you're talking about EJB or any other enterprise monstrosity, sure, that sucks and is the exact opposite of 'clean and beautiful'. Or performant or any other positive adjective.


Really, it just isn't. I spent about a decade starting around when this essay was published writing Java. There are some obvious analogs between Java's design and the industries it's found a stronghold in. It's a language about prioritizing risk aversion, and thrives in organizations obsessed with the same.

If you were to design a programming language inspired by a large government bureaucracy that has much more machinery in place to not get fired or sued than it does to get work done, I imagine it would look a lot like Java.

As such, Java is a very useful tool for allowing large teams of average or even below-average programmers to produce serviceable products.

Of course that statement is terrible flame-bait, so let me be clear: That's not all Java is good for, and I'm not describing all Java programmers. Not by a long shot. I'm also honestly describing this as an asset to Java, and in my opinion the asset that's most responsible for the success it's enjoyed.

As a programming language for building things, Java is probably the worst example I can think of among languages and platforms that have experienced any popularity over the last decade or so. The amount of scaffolding required to express an idea is staggeringly off-balanced, and points at Java's primary concern: to avoid problems. Reading a Java program is an exercise in trying to extract what the programmer intended a program to do, while laboriously reading through all of the more-obvious things that the programmer intended the program NOT to do.

These things come in the form of a lot of ideas that aren't at all bad on their own, but coalesce into a symphony of painful excess on the axis of generalizations, exception handling, type declaration, contract validation, and data conversion.

A colleague of mine (who programmed embedded C) once reviewed a large Java commit of mine and commented that it seemed like 90% of my code was spent handling exceptions or converting data from one type to another. He was right, and though this is likely to be debated.. it's not because I was a bad Java programmer, it's because I was a good one.

In over a decade I think I met only one person that I think felt especially expressive in Java, and even he wouldn't use it for lots of everyday things that it made particularly painful (dealing with the filesystem or building web applications come to mind).

My personal opinion is that most people who say they love programming in Java love programming and either haven't invested in an alternative enough to know better, or find the particulars of a programming language a rounding error in the calculus of what they enjoy about programming.

I was in the first category, and God bless folks in the second. I envy them.


I don't think Java is beautiful, and would give it an average rating on being clean, but having worked on projects with both small & large teams in multiple languages, I think its one of the best languages for large teams. Its also much easier to assimilate new team members in a large Java project compared to other languages[1], primarily because of static typing and inferencing capabilities that modern IDEs provide. I suspect this is why Google uses it extensively.

For my personal tinkering, I prefer Ruby and love its meta-programming. But I wouldn't use it for a project if the team size is going to exceed 10. Writing Ruby like you write Java will work but doesn't count since the advantages of Ruby are wasted.

[1] Try diving into the source code for Rails/Django compared to a large, well-written Java project (the only ones I can think of right now are Google-internal, sorry)


I spent some time with Java this summer after several years of Perl, Python, and Common Lisp. I found Java - like Common Lisp - designed with obvious care. It had a clean design which was even, in a strange and minimalist way, beautiful. What it wasn't was powerful.

I thought it took a lot of shoveling code to get anything done, and that was fairly unpleasant to deal with.

I think that if I was starting a greenfield project for a 5+ year codebase which would have to be fairly reliable, cross-platform, and not a Lisp, I would have to choose Java and build my own frameworks for abstractions.


I'll certainly take it over Haskell any day. And Perl, or Lisp. And I love static typing. The ugliness comes from the myriad frameworks that have sprung up for it(metaprogramming in XML, good god).


Very true. Most of the hate for java is actually because of the frameworks. But Play framework has made java web application development fun again. Also I find static typing very useful for large projects. Even though I go to python for small programs (file handling, quick database insert), I still go to java for large projects. What I miss in java is the succinctness of python(like list comprehension). But I still don't want to loose static typing. I thought scala was the answer. But I was not impressed when I tried it.


I like Python too, the dynamic type system and performance hit are the only things that might discourage me from using it for a big project. Go might be worth checking out, it's supposed to give you things like first class functions in a compiled language.


That's the really interesting bit--it isn't. Most of your points are mostly correct. But that doesn't stop its being popular.

This shouldn't surprise people either; sitcoms, junk food and package tours are also very popular. More generally, quality is very rarely positively and consistently correlated with popularity. And yet, in the sphere of programming languages and operating systems, it seems people assume that it does correlate.

Please don't base your choice of technology exclusively off what most people use.


I never predicted it wouldn't be popular. It was already popular when I wrote that.


If anything, it was more popular; in 2001, Java was the "modern" mainstream choice for backend in financials and enterprise L.O.B. applications, where today it's simply the incumbent choice. People forget that Rails was a primarily a reaction to J2EE's hegemony over "professional" (to use the closest word I can think of to describe the concept) web backend development.

A significant fraction of our enterprise clients today are entertaining a new "modern" platform to supplant Java, like Clojure (in finance) or Scala (in startups). Maybe it's not occurring to people that Clojure, Scala, and even Groovy weren't options in 2001. It was Java, C#, or PHP, or Perl, or C/C++.


Mu.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: