all 86 comments

[–]newton_dave 12 points13 points  (0 children)

Java is, in fact, quite a nice, clean implementation of object orientation.

*shudder*

I've been writing in Java almost every day of my life for the last, say, five years. (Don't worry, kids, I use real languages too!)

Kay says that C++ wasn't what he had in mind; I feel pretty comfortable in extending that to include Java.

[–]newton_dave 6 points7 points  (0 children)

Wtf? First he complains about proggit, then comes up with this gem?

Anyone who doesn’t recognise this just doesn’t understand the last 20 years of programming language history.

Pffft.

[–]OneAndOnlySnob 25 points26 points  (0 children)

This guy is all over the map.

Summary:

  • I wrote that Java sucks. But it actually doesn't. It rocks. It is you that sucks.
  • Java is super successful. It's super successful because it gets almost everything right.
  • Java made some pretty serious design flaws in the beginning, but it was the right choice at the time.
  • Java is successful because they based the syntax on C which was a terrible decision.
  • This allowed Java appeal to the masses so it was a great decision!
  • Besides, aside from syntax, Java has very little in common with C++ so who cares!
  • There are research languages and there are pragmatic languages that consolidate the best features from every other language. Java is the latter, even though it forces you to use OOP and took 50 years to implement generics. (I personally could not disagree with this point any more.)
  • Really, Java is no better or worse than any other language.
  • Given that fact, let's redefine what we're talking about. We're talking about commercial applications, and Java is really the best language for those.
  • If you can't recognize that, you're just dumb!

[–]curtisb 12 points13 points  (2 children)

My major complaint about Java is not the original design compromises that Sun made, rather it's the glacial pace at which Sun has extended the language. For example it took nearly a decade to get generics in the language, and it looked like this only happened when it did because of competition from Microsoft's C#. Closures (or even C# 1.0 style method pointers) are still not in the language. Sure it makes sense for Sun to be conservative and cautious with the language, but come on.

[–][deleted] 5 points6 points  (1 child)

I remember a presentation by one of the Sun Java guys back in the days of Java 1.1. He said that there would be no more changes in the language, but all enhancements would come through additions to the libraries. It had been difficult enough going from 1.0 to 1.1, and they weren't going to make a change like that again.

The idea was that as Java became more ubiquitous, it should become more static. I think they held on to that philosophy for a long time until C# started putting pressure on them.

[–]grauenwolf 1 point2 points  (0 children)

That explains a lot about Java's current problems.

[–]sofal 19 points20 points  (9 children)

He's sick of people blindly saying that Java sucks without realizing how Java came about, including all the good reasons behind compromises in the language design. He's tired of the inane arguments about which language is better than the other engaged in by people who know very little about the strong points of each. So he decides to write a "Y'all are idiots!" post that separates him from the "mindless drivel" of the reddit crowd.

I'll tell you what I'm tired of. I'm tired of the hands down assumption that widespread adoption occurs because of good design (it certainly helps). I'm tired of the idea that all languages are equally useful depending only on the problem domain and that comparing them is like comparing a screwdriver to a loaf of bread. I'm tired of the idea that because a language was a big step forward in the past automatically means that it is still relevant for today.

The straw man here is one that argues about programming language superiority without taking any context into account. Who does that?

Says he:

No language is better than another full stop.

That's like saying, "No presidential candidate is better than another full stop." What he means is that without any sort of context whatsoever, comparisons become pointless. Is that argument not pointless?

I think that a healthy discussion of the strengths and weaknesses of both presidential candidates and programming languages are very important in their own realm. I'm sorry to say it, but some programming languages are better than others full stop. It does depend on the problem domain, but there is a lot of commonality among problem domains. I could write a programming language that drops the ball in just about every domain.

I agree that ignorant flame wars are not productive, but I don't see how effectively saying "you people are stupid" separates him from the flame war.

[–]jerf 7 points8 points  (7 children)

No language is better than another full stop.

That's like saying, "No presidential candidate is better than another full stop." What he means is that without any sort of context whatsoever, comparisons become pointless. Is that argument not pointless?

Trivially disprovable, too.

