Slashdot Mirror


Love and Hate For Java 8

snydeq writes "Java 8 brings exciting developments, but as with any new technology, you can count on the good, the bad, and the headaches, writes Andrew C. Oliver. 'Java 8 is trying to "innovate," according to the Microsoft meaning of the word. This means stealing a lot of things that have typically been handled by other frameworks and languages, then incorporating them into the language or runtime (aka standardization). Ahead of the next release, the Java community is talking about Project Lambda, streams, functional interfaces, and all sorts of other goodies. So let's dive into what's great — and what we can hate.'"

83 of 434 comments (clear)

  1. I'm disappointed by msobkow · · Score: 2

    I'm disappointed. I expected Lambda functions to be closer to Erlang's implementation, where you can access the variables of the enclosing function/method safely. But perhaps the examples in the article are just too simplistic to show such behaviour.

    --
    I do not fail; I succeed at finding out what does not work.
    1. Re:I'm disappointed by msobkow · · Score: 3, Interesting

      I think the bigger reason they probably didn't do it is that Erlang only lets you assign a variable once, so there are no concurrency issues with read/write of variables. One of the neat side effects of this is that a service/method which takes a lambda argument can be parallelized behind the scenes without changing the meaning of the code execution.

      Another thing that puzzles me is that Java lambdas seem to be based on the idea of overriding a method of a class. That seems to me to be a critically limiting way of implementing them vs. function prototypes/templates, as there is no way to specify multiple lambdas being passed to the evaluator.

      --
      I do not fail; I succeed at finding out what does not work.
    2. Re:I'm disappointed by binarylarry · · Score: 3, Funny

      They're still waiting for the application with the answers to start up.

      --
      Mod me down, my New Earth Global Warmingist friends!
    3. Re:I'm disappointed by pspahn · · Score: 4, Funny

      "Knock Knock..."

      "Who's there?"

      ...

      ...

      ...

      ...

      Java!!!

      --
      Someone flopped a steamer in the gene pool.
    4. Re:I'm disappointed by gstoddart · · Score: 2

      I think the bigger reason they probably didn't do it is that Erlang only lets you assign a variable once

      Hmmm ... I'm not sure I'd call it a variable then. ;-)

      --
      Lost at C:>. Found at C.
  2. Finally Fixing the Date stuff by CastrTroy · · Score: 4, Informative

    Proper date and time handling is one of the reasons I really prefer .Net to Java. The support for dates is just deplorable in Java. One shouldn't have to use an external dependancy, like JodaTime to handle basic date operations. If they could also add a "Decimal" data type, that is, a base-10 decimal primitive datatype, I think Java would be a much more useful language for day to day programming. Almost all the programming I do I would rather use a Decimal data type rather than a float data type, but very few languages support it as a native data type. .Net is one of the few environments where they got this right.

    --

    Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    1. Re:Finally Fixing the Date stuff by msobkow · · Score: 2

      How would your Decimal concept be any more powerful than Number?

      The one thing I wish they'd have done with Number is added Precision and Scale to it's usage, which would be invaluable for things like financial and scientific calculations.

      --
      I do not fail; I succeed at finding out what does not work.
    2. Re:Finally Fixing the Date stuff by CastrTroy · · Score: 2

      They need to support it as a native numeric type, so it's not so difficult to use. If it was a native type with proper mathematical operators you wouldn't need questions on Stackoverflow about how to add two values together.

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    3. Re:Finally Fixing the Date stuff by msobkow · · Score: 3, Insightful

      I'd hardly call it "difficult" to use, any more than it is to use the wrappers for the native types. Still, it would be *nice* if you could use "+" instead of "add()", but really that's just syntactic sugar.

      --
      I do not fail; I succeed at finding out what does not work.
    4. Re:Finally Fixing the Date stuff by Anonymous Coward · · Score: 5, Insightful

      I'd hardly call it "difficult" to use, any more than it is to use the wrappers for the native types. Still, it would be *nice* if you could use "+" instead of "add()", but really that's just syntactic sugar.

      To some extent, anything beyond raw binary notation used by your processor is just some form or another of "syntactic sugar" transformed by some intermediate tool.

    5. Re:Finally Fixing the Date stuff by petermgreen · · Score: 5, Insightful

      People like to dismiss syntactic sugar as unimportant but IMO it's the difference between code that is pleasant to read and write and code that is a PITA to read and write.

      I wish some fork of java would happen and take off that adds back in the basic features sun left out. Stuff like properties*, user defined types without an implicit reference, unsigned numeric types, operator overloading, parameter pass by reference etc. Some of that is syntactic sugar, other parts not so much. Ideally these features would be done in a way that could somewhat work on existing VMs though some features would likely require VM enhancements to operate efficiently.

      Unfortunately MS has already taken the name J++ :(

      * No that javabeans shit doesn't count.

      --
      note: i'm known as plugwash most places but i screwd up registering that here somehow in the past and now can't register
    6. Re:Finally Fixing the Date stuff by viperidaenz · · Score: 5, Informative

      New Java Date Time API for Java8: http://openjdk.java.net/jeps/150
      AKA JSR 310

    7. Re:Finally Fixing the Date stuff by Alomex · · Score: 3, Insightful

      Actually it isn't. The add() method belongs to the first parameter, whereas the native '+' implementation (used to) belong to neither and if you think about it really should be that way.

      '+' is not a method or property of the first parameter. the correct interpretation of a+b is that this creates a unnamed virtual object number tuple with the method add.

    8. Re:Finally Fixing the Date stuff by EvanED · · Score: 2

      Sorry, but if you dont know what an immutable object is, then you need to go back to first or second year CS (depending on where you went)

      Maybe the person asking the question (I didn't look) was in first or second year CS.

      What's even funnier is that the "native type" syntax would also be like immutable objects since you would also need an assignment.
      its
      a=a+b
      not just a+b

      a += b.

      In fact, even well-aware of how it actually behaves,

      a.add(b)

      still seems to me like it should be closer to

      a += b

      than to

      a + b

      .

    9. Re:Finally Fixing the Date stuff by Alomex · · Score: 4, Insightful

      Academic types have rejected 95% of all real advances in programming languages for nearly 4 decades as "syntactic sugar" while they carry on with their abstract type theory which has had rather limited impact in the real world in the same time span.

      Do yourself a favor and do away with the "syntactic sugar" crutch and try to judge a language proposal on it's own merits. Is it better to write 3+5 than 3.add(5) ?

      The answer is obviously YES, so who the hell cares if it is syntactic sugar, syntactic salt or syntactic coconut sprinkles.

      If it makes life better it should be adopted. End of story.
      p.s. there are potential drawbacks with operator overloading, but "syntactic sugar" ain't one of them.

    10. Re:Finally Fixing the Date stuff by jythie · · Score: 2

      I think in general people use the term 'syntactic sugar' when they feel that it does not increase readability. I know I tend to use it to describe features that neither add functionality nor seem to make the code easier or harder to write. Things that do one or the other I just call 'useful'.

    11. Re:Finally Fixing the Date stuff by KonoWatakushi · · Score: 2

      Unfortunately, it seems that JVM based languages are still limited by the lack of unsigned types. What a remarkably stupid decision to omit them.

    12. Re:Finally Fixing the Date stuff by EvanED · · Score: 2

      I've always used "syntactic sugar" to mean language features that are fundamentally implemented in the front end

      But what does that mean? Lots of stuff is implemented in the front end. Without knowing for sure, loops and conditionals are language features that are probably almost always lowered to gotos by the time it hits the back end. Classes are almost guaranteed to be syntactic sugar, even if they have virtual functions. Templates and macros are syntactic sugar.

    13. Re:Finally Fixing the Date stuff by bzipitidoo · · Score: 3, Insightful

      What bugs me about operator overloading is how tediously verbose it can get. For example, say you define operator functions for < and ==. You still have to do <=. Even when all the <= function is is: return this < that || this == that;, you still have to write it. It's so tempting to skip writing the code for an unused operator that many programmers do so. Languages are mostly unable to automatically fill in obvious code of that sort. C++ does have a default assignment operator function, but that's all. Too much chance of the obvious being wrong, so they opt not to do anything.

      To make matters worse, the above implementation of <= is inefficient. Down at the machine level, the computer does not stupidly require 2 separate comparisons to test <=. It has instructions such as JLE. The above function will at the least result in the computer having to do JL; JE;. While JE may be executed only 50% of the time that JL is executed, depends entirely on the data and code, it's still a waste. Further, two branches takes more space in the CPU's branch prediction, and the extra instruction takes more space in cache, so JL; JE is not as good as 50% slower.

      I find your gratuitous slur against "academic types" unwarranted and unfair. Academia has produced much innovation in programming. Do you forget the proof that Structured Programming is sufficient, and GOTOs are not necessary? All the work done on Turing machines, and universal computation? Automata Theory, with the classification of grammars into such categories as "context free"? BNF? Without that academia you sneer at, we couldn't be sure of all that. What of the entire concept of OOP? Where did that come from? And functional programming and LISP? It's easy for some hack to bang out a programming language built around what he feels are a few good ideas, drawn from perhaps years of experience. But without careful examination of the problems, insightful modeling that leads to good, pertinent questions which can be proven one way or another, we would just be flailing around even more than we already do. We might all still be trying to program in ALGOL. I put more trust in academia's ability to create a good programming language than I do a modern corporation with its dismissive attitude towards fundamental research.

      --
      Intellectual Property is a monopolistic, selfish, and defective concept. It is "tyranny over the mind of man"
    14. Re:Finally Fixing the Date stuff by Alomex · · Score: 2

      All the examples you give predate the "nearly four decades" timespan that I wrote about in my post. With those you just have--inadvertently-- confirmed my point.

      Academics made great contributions to programming languages until the "programming languages=type theory" and "usability improvements=syntactic sugar" mindsets crept in. I am far from the first person to observe this btw, e.g.:

      http://matt-welsh.blogspot.ca/2013/04/the-other-side-of-academic-freedom.html?showComment=1366600358822#c5765593833050647322

      Don't get me wrong, I'm all in favor of research. I'm just pointing out that the PL community has chosen a narrow focus of their discipline to the detriment of progress in real life PLs.

    15. Re: Finally Fixing the Date stuff by gmueckl · · Score: 3, Insightful

      Clearly you have not yet had a chance to write code that does real maths with real mathematical types like vectors or matrices. This is wheree operator overloading really shines. You don't want to implement complex formulas with tons of explicit function calls. With overloaded operators you can basically transfer the formulas you calculated on paper into machine code almost exactly. Without them, it's a sad mess of nested function calls, long lines, superfluous temporary variables and almost inevitable mistakes in code that nobody wants to read.

      Of course there are times when operator overloading is exactly the wrong thing to do. But if it is used the right way, it is an amazing feature.

      --
      http://www.moonlight3d.eu/
    16. Re:Finally Fixing the Date stuff by smittyoneeach · · Score: 3, Funny

      Well, you have to instantiate a BigDecimaFactory in the inversion-of-control container and pull in a lot of org.apache.whizbang.dont.we.love.us.some.nested.hierarchies code, plus update your ant scripts to maven, and don't forget to feed the Tomcat, but, with sufficient struggle, you can still get to "Hello World 1.0" in Java.

      --
      Get thee glass eyes, and, like a scurvy politician, seem to see things thou dost not.--King Lear
    17. Re:Finally Fixing the Date stuff by sourcerror · · Score: 2

      I sense a fellow Prolog programmer here.

    18. Re:Finally Fixing the Date stuff by Ksevio · · Score: 2

      Just imagine how many lines of useless java code could be removed if it had implemented properties! No more of these pointless getValue(){return value;} that everyone in the java world seems to admire. if there's a part of your code that can be auto generated, there's a problem with the language.

    19. Re: Finally Fixing the Date stuff by matfud · · Score: 3, Insightful

      As soon as you get beyond complex numbers you rapidly find out that there are not enough operators to overload for operator overloading to make much sense.
      is "*" the dot or cross product or is it convolution or is it correlation or autocorrelation?

      There are not enough operators to make it useful so you have to have method calls anyway. If you are calling methods then it is clearer to always call methods

  3. Re:Nooooo by armanox · · Score: 2

    Oracle is good at one thing: making Larry Elison money. Microsoft isn't sure what they're good at.

    --
    I'm starting to think GNU is the problem with "GNU/Linux" these days.
  4. Re:Gawd by jcr · · Score: 5, Insightful

    Java is a real language, and a lot of real programs have been written with it. It's not a good language, but that doesn't make it trivial.

    -jcr

    --
    The only title of honor that a tyrant can grant is "Enemy of the State."
  5. Re:Gawd by multiben · · Score: 4, Funny

    So you're saying that *all* programming languages are exactly as good each other then? Perhaps you are spending too much time in the "real" world?

  6. Re:Gawd by CastrTroy · · Score: 5, Insightful

    I would almost agree, that any language is as good as any other. With a few exceptions, like "whitespace" which isn't meant to be a practical language anyway. What really sets languages apart is the tooling that's built up around them. The debuggers, the IDE, the profilers, etc. Also, the consistency and extent of the standard API plays a huge role in how useful a language is. I would rather use Brainfuck with an amazing tools and a rich API than use Java, Python, or Ruby with bad tools and an inconstent and incomplete API.

    --

    Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
  7. Re:Gawd by cheesybagel · · Score: 3, Insightful

    Well its a mixed bag really. It is a lot more verbose than other recent languages. The type system is inane. The main advantage is you have binary portability across platforms and a really huge standard API to use.

  8. Re:Gawd by hey! · · Score: 5, Insightful

    Newsflash: People write major systems in Java that work pretty well. People do mission critical, bet-the-company stuff in Java, and it works. *Your* mileage may vary, but it always does.

    This doesn't mean it' the best choice for everything, because *nothing's* the best choice for everything

    And it doesn't mean Java doesn't have serious flaws. There's something deeply ingrained in Java that encourages over-engineering. But every language has its pitfalls.

    --
    Post may contain irony: discontinue use if experiencing mood swings, nausea or elevated blood pressure.
  9. Re:Java? by wmac1 · · Score: 3, Insightful

    Oh boy!! If that's what you understand of java...

    FYI, You are still using java every single day (as in websites using Java in server side, on phones, on smart cards, on home appliances, ...).

  10. The old adage comes back and back by countach · · Score: 5, Insightful

    The old adage is always applicable: Those that do not use LISP are condemned to reinvent it. Badly.

    1. Re:The old adage comes back and back by manu0601 · · Score: 2, Funny

      Sure: reimplement it in Java. Even better, use it within J2EE so that it takes 45 seconds to start up.

    2. Re:The old adage comes back and back by ebno-10db · · Score: 5, Funny

      Sure: reimplement it in Java.

      That's called Clojure.

      Even better, use it within J2EE so that it takes 45 seconds to start up.

      They sped it up?

    3. Re:The old adage comes back and back by phantomfive · · Score: 2

      Clojure is Lisp on the JVM, not Lisp in Java. There's a difference.

      --
      "First they came for the slanderers and i said nothing."
  11. Re:Gawd by Anonymous Coward · · Score: 5, Insightful

    I think one of the big problems is that programmers are very much biased towards thinking that what should be considered matters of preference are absolute right/wrongs, and most of the differences between major languages themselves are simply matters of taste or convenience. It's why you can get almost any software engineer to tear apart someone else's code, even if the code is written as well or better than anything they've written: there's pretty much always small differences that the engineer will find offensive even though there's no practical impact.

  12. Re:Gawd by jythie · · Score: 4, Interesting

    That was my general thought. Most languages are pretty much interchangeable. What tends to set them apart is the ecosystem they exist in... not just in terms of the 'hard' things like libraries and tools, but the 'soft' things like how much of a developer community (and candidate pool) exists for any particular domain.

    Which kinda makes me wonder why language designers bother with these updated versions out side some fetishistic desire to make their language of choice more complicated. Though I guess it does help separate out the 'elite and in the know' from the 'newbies and outsiders'.... though I think C++ really takes the cake in that regard.

  13. Re:Gawd by nmb3000 · · Score: 2, Interesting

    Java is a brogrammer language. It's for people that find writing real programs, in real languages, too hard.

    Well consider this your lucky day! With Java 8 you can now write JavaScript to run inside of Java! Sayeth TFA:

    Netscape created a piece of software called LiveScript to allow for scripting on its Web servers. It decided to port it to its browser and needed a fancier name, so it licensed the Java trademark from Sun and called it JavaScript -- which would long promote the confusion that JavaScript had very much to do with Java. However, after the apAOLcalypse, some members of the 12 colonies of Netscape were not done and sought to continue Netscape's plan of rewriting their browser in Java. In order to do so, it needed to create an implementation of JavaScript in Java. Netscape called the project Rhino; as with turducken, ours is not to question but to enjoy.

    So just in case the seemingly unquashable confusion between Java and JavaScript wasn't bad enough, it's about to get worse. But I guess you can't blame Oracle -- they heard you like to use JavaScript and Java, so now you can JavaScript with your Java while you Java with your JavaScript. Or something. Plus throw in some Node.js bullshit for good buzzword coverage.

    While there are many places that it can be useful to run JavaScript from within Java....

    This is just plain bad.

    --
    "What do you despise? By this are you truly known." --Princess Irulan, Manual of Muad'Dib
    /)
  14. Re:Who has the biggest kitchen sink? by jythie · · Score: 2

    Sadly, people like to think that their tool of choice is the best, and it is the best everywhere and applicable to all situations, thus language designers over time try to make their preferred language more and more like every other language till it becomes and over complicates mess that you basically have to learn half a dozen dialects in order to understand any random chunk of code. Just look at C++, you can almost tell which year the person who wrote the code learned it in.

  15. Re: Gawd by S.O.B. · · Score: 5, Insightful

    I used to work on a Java transaction processing application at a major financial institution that handled more than 1,000,000 transactions a day that consolidated data from Unix, mainframe and Windows systems. The transactions came from batch and online, client-facing applications that had five nines uptime requirements.

    I don't know, sounds major to me. And we had no more "major system problems" than any other app and less than most.

    It's not to say that Java is the answer to everything because nothing is. But it is definitely capable of doing the heavy lifting.

    --
    Some of what I say is fact, some is conjecture, the rest I'm just blowing out my ass...you guess.
  16. Re:Gawd by ebno-10db · · Score: 5, Funny

    May you spend 100 years in purgatory, writing AI programs in COBOL.

  17. Re:Gawd by ebno-10db · · Score: 5, Funny

    Lisp may be an interesting language, but Lispers scare me. The glow in their eyes when they evangelize about the Mother of All Languages reminds me of Village of the Damned.

  18. standardization != stealing by ChaseTec · · Score: 2

    Since when is standardization stealing? Do you think the Redhat/JBoss devs that wrote Seam complained when they were asked to create the CDI spec? Or when Gavin King (creator of Hibernate) worked on JPA? Maybe in some bizarro world standardization actually happens as technologies mature. You can look at the expert list of any of the JSR and see who these *thieves* are.

    --
    My Hello World is 512 bytes. But it's also a valid Fat12 boot sector, Fat12 file reader, and Pmode routine.
  19. Still 32GB barrier by michaelmalak · · Score: 2, Informative

    Java 8 is still limited to 32-bit array indexes, meaning, e.g. that arrays of doubles are limited to 32GB. Java won't get true 64-bit support until Java 9 in 2016.

    1. Re:Still 32GB barrier by Anonymous Coward · · Score: 3, Funny

      Java 8 is still limited to 32-bit array indexes, meaning, e.g. that arrays of doubles are limited to 32GB. Java won't get true 64-bit support until Java 9 in 2016.

      32GB should be enough for anybody.

    2. Re:Still 32GB barrier by GodfatherofSoul · · Score: 3, Funny

      Why would you need an array longer than 2^32? Unless...wait, are you sequencing alien DNA????

      --
      I swear to God...I swear to God! That is NOT how you treat your human!
    3. Re:Still 32GB barrier by countach · · Score: 3, Funny

      I'm sequencing alien DNA you insensitive clod.

  20. Seems familar... by ndykman · · Score: 3, Informative

    I remember when C# and .Net first came out, it was noted that it was just borrowing (some said stealing) from Java. When C# first came out, I didn't see it as becoming a leader in new language features, but it is clearly is, as Java 8 addresses a lot of things that been part of C# for a while.

    Streams: Similar to IEnumerable and parts of LINQ (LINQ to Objects). Of course, IEnumerables are less strict on multiple enumeration (it may work). Being a bit more strict on this as Streams isn't a bad idea. Functional Interfaces; The article was light on details, but it seems to address the use cases that extension methods in C# addresses. Interesting that the body of the method appear in the interface. The ability for a class to override this default is a new idea, it will be interesting to see how this plays out. Not a bad way to go about this at all. Lambdas:Well, it's -> versus =>. I can't imagine the discussions that occurred over which one to choose.

    I'm not sure about the JavaScript in Java feature. But, I've always said being able to execute Scheme in .Net would be useful to me, so this something that MS may have to address down the road.

    For me, Java still needs some catching up in terms of parallel programming versus the Task Parallel Library (and the Dataflow Extensions). This is especially true with C# 5.0. Async and await are powerful language features. Personally, I'm still prefer C#. I like having first class generics, the full LINQ library (Expressions) and libraries like Reactive Extensions and Code Contracts (plus the static verifier) are nice features. But, all this in Java 8lis a step in the right direction. I just hope it isn't a case of too little, too late.

    1. Re:Seems familar... by hibiki_r · · Score: 4, Interesting

      More than reacting to C#, they seem to be reacting to other JVM languages that are just more attractive for any shop with experienced people.

        The JVM is often used to write large amounts of business crud: Take a parameter, query a database, process a list. Make a service call, transform the result into a slightly different list, merge the results with a different service, then return. You could write that kind of computation in a functional way using Groovy or Scala in half the number of statements. And if there's one rule for programming productivity is that the less statements you need to write, the faster the job can be written, and the less bugs you get.

      When the people using your virtual machine start migrating to other languages you do not control, you are at risk of having the people building the language just porting the language away to a different one, and poof, Java becomes obsolete. Therefore, Oracle just has to improve Java.

    2. Re:Seems familar... by elabs · · Score: 2

      C# was a fusion of Java, C++ and Delphi. Java 8 is just playing catch-up, sucking in all the innovation that the Microsoft guys have been doing over the past decade. I think you're right that Microsoft is innovating and blazing new trails at a much faster rate than Oracle can copy.

  21. Re:Gawd by hedwards · · Score: 2

    That's sort of the point of the language. The ability to write once and not have to rewrite the entire thing because you're now on a different platform.

    Your complaint is sort of like complaining about how hard assembly is and how they should figure out how to make it more easily read and do things for you.

  22. Re:Gawd by Coryoth · · Score: 5, Insightful

    And it doesn't mean Java doesn't have serious flaws. There's something deeply ingrained in Java that encourages over-engineering. But every language has its pitfalls.

    I don't think there's much in Java the language that encourages over-engineering; it's more in the community that surrounds Java. It's in the tutorials, and books, and code examples and discussion groups . It's in the frameworks and libraries.

    The reality is that a "language" is as much shaped by the community that grows up around it as by the actual language itself. Perl doesn't have to be particularly unreadable, but the culture that grew up around perl in the late 90's that was obsessed with cute hacks, fewest keystrokes, and self created obscurity created a state where anyone learning perl was immersed in that culture and came out writing a lot of unreadable stuff. It is my understanding that since many of those programmers left perl for other languages perl has been remade as "Modern Perl" which is largely the same core language, just with a different and libraries, and is quite readable.

    Conversely python can be made quite diabolical (just through together chains of nested list comprehensions and single character variables for example), but because it grew up with a culture of "one obvious way to do it" and readability most code you'll see tends to eschew such things, and strive to read like pseudo-code. Again, there's not that much inherent in the language, it's the cultural conventions surrounding the language that enforce much of that.

    Java fell in with the Enterprise crowd, and consequently found itself immersed in a culture obsessed with design patterns and over-engineering. Had things gone a little differently with, say, in browser applets somehow becoming the primary driving force for java (let's assume they ran better say) then I doubt java would be known for over-engineering.

  23. Re:Gawd by gnupun · · Score: 5, Insightful

    I would almost agree, that any language is as good as any other. With a few exceptions, like "whitespace" which isn't meant to be a practical language anyway.

    This is a false statement, they are not as good as the other. Each language is designed to be strong in certain areas while weak/ignoring other areas. As an example, C promotes code close to machine language while Java shields the programmer from manual memory management (GC). There are many such design issues that make a language a natural fit for certain applications while making other languages ill-fitted.

    What really sets languages apart is the tooling that's built up around them.

    While tools may be important, they are of a secondary importance.

  24. Re:Guy Steele by ebno-10db · · Score: 2

    The email you cite also contains (quoting a previous email?) what I've long considered the real secret of Java's success:

    Java did not achieve acceptance based mainly on the
          features it has (or does not have). It was accepted because
          Sun expended a huge amount of effort (not to mention money)
          promoting Java and the things built from it, and wisely
          positioned it against the nightmare that is C++.

    The Guy Steele wrote:

    We were not out to win over the Lisp programmers; we were after the C++ programmers. We managed to drag a lot of them about halfway to Lisp.

    Halfway to Lisp? Other than GC, there isn't much about Java that's Lisp like. Guy was rationalizing.

    IMHO, without Java being pushed as an alternative to C/C++, I don't think we would have gotten the renaissance of dynamic languages we have today

    I think Moore's law had a lot more to do with it than Java. Computers are now fast enough and have enough memory that you can afford to write many things in languages that are slow and memory intensive.

  25. Stealing? by greg_barton · · Score: 2

    So if another framework or language has a certain feature Java isn't allowed to have them?

    Really?

  26. Unsigned by jbolden · · Score: 3, Informative

    I'm not sure how that connects to the GPs request. Anyway Gosling didn't include it because the behavior aren't defined in CPU independent ways.

    32-unsigned 0 minus 32-unsigned 1 = ?
    where ? is CPU dependent. Some you'll 0xFFFF other 0x8001 others 0xFFFE. That's precisely the sort of thing JAVA was designed to abstract away. And if you don't want unsigned to be doing raw CPU arithmetic on primitives then you can just use a library.

    1. Re:Unsigned by aztracker1 · · Score: 2

      How is int_minvalue - 1 handled? In .Net without an unsafe directive, it does bounds checking on the result and raises an exception.

      --
      Michael J. Ryan - tracker1.info
    2. Re:Unsigned by jbolden · · Score: 2

      Take a look at any CPU architecture where the addition or subtraction isn't defined the same as the standard. The "addition" used by the C compiler is a short function. Similarly for subtraction... Just look at the assembler.

      A lot of this conversation happened in the late 1980s during the X3J11 meetings in places like the discussion of limits.h as far as the standard. I'd say Plauger's book is a good source I don't know what's online.

    3. Re:Unsigned by jbolden · · Score: 2

      Java has found some masterful ways of getting performance well above scripting engines for some things. They might have been able to pull it off with weird unsigned types. But ultimately the reason for C to have all these complex binary types is they encourage bit level thinking about programs. Java for safety reasons can't. I don't really see how a primitive unsigned type is useful for anything other than speed. Generally what people want unsigned for would be better to implement the way .NET does it where you get reach features so that 3 - 7 throw an exception rather than say returning 4 billion or 2 billion or something.

    4. Re:Unsigned by shutdown+-p+now · · Score: 2

      That makes no sense. How exactly is unsigned arithmetic not cross platform? It's the most basic arithmetic that any CPU can support!

      If you mean that wrap-around isn't cross-platform, then it isn't for signed arithmetic, either. In fact signed is less portable because there are more possible binary representations of it compared to unsigned.

  27. Re:Gawd by Anonymous Coward · · Score: 4, Insightful

    Lisp is the perfect example of CastrTroy's point -- for a long time the interesting development tools were proprietary, expensive, and obscure.

    That's not the real problem with Lisp, Smalltalk etc though.

    The real problem is that you don't get to benefit from their strengths unless you live completely in their environment. Working with Lisp in a C* based world is like driving a car in the ocean.

  28. Scheme in .NET by zjbs14 · · Score: 2

    In case you weren't aware of it: http://ironscheme.codeplex.com/

    --
    No sig, sorry.
  29. Re:Gawd by tlambert · · Score: 2, Insightful

    I would almost agree, that any language is as good as any other. With a few exceptions, like "whitespace" which isn't meant to be a practical language anyway. What really sets languages apart is the tooling that's built up around them. The debuggers, the IDE, the profilers, etc. Also, the consistency and extent of the standard API plays a huge role in how useful a language is. I would rather use Brainfuck with an amazing tools and a rich API than use Java, Python, or Ruby with bad tools and an inconstent and incomplete API.

    I think it would be very difficult to convince Terumo Cardiovascular Systems to build their next blood gas monitor system, or any of their medical devices, on a Java substrate. I think it would be difficult to convince Radiometer Inc. to base their next portable point of care immunoassay system on a Java substrate. I will go further: I doubt you could get any company working on life support systems of any type to trust Java enough to use it as a substrate.

    Java is not suitable for a great number of applications, and, indeed, any language that uses a runtime system, and is either interpreted or JIT'ed, or not, is unsuitable for those applications.

    For those applications, you need a language that compiles to ROMable machine code.

    For applications like industrial control systems, both in manufacturing, and, again in life support, such as the control systems in nuclear facilities - or even coal-fired facilities, if they happen to have their output powering a pediatric ICU, any garbage collected language is unsuitable, since there is very little control, without infinite memory available, on when a GC will run. You can not implement hard real time in a GC'ed language.

    For those applications, Java is unsuitable.

    There are some languages suitable for those applications: assembly, C, Ada, FORTRAN, C++ (if you disable RTTI and certain aspects of polymorphism, and use an older version, rather than the current draft standard version). There are others, but they are infrequently enough practiced that they would be suspect, both in their mathematical provability, and in their ability to be audited for coding errors.

    So No, any language is NOT as good as any other. Not even close.

  30. Re:Gawd by oldhack · · Score: 2

    Java was a GOOD language, because before we had C++.

    --
    Fuck systemd. Fuck Redhat. Fuck Soylent, too. Wait, scratch the last one.
  31. pointless by stenvar · · Score: 2

    The basics still are wrong: generics still are slow and poorly implemented and Java still is bad for numerical apps.

  32. Re:Gawd by viperidaenz · · Score: 3, Informative

    A lot of medical devices are built using Java.
    First Google result: http://www.oracle.com/us/technologies/embedded/embedded-java-for-healthcare-433550.pdf

    It's been used in medical devices since the late 90's, shortly after it was invented.

    For those applications, Java is purpose built.

  33. Re:After years of saying java didn't need C# featu by nitehawk214 · · Score: 2, Insightful

    After years of saying java didn't need C# features they go and steal tons of them from C#! Whether it's properties, lambdas, function pointers or async/await, the Java community has always insisted that those features weren't necessary and that Java was no worse for omitting them. Now they go and steal them and put them into their products and everyone will declare them innovative new Java features. Last month it was Apple stealing the "Metro" UI from Windows Phone. Now this. Is Microsoft the ONLY company doing anything innovative anymore?

    Right, lets pretend Microsoft invented all of those things.

    --
    I'm a good cook. I'm a fantastic eater. - Steven Brust
  34. What's the realistic alternative? by SpaghettiPattern · · Score: 2

    What's the realistic alternative to Java? Java is good enough and the main gripe is that Oracle is loosing the trust that Sub Microsystems built up.

    C# just isn't for political reasons. Financial institutions are very influential in programming languages becoming significant as they are the ones with deep pockets that hire huge amounts of -admittedly mediocre- programmers. So far all large to huge financial institutions I know bar Microsoft from entering their data centres.

    So, what's the realistic alternative to Java that financial institutions will embrace?

    --

    I hadn't the slightest objection to his spending his time planning massacres for the bourgeoisie... (P.G. Wodehouse)
  35. Re:Gawd by tlambert · · Score: 2

    A lot of medical devices are built using Java.
    First Google result: http://www.oracle.com/us/technologies/embedded/embedded-java-for-healthcare-433550.pdf

    It's been used in medical devices since the late 90's, shortly after it was invented.

    For those applications, Java is purpose built.

    This PDF is Oracle's "Markitecture" -- it's how they want things to work. They have not certified and indemnified their embedded JVM for use in life support systems. Don't expect them to. Don't expect a device manufacturer to bear the costs of certifying both the JVM and their application specific code, as a combination, for that use. IT's not going to happen.

    Yes, my Java ring is in a box in my workroom... I do not wear it every day and do Green Lantern-ish stuff with it, like Sun was predicting would happen when they gave them away at Java One.

  36. Re:Gawd by aztracker1 · · Score: 2

    The fact is it's a bit of a self-propagating system. Kind of like it's current owner Oracle in general. Programmers who work in those environments persist their poorly performing "enterprise patterns" to the exclusion of other options. It happens in .Net too. I don't even blame the language so much as the developer ecosystem. I can't tell you the number of times I've seen in Java and .Net entire structures of Interfaces, and Classes, and Factories that which could be solved in a couple dozen lines of code in a single class. Sometimes the simpler, less enterprisey way is the better way. I even had friction from an enterprise architect trying to introduce automagic WCF client creation/registration in a solution that was already using Unity instead of explicit clients to the explicit service binding(s) implemented as a passthrough of the original interface. Fortunately, when I showed that it could be done wiring up a service binding with a single line, and the client with a single line in the config file, it was a much easier sell for the rest of the developers. Abstraction is awesome when it means less code, and less configuration. If that means writing an abstraction once to get that with all services, cool.. if it means having layers of crappy interfaces with only a single concrete implementation for no other reason, I'm less for it.

    I've spent most of the past year and a half with my time split between .Net and NodeJS... and I have to say, even without all the type safety and intellisense of VS and .Net, that I find NodeJS solutions, even relatively large ones (properly split up into testable, reusable modules) to be far nicer to work with than either Java or .Net have been. I'll take an application with a simpler codebase, with good unit test coverage any day. That's the difference of a platform more than the language itself.

    --
    Michael J. Ryan - tracker1.info
  37. Re:Gawd by gigaherz · · Score: 4, Interesting

    Try "debugging with print statements" when the codebase takes over 10 minutes to compile, and that's when the resources don't need to be re-processed. After you admit to that, the rest of the post can't possibly be taken seriously.

  38. Re:After years of saying java didn't need C# featu by benjymouse · · Score: 3, Informative

    Right, lets pretend Microsoft invented all of those things.

    If you had been following the language discussions for (for instance) lambda-J you would realize that there is a LOT more to it than simply deciding that a language must have this or that feature.

    Specifically, both Java and C# are statically typed languages (although in C# a variable can be statically typed to be dynamic, but I digress) with advanced multi-generation garbage collection, structured exception handling, generics etc. Any new concepts introduced into the language must respect the concepts already there. Designing new features for Java or C# requires significant amount of innovation to solve the interference problems and maintaining the "feel" of the language.

    LINQ is a real accomplishment, one that I have not seen put together like that in any other language. Yes, list comprehensions existed before. Yes, expression trees (ASTs) have been used in LIST and several other languages before. Don't know about extension methods, but I'm sure that there must be some research language. Yes, type inference had been used before. Yes, inferred classes must have been used in some language before. Certainly lifted types are well-known in certain other languages. But putting the whole package together and make it fit seamlessly with (and complement) the existing features and at the same time keep it so simple and generic that the useful parts are actually library features, that is a real accomplishment.

    Reactive Extensions is real research (primarily by Erik Meijer who has regrettably now left Microsoft to return to academia). Not least because it ties to beautiful in with LINQ. It is entirely new? No, as Erik himself would say, IEnumerable is just a monad. IMHO that does not take away from the accomplishment.

    Async and await are *really* cool and have inspired Scala to create something similar.

    No, Microsoft didn't invent "all of those things". But fitting them in with a curly-brace, statically typed language is real innovation.

    --
    Reading slashdot one-liner: (irm http://rss.slashdot.org/Slashdot/slashdot).rdf.item | fl title,desc*
  39. Re:Gawd by DrXym · · Score: 2
    Java is horribly verbose at times. Not Cobol bad, but insistent on needlessly complicating code with anonymous inner classes, decorations and so on. IDEs take most of the sting out of this but there are still some obvious improvements that could have been lifted from contemporary languages like C#, Groovy etc which would have made life easier and code a lot more readable - mixins, auto types, lambda, embedded dsls and so forth.

    Still, the platform itself is enormously powerful and well supported in software and hardware which is why it is so popular in the enterprise. It's stable, it's scalable and it's portable.

  40. Re:Answer not obvious by gbjbaanb · · Score: 3, Insightful

    no, all you "know" is that there is a method called "add" on the object named 3 that is being called with the parameter 5.

    So the 'add' method could easily carve 3 and 5 on a tree. You have no way of knowing what it does just from the method name. The classic example is string::add(). Does "hello".add("world") produce "hello world" or does it only apply to "3".add("5") to produce "8"? You may criticise operator+ for this reason, but note that the add() method is just as bad.

    So there is no difference between the operator+() method, and the add() method (except the name chosen, and the way its written by the developer).

    Now we've established that there is no difference between the two, we can say that as normal humans are the ones that read and write code, the former, operator, mechanism is easier to read, write and understand, then it is the one that should be preferred.

  41. Re:Gawd by serviscope_minor · · Score: 3, Interesting

    I don't think there's much in Java the language that encourages over-engineering; it's more in the community that surrounds Java. It's in the tutorials, and books, and code examples and discussion groups . It's in the frameworks and libraries.

    Indeed. The C++ world used to be like that. The sort of people who read the treat the design patterns pook not as a useful guide and taxonomy but as a way of life. They used to do the same stuff in C++ with massive class heirachies. I think they tend not to be very good programmers and they migrated en-masse to Java since it has fewer pitfalls. The C++ community has changed considerably since then and the modern style is very different.

    I don't think that really says anything about the C++ language or the Java language. As a dyed-in-the-wool C++ programmer, going over to Java, I was firstly not at all surprised by the legendary overengineering, but was surprised that there seemed to be nothing in the language making people write overengineered code.

    Don't get me wrong. It's not my favourite language: I find it a little dull and a little verbose, but it does not seem to be bad.

    It is my understanding that since many of those programmers left perl for other languages perl has been remade as "Modern Perl" which is largely the same core language, just with a different and libraries, and is quite readable.

    Much the same thing is happening in C++. The community (myself included) went mad with excessive template metaprogramming shortly after the mad with design patterns crowd left. It all seems to be calming down and the modern "Stroustrup style" (as it's known and given the name given to it is probably not all that new) of basically doing the sensible thing seems to be slowly taking over.

    --
    SJW n. One who posts facts.
  42. Re:Gawd by RabidReindeer · · Score: 2

    Java was a GOOD language, because before we had C++.

    One of my favorite definitions: "Java is like C++. But without the mace and knives."

  43. Re: Gawd by RabidReindeer · · Score: 3, Informative

    So, 6,000,000 orders per second on a single Java thread on commodity hardware isn't good enough for you?

    http://martinfowler.com/articles/lmax.html

    Java does major heavy lifting, and is extremely fast, if you know what you're doing.

    You can try to make minor parts of the program faster by calling C++ via JNI, but you risk harming performance in the long run, because then the JIT compiler can't inline or otherwise optimise that part of the code.

    Of course, you can make any language slow if you mess up enough.

    Benchmarks have been done and Java can often out-perform C (and C purists will point out that C++ has its own inefficiencies). The reason being that in addition to garbage collection, modern-day JVMs often "waste" time analysing code execution and re-optimizing dynamically, which is something that C cannot do.

    A lot of things that are more efficient done small-scale become relatively less efficient when done large-scale. So much that the large-scale applications can actually benefit even further from processes that would be prohibitive on the small scale (such as on-the-fly re-optimization).

    Even memory management can sometimes be more efficient when garbage-collected if the dynamic memory base is large enough and organized in the right way, replacing thousands of small memory transactions with one big one that reclaims whole blocks of memory at a swoop.

    There's simply no one absolute answer. Only fools look for silver bullets or the One True Religion. But Java found its niche in high-performance, high-reliability backends and so it has received a lot of attention over the years towards making it handle that sort of stuff well.

  44. Re:Gawd by RabidReindeer · · Score: 2

    That's not over-engineering so much as a lack of decent functionality in the JDK. Having things just work right out the box is one of the things I miss the most after I switched to java.

    Java is over-engineered in large part because it's used on large-scale projects where the quick-and-dirty approach doesn't hold up. From time to time, I've had to chastise people for attempting to use J2EE for stuff that doesn't deserve to be written in anything more complex than PHP.

    Then again, Sun made some really wretched design decisions. They're (as Oracle) now about to institute the third attempt to get dates, times, and calendars made easily usable. Although part of what made the first attempt so bad was that they DIDN'T over-engineer it. When you're programming for the World-Wide Web, you need support for multiple timezones and things like countries which use lunar calendars.

  45. Re:Gawd by CastrTroy · · Score: 2

    But how it's compiled isn't part of the language, it's part of the tool-chain. PHP is an interpreted language, unless you work at Facebook, where they have this compiler that turns PHP into C, after which, you can easily compile it to a native executable. Which was kind of my point. When you say you want to use C, Assembly, Fortran or Ada for those applications, what you're really saying is you want a language where the existing tool chain supports compiling down to machine code. You're actually choosing based on the tool-chain, and not on the actual properties of the language itself.

    --

    Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
  46. Re: Gawd by deKernel · · Score: 2

    As someone who mainly does C++, I have to whole-heartly agree with you. There is no silver bullet when it comes to the world of high performance transaction processing systems. 9/10 times, it is not the actual speed of the system that really dictates which language should be used, it is peripheral requirements that can make one language over another a better choice (i.e. does your development/support staff have more experience in one language over another so minimal training required). 15 years ago, I would have said that Java was more than likely not the best choice (note: not the best but more than likely capable) but not any more. The JRE has improved sooooo much that it can run neck-n-neck with unmanaged code in most environments.

  47. Re: Gawd by RabidReindeer · · Score: 2

    Benchmarks have been done and Java can often out-perform C

    Cite? I've often seen that claim but don't recall many benchmarks. Maybe somebody found a ten line loop that a JIT optimizes the hell out of, but I'm very skeptical that Java can regularly outperform C.

    Lies, Damn Lies, and Benchmarks, as they say. Actual mileage may vary. For short runs, the sheer overhead of setting up a JVM puts it out of the running. For server systems running more or less continuously, the startup time becomes negligible. Loop optimization is probably not one of the things that Java can optimize better than C. On the other hand, on a lot of systems, there's a significant difference in the amount of time that it takes a conditional branch instruction to take the branch versus going straight. A C compilation produces static code and if the worst-case optimization (branch taken) is selected, that's the end of the story. A JVM monitoring performance can detect this sort of thing and rewrite the code to minimize the number of times the branch is taken. Needles to say, a 10-iteration loop run once a day isn't going to benefit, but a routine that runs millions of times an hour will.

    For some actual numbers, I asked my friend Google and managed to find some cases where people did a head-to-head with a greater or lesser degree of honesty (Lies, Damn Lies, ...).

    Here's one:

    http://keithlea.com/javabench/

    A Wikipedia discussion, for contemplation by those who don't knee-jerk reject Wikipedia:

    http://en.wikipedia.org/wiki/Java_performance

    And something a bit more scholarly:

    http://scribblethink.org/Computer/javaCbenchmark.html

    And something from IBM on Java's memory-management performance:

    http://www.ibm.com/developerworks/java/library/j-jtp09275/index.html

    Something I read a while back and cannot recall now asserted that Java won most of their benchmarks except for those involving floating-point numbers. The reason being that C could use the processor's native FPU, but Java's "Write Once/Run Anyware" requirements forced it (unless overridden) to use IEEE Floating-point, which often had to be done in software.

    IBM is a big Java proponent. The modern zSeries machines include 2 FPUs. One for the original, rather strange S/360 FP format and the other for IEEE. Not a co-incidence, I suspect. Reminds me of how a group of Honeywell engineers got together with an OS that had been written under government contract for NASA (thus available for public use), and designed a computer whose instruction set was optimized to run FORTRAN. They called they company Prime Computer.

  48. Carry Flag by krischik · · Score: 2

    True. CPUs do roll over.

    And thinking of it (and correcting myself): Ada does for unsigned typed as well. Not for signed. There a RANGE_ERROR is raised. Strange but sometimes useful asymmetry.

    But that does not invalidate my statement. All CPU I know of (there might be others, more exotic CPUs of course) set a carry and/or overflow flag on signed and unsigned roll-overs as well. One does not exclude the other here.

    In 8 bit times those flags where extremely important to do 16 bit operation with only an 8 bit arithmetic logic unit. That is why it is called carry flag. And of course you can branch on the carry flag set or unset.