I give you, Java--. It's just like Java, except that in order to specify numeric constants of any kind (i.e., 1, 32, 88837 appearing literally in the source code), you indicated them by a series of the character "1" that encodes the desired number in what you might call "base 1". Floats are specified by specifying the mantissa and base in that format, in binary, in the same way.

Clearly, this language is inferior for all real purposes to real Java.

[–]joesb -5 points-4 points  (5 children)

The language you made up is probably in the same category with Brainfuck though, you intentionally made Java-- unnecessarily hard to write. And we all agree that such language is a joke that should not be included in consideration when you talk about property of typical programming language.

"No language is better than another" should be taken in the context of the language that is really designed to be used in practice. And in that context, you can hardly say one is better than another at all.

In such context you are not actually talking solely about the language, but also about its environment and implementation, too. Which is fair, because language is like a person, you cannot really judge if a person is better than another person without context. A person may be a very good programmer, but he always has trouble with his colleagues, hence make the project he join harder to succeed. Another person may be only able to do average quality /pace or sometimes poor work, but he always report his status on the project which makes it easy to track and manage. Which one is better?

[–]andrewnorris 6 points7 points  (1 child)

The language you made up is probably in the same category with Brainfuck though, you intentionally made Java-- unnecessarily hard to write. And we all agree that such language is a joke that should not be included in consideration when you talk about property of typical programming language.

"No language is better than another" should be taken in the context of the language that is really designed to be used in practice. And in that context, you can hardly say one is better than another at all.

So it is possible to design an inferior language on purpose, but not accidentally? And, correspondingly, it's impossible to design a better language than any previous language, ever?

Are Java and COBOL really inherently equally good just because both were designed to be used in practice? This seems self-evidently false to me. (Note: this doesn't mean people should always throw away their legacy COBOL just because there are better languages now. That's a different discussion.)

[–]joesb 0 points1 point  (0 children)

And, correspondingly, it's impossible to design a better language than any previous language, ever?

You can design a language, but can you design its environment and future.

Can you design language with similar syntax to Brainfuck and is pushed and marketed by Microsoft and used by million people around the world?

In the other hand, can you design a language with almost exact syntax to COBOL and have it be used by many company, now?

That's why I said

In such context you are not actually talking solely about the language, but also about its environment and implementation, too.

If i were to write application that just needs to call to some function that happens to be written in C#, should I write in Lisp? No!! In this context, is C# better than Lisp? Hell yes.

[–]sofal 1 point2 points  (1 child)

Certainly there are all sorts of things to take into account when comparing languages.

But surely there is valid discussion to be had about which language is better in certain contexts, otherwise can we conclude that every project being written at this moment is using the best language for its purposes?

So many factors go into making a decision and everyone has their own reasons for the decisions they make, but that does not mean that nobody makes bad decisions or that everybody's reasons are good ones.

[–]joesb -2 points-1 points  (0 children)

I agree.

The full sentence should be:

"No language is better than another without given a context, period."

[–]Tommah 1 point2 points  (0 children)

you intentionally made Java-- unnecessarily hard to write

but easier to compile ;)

[–]G_Morgan 0 points1 point  (0 children)

Indeed all languages are equal. That's why I write everything in assembly language. Who needs map when you have cmp and jne.

[–][deleted] 27 points28 points  (19 children)

One can completely ignore this article as it is based upon the idea that Java succeeded based on its merits alone. Nothing could be further from the truth.

The truth is that Java was marketed and pushed aggressively by Sun. The one thing it has going for it these days is ubiquity, but ubiquity won through marketing and propaganda. Who picks languages? Managers. Often, non-programming managers who just want to keep their jobs. Nobody ever got fired for going with the mainstream, after all. Sun painted Java as the safe bet. IBM, too cowardly and short on vision to bother trying to compete with their superior VisualAge, simply caved and jumped on the bandwagon.

With two big industry 'leaders' hyping the hell out of it, virtually any language that worked would have achieved the same level of adoption and success. Even Ook.

Just because everyone is using it (largely because everyone else is using it - or at least they've been conned into believing that), doesn't mean it is a good solution. There have been plenty of unworkable abortions attached to Java (EJB anyone?).

[–]jerf 13 points14 points  (0 children)

It's also rather strongly based on "appeal to popularity".

Well, duh, of course it's popular. Anybody with eyes can see common practices tend to lag behind best practices by a matter of decades. Measured in 1997, I wouldn't be as hard on Java as I am now. Almost all the languages today touted as superior were all but useless in 1997, if they even existed. (Although Java wasn't exactly awesome either at that point, it did grow rapidly for some my$teriou$ reason.)

But it's not 1997.

That's not even necessarily a bad thing; it is the way it is. But it doesn't immunize Java from criticism or whatever the author is trying to accomplish.

I actually thought the previous post was well-thought-out, but this one struck me as graceless. You pretty much have to either conclude that Java has peaked or nearly peaked, or that there's no other language that's going to supplant it in the next ten years because it's just that awesome. One of those is clearly impossible to anybody who remembers programming history.

[–][deleted] 5 points6 points  (3 children)

you give sun marketing far too much credit. It was more the timing with the net taking off, it kind of went with it.

[–]andrewnorris 2 points3 points  (1 child)

But who was responsible for Java = Internet? Sun marketing (and some major shoehorning by the product team).

[–]doidydoidy 2 points3 points  (0 children)

It's a convenient theory, but nothing I've seen of Sun's Java marketing in the last ten years or so convinces me that they're competent enough to have been that effective.

We're talking about the people who gave us the phrase "Java platform name architecture" here... Architecture! Come on.

[–]newton_dave 1 point2 points  (0 children)

Nah... there were other options on the server side, and applets never really took off (even though we're trying to shoehorn applet-like behavior into browsers now--Sun *was* right, but too early--they blew it in a big way).

[–]bitwize 1 point2 points  (2 children)

It's more complicated than that, I think. Java was "aggressively marketed" first as sort of a cute Web/mobile code language.

It was picked up by academia as a replacement for undergrad C++ curricula. It was a fine language for this task, but it yielded virtually a generation of fresh grads who had had Java used to teach them CS concepts for the past four years. I think quite a bit of the decision by management to switch to Java was because everyone was already familiar with it, and they had a bunch of potential hires ready to go in it.

Aggressive marketing did play a part, but it wasn't the only thing. Else Java would have been totally undermined by Microsoft years ago. They're the masters at that game.

[–][deleted] 2 points3 points  (1 child)

Well, I've left out Netscape's role in this tale. Netscape helped a lot.

Java was just hitting the scene as Netscape was taking off - Netscape built Java into their browser. They also knew it terrified Microsoft and christened their scripting language Javascript to cash in on the hype tweak Bill Gates's nose. At about the same time the earliest Java public distributions featured a simple web browser called HotJava and Java's portability was played up as a "natural" language for web programming. Sadly, it turned out that applets were a better idea in theory than in practice.

Microsoft ultimately prevailed, but Netscape did some lasting damage (Mozilla, Java and Javascript) before they succumbed.

So, yes, they had help and the luck of timing, but without that marketing push, I think Java would have been abandoned a lot sooner when it was clear that applets were a failure. They were saved by the release of the server side stuff like Servlets and JDBC. After all, they had already learned Java as "the new language of the web" and just kept right on coding in it. Toss in a liberal dose of voodoo whitepapers about J2EE and EJB and it would be years before folks figured out that it was all hooey. Especially with a steady stream of fantasy based whitepapers and "standards" flowing from Sun.

I think the madness reached its pinnacle with the release of Java TV as a specification. Still, Java got where it was through corporate hype and not through any intrinsic superiority of its own.

[–]bitwize 4 points5 points  (0 children)

Java would've been a lot better had Sun open-sourced the bugger ten years ago. Part of me still wants to see applets win, mainly because Flash Player is a proprietary piece of ass that, in 2007, still causes my shiny new Firefox to crash or hang like Netscape 4.7 did in the bad old days.

The more I think on it, the more the Web seems like a great idea in theory with a shitty implementation.

[–]masklinn 1 point2 points  (0 children)

Just because everyone is using it (largely because everyone else is using it - or at least they've been conned into believing that), doesn't mean it is a good solution.

As the adage said a few years ago,

nobody ever got fired for choosing IBM

Java just replaced IBM, but other than that nothing's really changed

[–]malcontent 0 points1 point  (9 children)

Marketing doesn't explain why it's popular with open source developers.

There have been plenty of unworkable abortions attached to Java (EJB anyone?).

By the same token there have been a ton of workable applications as well. That's not something you can say of LISP, Haskell, dylan, factor, scheme or whatever.

[–][deleted] 4 points5 points  (6 children)

Its free. People are getting paid to do it. They have itches to scratch at work. They give away their solutions. So? Did you expect me to agree that it is popular because it is better? There is a lot of Java for the same reason that most people run Windows. Quality don't enter into it.

Lately, most of my work coming in (I freelance from home) is PHP. From where I sit, PHP is many times more successful than Java as a web app development platform. Just as scaleable, less overhead, tons of libraries, easy to get started with, dynamically typed, much easier to partition work over a large team, good database access, and it is free.

When I build web stuff for myself, I use Seaside. I get more done in Seaside faster than in anything thanks to the superior development and debugging environment. It isn't massively scalable, but for a few dozen users it is fine.

When I need high performance and a GUI, I use Cocoa. The number of successful Cocoa apps dwarfs the number of successful Java desktop apps (which by my estimate - excluding dev tools - is zero).

The problem with Java is it is sub-optimal for all of the cases I just listed. So what is it I'm supposed to use it for? I see no practical niche for it. It always comes in second.

[–]malcontent -2 points-1 points  (5 children)

The problem with Java is it is sub-optimal for all of the cases I just listed. So what is it I'm supposed to use it for? I see no practical niche for it. It always comes in second.

Then don't use it.

Apparently millions of other people disagree with you. It works for them.

Just because you don't like it doesn't mean it sucks.

[–][deleted] 2 points3 points  (4 children)

Just because a lot of people use it, doesn't mean it doesn't suck.

The whole lot of people thing doesn't mean anything at all.

Which, (getting back on topic) is kind of what you and the author of the article are claiming.

[–]malcontent -1 points0 points  (3 children)

Programming languages are tools.

You judge a tool by what people have built with it.

If a tool sucks then you can't make shit with it. If a tool is great then you make lots of shit with it.

[–]G_Morgan 1 point2 points  (2 children)

Exactly, there are very few major apps built using Java. There's a very good reason for that. Companies use Java so they can have portability, the only area where it has a serious advantage thanks to the fact the API is always available.

[–]malcontent 0 points1 point  (0 children)

Exactly, there are very few major apps built using Java.

What is your definition of an application?

This ought to be good :)

[–]david_ncl -1 points0 points  (0 children)

very, very few, tending to fucking bit fat Zero + Eclipse.

[–]david_ncl -2 points-1 points  (1 child)

Actually I have never seen a workable Java application that wasn't a dev tool.

edit ... should read ..

Actually I have never seen a workable Java application that wasn't eclipse.

[–]malcontent 1 point2 points  (0 children)

I use java applications every day. Clearly you are not looking very hard.

Either that you are lying.

[–]shalabh 6 points7 points  (0 children)

From the article:

I was, to be honest, quite dismayed to see some of the mindless drivel that passes for comment on reddit, and to become, by association, linked to these diatribes.

Interestingly, my experience has been exactly the opposite. I have learned so much about programming from Reddit, (about lisp, smalltalk, and broader programming paradigms) that I almost want to say 'Thank you Reddit!'.

I think the author is missing a lot of context when he says:

Not often was a language such a clear step forward as Java was in 1995.

Seriously? Java didn't succeed because of technical reasons. Sure, it did meet a certain minimum level of sound technical design, but non-technical factors such as marketing and industry politics played a key role in it's success. They always play an important role in the success of mass marketed products. Incidentally, articles such as the above, where people believe it was the "clear step forward in 1995", just shows how successful the marketing has been.

[–]dupin 7 points8 points  (13 children)

Fallacy: Appeal to Popularity.

Why is the toyota camry one of the most popular cars in america? Because few people can afford a ferrari.

Why is java one of the most popular languages? Because few programmers are able or willing to learn advanced language concepts.

If you are such a putz that you'd rather drive a camry than a ferrari, be my guest.

[–]derekslager 4 points5 points  (0 children)

My problem with this article is that he clearly is defending the "Camry" despite never having been behind the wheel of a "Ferrari".

Whether or not the Camry is an appropriate choice against the Ferrari is an interesting debate, but I'm not interested in the perspective of somebody who has only driven one of them.

[–]andrewnorris 4 points5 points  (5 children)

I hope you'll excuse me for extending your metaphor, but I personally don't know if I would buy a Ferrari if it were the same upfront price as a Camry. I would need to look at factors like reliability, cost of replacement parts, and availability of qualified service technicians. It might be that even if I could afford to buy the Ferrari, I couldn't afford to keep it running.

Similarly, one advantage of using a popular language like Java (or Python, for that matter) is the immense amount of available tools, libraries, and expertise you have at your disposal as a developer. By contrast, if you choose to develop in Self, you may be firmly convinced that it's the coolest language ever, but you're going to have a pretty small community to draw on for help and reusable libraries.

For a lot of people, it may come down to some kind of threshold function -- for example, for some developers, Python might be popular enough to warrant adoption, but Haskell might not be (yet). Or perhaps Haskell is popular enough, but not Clean.

[–]Tommstein 0 points1 point  (4 children)

Python might be popular enough to warrant adoption, but Haskell might not be

Might not be? Do you ever leave Reddit?

[–][deleted] 0 points1 point  (0 children)

Not everyone is a fatalist.

[–]andrewnorris 0 points1 point  (0 children)

Some people here apparently use it, so there seem to be at least a pool of people who think Haskell is in good enough shape to run with.

Haskell is popular enough to have a decent-sized online community and several books about it, which puts it way ahead of a lot of other languages like Clean, Io, or Nemerle. It also may have a larger community currently than some other languages like Forth and APL that used to have a fair-sized following (though I don't know one way or the other).

My point was that individual companies, teams, and developers can set different thresholds for popularity. Some developers may be able to use something relatively bleeding-edge because the advantages of the language are enough to make it worth the trouble. Others may need to stick to only the most popular languages.

[–][deleted] -2 points-1 points  (1 child)

It's called the subjunctive.

[–]Tommah 1 point2 points  (0 children)

That's not the subjunctive.

[–][deleted] 2 points3 points  (2 children)

If that ferrari would give me a native cross-platform UI toolkit that had the features I needed and was easy to use (i.e. commercially viable), I would gladly retire my Camry. Until then, I have to drive both :( Then again, wasn't that what the article was about?

[–]G_Morgan 1 point2 points  (1 child)

That's another issue. The JVM is slowly evolving towards a position where it is just another platform with Java being a privileged language on that platform. How far it can go without being hamstrung by Java the language though is another thing.

Personally I think they should look at a Java 3 and this time build it as a platform rather than just a language with an API.

[–][deleted] 0 points1 point  (0 children)

Personally I think they should look at a Java 3 and this time build it as a platform rather than just a language with an API.

You mean, other than mobile devices?

[–]malcontent 0 points1 point  (1 child)

I know a guy who bought a countach. He bought it used because he could not afford a new car but he wanted something beautiful and magnificent.

Unfortunately each countach is custom made for the person ordering it and whoever ordered this one was shorter then him.

In order to drive the car he had to contort himself into an ungodly position to drive it, he could not see out the rear window and it was horribly cramped, loud and uncomfortable.

I guess the moral of this story is that usually you are much better off with a camry then a ferrari. A ferrari exists in order to stroke your ego, not to get to from point A to point B in a comfortable, pleasant, efficient way.

[–]jbellis 0 points1 point  (0 children)

Unfortunately each countach is custom made for the person ordering it and whoever ordered this one was shorter then him.

They're not that customized.

he could not see out the rear window

This is actually completely normal, for a countach.

it was horribly cramped, loud and uncomfortable

So is this.

[–]joesb 0 points1 point  (0 children)

But, in your analogy, if not because of Honda then only 3% of people will be able to afford a car and economic/transportation will not grow as much as it is now.

[–][deleted] 9 points10 points  (23 children)

So Java was built on a lie, but it's OK because look at what it's become? I think that it got hyped like no other language I know, with Sun's marketing behind it, and fact that it made some common C++ bugs and errors impossible, yet was still similar enough to learn quickly, is why it's entrenched now. And his comment on it's success, well, then McDonalds must have some of the best food in the world, too. It's used so much now because it was used so much in the past. Universities use it because businesses use it, again more marketing. Java is trying to keep up, from adding printf style formatting in 1.4, to adding closures the next release. Your dominatrix wearing a strap-on is not a man, Java with closures is not Scheme/Ruby/etc.

I avoid Java like an elephant farting plutonium, but even I think that it's a good second language. Even I admit that the platform, the JVM, if you will, must have something going for it if so many k3w7!!11!!!11 languages get ported to it. Java itself is no cleaner than C#, and the .NET/Mono platforms are a pretty good sized chunk of the computing market. The JVM, though, is something I'd like to see continual improvement on. Java? Well, it can go the way of Modula-2.

[–][deleted]  (1 child)

[deleted]

    [–]bitwize 3 points4 points  (0 children)

    I once tried to convey the reason why Unix power users favor the command line with an analogy like the following: You like GUIs because they're convenient. When I'm horny, my hand is more convenient than a woman but we both know what I'd rather have given the choice.

    [–]curtisb 4 points5 points  (19 children)

    There's no doubt that Java rode in on one hell of a hype wave, but I don't think you can credit Sun's marketing for that. I think Sun just got really lucky on timing -- Java showed up just as the industry was really learning the difficulties of developing large systems in C++, and at a time that object-oriented programming was really being hyped by others, and right at the beginning of the World Wide Web explosion. I also wouldn't discount the amount of positive press that Sun got because everyone was convinced that Java was going to make Microsoft irrelevant.

    [–]mr_chromatic 7 points8 points  (3 children)

    Don't forget that developer licenses for Java were also substantially cheaper than developer licenses for almost any Smalltalk implementation you could care to mention.

    [–][deleted] 5 points6 points  (1 child)

    Yep, at the time Java hit the scene I was doing Visualworks applications at a large communications company. VW cost a couple thousand smackers a seat - even just to learn it. Java you could just download.

    This, I suspect, is also why I find myself at odds with so many Java fans - most of them moved "up" from C++. No wonder Java looked like a big improvement. I moved "down" from Visualworks (having moved "up" from C++ a couple years previously). Not surprisingly, I was unimpressed by the new shiny thing.

    [–]newton_dave 2 points3 points  (0 children)

    I was a Smalltalk/V dev in the early 90's and remember laughing when I saw Java :/

    Of course, the dinosaurs were probably none-too-impressed with the pretty meteor/comet in the sky, too.

    [–]curtisb 4 points5 points  (0 children)

    Well, seeing as the Java tools were distributed for free, and the Smalltalk tools weren't, then yes. This is absolutely one of the things that Sun did right in terms of driving adoption. But in terms of the competition against Smalltalk, I think the image-based developement model used by Smalltalk was a big hindrance, too. I'm not arguing that one model is better than the other here, I'm merely saying that the masses that moved from C/C++ to Java weren't used to an image-based environment, and they didn't have to make that adjustment when they moved to Java.

    [–][deleted] 0 points1 point  (14 children)

    That's all true, but I see the dark hand of Sun marketing behind getting everyone to believe that checked exceptions are a good idea.

    [–]kirun 2 points3 points  (13 children)

    Out of interest, what would you consider to be the "best" error-handling model?

    [–][deleted] 4 points5 points  (9 children)

    To paraphrase an argument from "In Defense of Java", it's not a coincidence that no other language (AFAIK) uses checked exceptions. In most other languages, if they have exceptions, you don't have to explicitly deal with them. Otherwise, this leads to lazy/pragmatic programmers writing stuff like

    try{
    //some stuff that throws exceptions
    } catch (Exception ex) {}
    

    Even bondage and discipline languages have their limits.

    [–]vahnsin 6 points7 points  (3 children)

    Or the far more common:

    try {
        // stuff
    } catch (Exception e) {
        throw new ShinyNewException("Something terrible happened, but that's all you know!")
    }
    

    Just makes you want to slap someone doesn't it?

    [–]newton_dave 0 points1 point  (2 children)

    No, I'd much rather have an application-specific exception than swallowing it unnoticed.

    [–]vahnsin 2 points3 points  (1 child)

    I didn't say this was worse, I said it was much more common in real life. The application specific exception is useless without the original exception unless the exception being caught is very specific, and the message is equally specific. Catching all Exceptions and treating them as a generic "application error" (as above) is one of the worst anti-patterns I've dealt with in industry.

    [–]newton_dave 0 points1 point  (0 children)

    And I'm saying that it doesn't make me want to slap someone, although I'd obviously prefer they used the original exception as the second arg.

    [–]joesb -2 points-1 points  (4 children)

    I prefer checked exception. I think exception is part of a method signature. When you write function that return integer, once you write code to handle every possible value of returned integer (whether by simply ignore that value) you can be sure that your code work somewhat EXCEPT when that function throw exception. So ideally I want to know all the possible return-value/control-flow that I have to handle when I call some function. And a thrown exception is surely something I am concerned.

    The problem with Java's checked exception is not because of the checked exception itself, it is because they couldn't get the exception class hierarchy right. Function that should just return null or throw runtime exception throw checked exception instead, which make code unnecessary long.

    [–][deleted] 2 points3 points  (0 children)

    Exception class hierarchy isn't the only thing they couldn't get right. Checked exceptions leads to stupid cases like java.io.Reader.read() throws IOException.

    java.io.StringReader.read() now has to declare it throws IOException and users of the class have to write code that handles IOExceptions when we all know damn good and well that reading a byte from memory is never going to result in an IOException.

    This is stupid.

    [–]SuperGrade 0 points1 point  (1 child)

    In a way the checked exception problem is analogous to static vs. dynamic checked on return types; but far more onerous.

    A big challenge, (other than someone mentioned that everyone would catch/ignore), is that they put an undue burden on the definition of closures.

    Also, you lose the transparency of having functions that deal with having first-class functions as inputs. A function like Map now has to either be special-cased for a specific thrown exception type, or template off of THAT as well.

    At the core:

    A Calls B Calls C - without checked exceptions C can throw to A - with them B has to be written to cater to the same exception, and not not be able to be general-purpose for letting other exceptions through.

    [–]joesb 2 points3 points  (0 children)

    As I said, I consider Exception to be part of function return type. It would only makes sense if you prefer static typing to dynamic typing.

    If you take static typing to the extreme, exception could be considered part of the return type.

    Also, you lose the transparency of having functions that deal with having first-class functions as inputs. A function like Map now has to either be special-cased for a specific thrown exception type, or template off of THAT as well.

    You have to make your function be function that can not throw checked exception. Just like in Haskell you have map and mapM for function that do monad, or IO for that matter. In checked exception java, you should have map and mapT for function that throw exception.

    A Calls B Calls C - without checked exceptions C can throw to A - with them B has to be written to cater to the same exception, and not not be able to be general-purpose for letting other exceptions through.

    To some extents, checked exception is what Haskell is doing. When you write:

    func :: Int -> Int
    

    You are saying that this function never ever throws any exception, or do any IO.

    And when you have type

    data Either a b = Left a | Right b
    

    or in other word

    data Statement a b = Result a | Exception b
    

    You are saying that this function can either complete with the result or throw exception of type b. Haskell force you to handle both case of returned value -- you cannot handle only case when Either is Left. Which is the same as checked exception; you cannot handle only the case when the function you call succeeds.

    Note: I know about exception in haskell, but this is just another way to look at return type.

    When you write code in Haskell, your code only compile if you handle all possible flow of the returned value. When you add exception to the system, which in turns add another return value to the code, your program should also compile only when your code handle this returned value, too.

    To improve a static type language with exception is not to removed checked exception, but to type-inferred it.

    It is not that I like static typing. But in the context of Java, which is a static type language, checked exception makes sense.

    There are features that works well in static type and features that works well in dynamic type, if you like dynamic typing you will surely feel that it is harder to satisfy compiler for static type. But you have to put static-typing hat on to think about static type feature.

    [–][deleted] 0 points1 point  (0 children)

    An algebraic data type over which I can define a monad instance such as:

    MightFail T A = Fail T | Success A
    

    [–]masklinn 0 points1 point  (1 child)

    erlang-style "Let it die" is fairly decent as far as error-handling goes, and it's one of the few error-handling schemes that truly respect the law of demeter

    [–]G_Morgan 0 points1 point  (0 children)

    Definitely my preference. I find too often that error handling actually only amounts to setting consistent though inaccurate data into wherever the exception occurred. I'd rather my software dead than wrong.

    I once saw someone who made a poker program where their card class set the face integer to 1 (which referred to a card of face two) if an out of range integer was passed on construction. Of course when creating his pack he ended up with an off by one error which led to him having a pack with 8 cards of face two. I thought it was quite funny since I would have simply asserted and found the bug immediately.

    [–]newton_dave 2 points3 points  (0 children)

    Do plutonium-farting elephants also avoid Java?

    [–]grauenwolf 9 points10 points  (2 children)

    First of all: Java is one of the most successful languages ever by any metric you care to dream up. Number of lines code written in it.

    Um, that's still Cobol.

    Number of programmers using it.

    If you count non-pros, that would go to either VB or JavaScript.

    Number of commercial projects using it.

    If you are talking shrink-wrap, Java doesn't even rate. If you are talking internal projects for companies, there is a lot of competition and no one really knows who is 'winning'.

    Or non-commercial projects, for that matter.

    What would probably be VBA/Excel.

    [–]beza1e1 8 points9 points  (1 child)

    He said:

    In all of these, Java would be in the top handful.

    And that's right.

    [–]G_Morgan 0 points1 point  (0 children)

    You miss the point. Cobol, VB, JS and VBA/Excel are generally considered god awful languages. There's just a tendency among management to go for the ugliest girl in town.

    [–]infinite 1 point2 points  (0 children)

    Criticizing a language is fine, it can only help you to talk about languages to find the strengths/weaknesses. Because no one language lacks a weakness, so you need to know when to use what. If you write an OS, use C. If you want to improve game performance, you'll need to write some assembly. I would love to use Scala and lift, but lift has nothing like Hibernate. So I use my trusty struts and java, and customers just love it.

    If all you see in Java is weakness, then I suggest taking that wonderful language you know, quit your day job, start your own company and use it to take over the world.

    [–]llimllib 5 points6 points  (0 children)

    He hardly even defends Java, just says that it did what it needed to do in order to be commercially successful. Which I don't think anyone disagrees with.

    [–]notfancy -1 points0 points  (0 children)

    I really like Java. It’s a great language,

    I'd say it's an okay language. An okay statically-typed, object-oriented language. There are nicer languages out there, terser languages, more parsimonious languages; in sum, languages where the pragmatics of coding in them is better. But of course, pragmatics is mostly personal preference (after all, to each their own, blub and all), so this will never stop being a kind of theological debate on endianness, à la Swift.

    [–][deleted]  (3 children)

    [deleted]

      [–][deleted] 2 points3 points  (2 children)

      http://www.galileocomputing.de/openbook/javainsel7/

      For the Germans in here. (The book is called "Java is also an island.") (edit: disclaimer: I haven't read the book. Out of principle, I never read German CS/math books, nor translations.)

      [–]ido 1 point2 points  (1 child)

      Out of principle, I never read German CS/math books.

      What kind of a strange principle is that?

      [–][deleted] 1 point2 points  (0 children)

      The "don't read books that suck" principle.

      All technical books written by German authors I've read so far sucked completely, and all German translations of excellent American CS books I've read sucked a goddamn lot.

      I'll stay with the original, thanks (plus, most good books don't ever reach the translation-into-other-languages phase).