Slashdot Mirror


Slashdot Asks: What Are Your Favorite Java 8 Features? (infoworld.com)

New submitter liveedu shares with us a report from InfoWorld: When Java 8 was released two years ago, the community graciously accepted it, seeing it as a huge step toward making Java better. Its unique selling point is the attention paid to every aspect of the programming language, including JVM (Java Virtual Machine), the compiler, and other help-system improvements. Java is one of the most searched programming languages according to TIOBE index for July 2016, where Java ranks number one. Its popularity is also seen on LiveCoding, a social live coding platform for engineers around the world, where hundreds and thousands of Java projects are broadcasted live. InfoWorld highlights five Java 8 features for developers in their report: lambda expressions, JavaScript Nashorn, date/time APIs, Stream API and concurrent accumulators. But those features only scratch the surface. What makes Java 8 amazing in your opinion? What are your favorite Java 8 features that help you write high quality code? You can view the entire list of changes made to the programming language here.

53 of 427 comments (clear)

  1. Could you gush a little more? by Anonymous Coward · · Score: 4, Funny

    Seriously? This is "journalism"? It's just a gushing promotion.

    My favorite features are the brutally awful runtime performance and the incompatibility from one JVM/J2EE server to the next. Just awesome.

    Runner up "feature" is the litigous vendor behind it all. I just *looooove* Oracle. They are such nice people!

    1. Re:Could you gush a little more? by RobotRunAmok · · Score: 4, Insightful

      No, it's not journalism. It's another in Infoworld's tedious astro-turf-by-story-submission stories. They pay Slashdot, have one of their Marketing Chippies put together a story with a link back to their trade mag, and the skids are greased for it to hit the main page here as scheduled. (snydeq is their usual flunky) The incredible -- or just-precious -- part of it is that InfoWorld believes there is enough of any critical mass of programmers or software industry decision-makers who still frequent Slashdot to make this a worthwhile media buy for them.

    2. Re:Could you gush a little more? by squiggleslash · · Score: 4, Interesting

      I've been debugging and rewriting a lot of legacy C# code recently, and I have to say that it's a breath of fresh air. I used to advocate Java, before Oracle went crazy, but after using C# I never want to touch that bureaucratic pile of over engineered crap and its litigious nutcase "owner" again.

      Google: please, please, consider switching. You could even piss Oracle off by porting over the official JVM to Android, writing a Dalvik to Java byte code convertor, and letting legacy Java Android apps run at 10% of the speed they're supposed to, just to simultaneously encourage developers to move to C# and to end the lawsuit with Oracle completely unable to do anything about it.

      --
      You are not alone. This is not normal. None of this is normal.
    3. Re:Could you gush a little more? by cpm99352 · · Score: 2, Informative

      The incredible -- or just-precious -- part of it is that InfoWorld believes there is enough of any critical mass of programmers or software industry decision-makers who still frequent Slashdot to make this a worthwhile media buy for them.

      Well, I'm both a programmer and a decision maker, and I really wonder about the motivation of someone who would pick Java for a new project. Oracle is beyond toxic.

      I'm a certified Java Programmer (1.4) and really don't advertise it any more. Oracle's Java is dead to me.

    4. Re:Could you gush a little more? by meta-monkey · · Score: 2

      The documentation for C# (and to be honest all of Microsoft's recent offerings) is phenomenal. Easy to read, easy to search, well referenced, lots of examples. The language itself is modern, sleek, well thought out, and has incredibly useful features like LINQ that simply no one else has.

      As a linux nerd I spent two decades laughing at M$'s incompetence. But I have to give credit where credit is due. I hate the fact that C# is my current favorite high-level general purpose language.

      --
      We don't have a state-run media we have a media-run state.
    5. Re:Could you gush a little more? by Clsid · · Score: 2

      C# IS a better language by far. The reason Java made it that big was because people wanted an alternative to Microsoft so bad and Java was the Android of the time. Well that and the massive hype during the dot-com bubble era.

    6. Re:Could you gush a little more? by erapert · · Score: 2

      Who has the luxury to start a made to last new project from scratch except maybe some opensource zealots?

      If no one has that luxury then shouting "rah rah Java!" from the rooftops also does no good since everyone in this hypothetical is already stuck with whatever language their project was written in.

      But that world isn't real. Instead, some of use do start new projects and we do think about what tool to use.

      And Java is the absolute last tool I will ever use... except Oracle's database: that comes below even Java.

    7. Re:Could you gush a little more? by shutdown+-p+now · · Score: 2

      Every other tech that is somehow competing has server drawbacks. I don't see anyone doing enterprise software in Python, C++ or C#/.Net ...

      If you don't see anyone doing enterprise software in C++ or C#, you haven't looked hard enough. There are thousands of companies doing exactly that. Heck, go check out any job search site.

      One particular trap that you may be falling into is assuming that your local market is representative of other places. Some geographic regions can become locally locked in to some tech that dominates the market in that region - Java, Delphi, VB, you name it. These come and go, though, and of course, being local, they don't necessarily correspond to the bigger trend.

      An no other 'ecosystem' is as dynamic and moving quickly as Java is

      I have no idea what your definitions of "dynamic" and "moving quickly" are, except that they clearly aren't mainstream.

      In terms of moving quickly, Java is the laughing stock - they took several years to implement lambdas, for example, and they were overtaken even by C++ in the process, being pretty much the last mainstream language to get them. Even then, the result is a crapshoot due to the lack of reified generics, requiring tons of interface definitions to cover a very basic subset of functions taking/returning primitive values while avoiding boxing and the associated perf issues.

      In terms of dynamic, obviously, Java can't really compete with a true dynamic language like Python. But even C# leaves it far behind in that regard, with opt-in duck typing.

      thanx to ByteCode and ByteCode morphing technologies.

      Bytecode is an implementation technique predating Java by 30 years or so, and is used by most VMs out there. Including C# and Python. C# ramps it up a notch by providing AST-like expression trees as a first-class data type, which can be inspected and changed at runtime before they get compiled to bytecode.

      Stuff like Annotation processing, Byte Code Weaving, Hibernate, AspectJ etc. simply don't exist in such abundance outside of the JVM ecosystem.

      Every single thing that you've listed exists in other ecosystems. In some cases it's direct ports of the same projects even. As for abundance, who needs that in the enterprise? What people want is a single stable implementation that everyone can standardize on.

      Standards, like servlets etc. only Java has that.

      Care to list a single ISO or ANSI standard that defines Java language or VM?

      C++, for example, is standardized by ISO, both the language and the standard library. An older version of C# the language (sans standard library) is also an ISO standard.

      And who uses servlets in 2016, anyway?

      People who don't grassp that Java (the platform) is the most solid and most flexible and most avangard platform for anything around software, simply should not work in the software business.

      People who don't grasp that creating a religious cult around a piece of software is a bad idea shouldn't work in the software business.

    8. Re:Could you gush a little more? by jandersen · · Score: 2

      How can you possible think that? C++ is just class slapped on C. The fact that you need to define your private fields and methods publicly in the header file makes C++ just a cripple as an object oriented language. The rest is just good to obfuscate your code, i.e. op-overloading and templates.

      I suppose it is a matter of taste what you consider good, and I have no problem accepting that other people don't have the same likings as I do, but I will try to explain. Firstly, I think your description of C++ is wrong; a huge amount of very careful considerations have gone into the design of C++ from the very beginning. Bjarne Stroustrup, for all that he's a Dane (like me), is actually a clever guy. Your reasons for not liking the result should not include the assumption that it is "just class slapped on C", I think, since it is grossly inaccurate.

      Next, there is no need to define private fields and methods in a publically available header file; just like Java has its interface classes that are meant to protect the public from viewing the horrors that lie within, in C++ you achieve the same by creating a class with only pure, virtual methods, and then inheriting that from your implementation. This of course forces you to define getters and setters, which many don't like, but that is at least one way to do it.

      Overloading is an obvious idea, at least if you have some background that involves mathematics; all languages I know, except for assembler and possibly COBOL, have operator overloading in some limited fashion: integers and floating point numbers are different data types, but for both, we want to be able to use arithmetic operators. And it is not that much of a stretch to imagine other cases where you might want to do the same - strings being one example. But as we know from pascal vs C, there are more ways than one to implement strings, so although the concept of how '+' and '==' should work is obvious, the details are not. Without expanding too much, I think the rationale behind overloading is very reasonable; but of course, it also opens up for stupid misuse cases - there is nothing to stop people from changing '+' to mean something like 'division', except for common sense.

      Templates is "macros with syntax check", in a way; it is an incredibly strong tool, and I find it hard to imagine how one would implement design patterns without templates, but just like all other power tools, you need to know what you are doing - and in most cases you should choose a smaller tool.

      Finally, the reason I like C++ is the same reason I like C: C is a very clean language - the syntax is a very good compromise between the minimal and the practical, and it is what I, perhaps incorrectly, call 'logically complete'. Somebody (K&R, probably) very carefully designed the language, so that the only limitations are the ones set by the external parameters (like available RAM), not by arbitrary design decisions. The same is true about C++, but when you add things like multiple inheritance, overloading and all the other stuff to C, things will necessarily get much more complicated. However, the added complexity is only the minimal, logical consequence of the extra syntax. The upside of this is that although it is more complex, it is so in a natural manner, and that makes it relatively easy to see what the correct syntax is. And that is, in essence why I like C++ and think it is the best implementation of OOP.

      A simple example: In mathematics, a vector space is a set of objects for which linear combinations are defined: a*V+b*U, where U, V are your 'vectors' and a, b are 'scalars' (and I'm being deliberately vague on what scalars could be). The interesting thing about vector spaces is that no matter what the actual vectors are, they all follow the same, basic rules. Operator overloading would enable me to define what '*' and '+' might mean; just as in maths, a vector could represent geometric objects ('directed line segments'), functions whose values can be added and multiplied (c

  2. System.exit() by oddware · · Score: 2, Insightful

    It's the best thing java can do

  3. Promoted? by bengoerz · · Score: 4, Insightful

    This user's entire submission history consists of 2 stories about Java within an hour of each other. Smells like shill.

  4. New and exciting ways to run out of heap space by Anonymous Coward · · Score: 2, Insightful

    No more permgen!

  5. Decimal Numbers? by CastrTroy · · Score: 3, Interesting

    Have they added support for decimal numbers yet? .Net has had support for decimal numbers for quite a few years now (At least since 2003). It comes in really handy for doing applications dealing with money, which quite a lot of applications deal with. Floats and doubles don't work well with currency values as they can't hold exact decimal values for many commonly encountered numbers. There are work arounds like using integers to store the number of cents, and using classes like BigDecimal, but both of those have quite a few drawbacks.

    --

    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:Decimal Numbers? by ADRA · · Score: 3, Informative

      Looks like you're looking for "JSR 354: Money and Currency API" Its an API, not language primitive. Its not surprising given that decimal numbers are essentially strings for all tense and purposes with some convenience math features wrapped around them. Outside of said library there are probably dozens of math libs that you could work with for your fixed size precision needs.

      --
      Bye!
    2. Re:Decimal Numbers? by gerald.edward.butler · · Score: 5, Informative

      BigDecimal is not a work-around. It is the exact solution to the problem.

    3. Re:Decimal Numbers? by CastrTroy · · Score: 4, Informative
      It works, but it makes your code kludgy. Without operator overloading, you have to do fun things like a = b.add(c) just to numbers together. Just hope you never have to do a complex mathematical operation. It's much harder to see what's going on when you can't use things like BigDecimal. Even a simple comparison just gets ugly.

      if ( bigDecimal1.compareTo(bigDecimal2) < 0){
      ...
      }

      --

      Anthropic principle: We see the universe the way it is because if it were different we would not be here to see it.
    4. Re:Decimal Numbers? by 110010001000 · · Score: 2

      You round down the cents and transfer the fraction into your back account. I knew three guys who did that and got away with it.

    5. Re:Decimal Numbers? by RoccamOccam · · Score: 2

      For future reference, the phrase should be "for all intents and purposes".

    6. Re:Decimal Numbers? by arth1 · · Score: 2

      The base unit is cents, not dollars, anyway. (In the US)

      No, that would be mill, which is defined by congress as the "lowest money of account, of which 1000 shall be equal to the federal dollar".
      Except for property taxes and gasoline prices, it's generally rounded to the nearest cent, though.

    7. Re: Decimal Numbers? by AmazingRuss · · Score: 5, Funny

      Tents for porpoises?

  6. Major features are complementary by benjfowler · · Score: 5, Informative

    The biggest news in Java 8, obviously, are lambdas, but they also fit together with functional interfaces and java.util.stream.Stream to really change the way you build stuff in Java.

    I'm absolutely loving, after making use of Java 8 streams, just how clean, succinct and compact a lot of my new code has become.

    Oh -- and yes -- Java now has monads:


    public String getLastFour(Optional employee) {
    return employee.flatMap(employee -> employee.getPrimaryAddress())
    .flatMap(address -> address.getZipCode())
    .flatMap(zip -> zip.getLastFour())
    .orElseThrow(() -> new FMLException("Missing data"));

    }

    See here

    (Now if only they borrowed a bit more heavily from Scala or even C#: stuff like a Try monad, tuples and tuple destructuring and proper pattern matching (like C# is getting) would be awesome. Although given the glacial pace of standardization in Java-land, I'm not holding my breath.)

    1. Re:Major features are complementary by Ksevio · · Score: 2, Interesting

      But wait! It gets worse. You can't call these long function names directly on a data structure, you have to first get a stream which then can take map functions and then you have to convert it back to the data structure when you're done. Coming from Python it's just painful to see how long and ugly the code gets

    2. Re: Major features are complementary by AuMatar · · Score: 3, Insightful

      If you think that mess of streams is clearer than a for loop would be, you're on crack. It's incomprehensible.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    3. Re:Major features are complementary by The+Evil+Atheist · · Score: 4, Insightful

      How about... read the fucking documentation? I'm a C++ guy and always lamented the fact that Java did not have an algorithms equivalent. Java 8 streams + lambdas are almost there and you can achieve complex things without nested loops.

      Stop conflating your unfamiliarity with it being shit. It took me, a C++ guy, a day of getting used to it. If you can't wrap your head around that, you shouldn't be programming. It's easy stuff.

      --
      Those who do not learn from commit history are doomed to regress it.
    4. Re: Major features are complementary by The+Evil+Atheist · · Score: 2

      Don't mistake unfamiliarity with incomprehensible. It's better than for loops because the method names tells you the intention and the guarantees of that operation.

      --
      Those who do not learn from commit history are doomed to regress it.
    5. Re: Major features are complementary by AuMatar · · Score: 2

      No. No it isn't. THe method names would tell me just the same used inside a forloop. You have added no value, while making it harder to debug and harder to read. If you use streams you're a shitty programmer.

      --
      I still have more fans than freaks. WTF is wrong with you people?
    6. Re:Major features are complementary by abies · · Score: 3, Insightful

      Yes, it looks like garbage, this is why some people are switching to java dialects (still fully compatible with all libraries and java APIs both directions, but considerably shorter). My favorite, xtend, would have

      def getLastFour(Optional employee) {
          employee.flatMap(primaryAddress) .flatMap(zipCode) .flatMap(lastFour) .orElseThrow[new FMLException("Missing data")];
      }

      or, without Optionals and exceptions, old school, embrace nulls

      def getLastFour(Employee employee) {
          employee?.primaryAddress?.zipCode?.lastFour
      }

      You can get similarly short code in groovy, scala, koitlin and whatever else. Java strength lies in ecosystem (frameworks, interoperability, portability etc), not because of language syntax.

      Said that, there is a lot of overdesign and monstrosities in popular frameworks as well, but there you have a choice of using something more lightweight.

    7. Re:Major features are complementary by Anonymous Coward · · Score: 2

      Although I'm guessing you prefer:

      public String getLastFour(Employee employee) {
              if (employee != null) {
                      Address address = employee.getPrimaryAddress();
                      if (address != null) {
                              ZipCode zip = address.getZipCode();
                              if (zip != null) {
                                      String lastFour = zip.getLastFour();
                                      if (lastFour != null) {
                                              return lastFour;
                                      }
                              }
                      }
              }
              throw new FMLException("Missing data");
      }

      I'm not the original anonymous coward but, yes, if the point of the function is to throw an exception when any of the sub-fields leading to the zip code are missing then, to me, this form is clearer in it's intent.

      Assuming that's the point, then I would probably try to be even clearer:

      public String getLastFour(Employee employee) {
              if (employee == null) {
                      throw new Exception("getLastFour(): employee is null");
              }
              Address address = employee.getPrimaryAddress();
              if (address == null) {
                      throw new Exception("getLastFour(): primary-address is null");
              }
              ZipCode zip = address.getZipCode();
              if (zip == null) {
                      throw new Exception("getLastFour(): zip-code is null");
              }
              String lastFour = zip.getLastFour();
              if (lastFour == null) {
                      throw new Exception("getLastFour(): zip-code last-four is null");
              }
              return lastFour;
      }

      And, if the correct behavior is really to throw an exception when the field is missing, then ideally there would be a corresponding set of getters:

      public String getLastFour(Employee employee) {
              if (employee == null) {
                      throw new Exception("getLastFour(): employee is null");
              }
            return employee.getPrimaryAddressNotNull().getZipCodeNotNull().getLastFourNotNull();

      And if you're so casual that you're going to be throwing exceptions on failure then why not just accept the default null pointer exceptions:

      public String getLastFour(Employee employee) {
              return employee.getPrimaryAddress().getZipCode().getLastFour();
      }

      But, if all you've got is a single line - then why bother to wrap it in a function at all. Why not just:

              String lastFour = employee.getPrimaryAddress().getZipCode().getLastFour();

      Sure, you get an exception if anything is null. But since that's what you get anyway, why is the functional mapping approach any better?

      Yes, there are (rare) times when a functional style is really best. And sometimes code can be too verbose. But the goal isn't to be as terse as possible. The goal is to write simple code that is easy to understand quickly and also that is easy to debug.

  7. Speed Improvements by Anonymous Coward · · Score: 4, Funny

    Java is so [Garbage Collecting] much fas [Garbage Collecting]ter then C becu [Garbage Collecting]se of its [Garbage Collecting] GC algorithms.

    If y [Garbage Collecting] o [Garbage Collecting] u want raw [Garbage Collecting] [Garbage Collecting] [Garbage Collecting] speed, you h [Garbage Collecting] ave to prog [Garbage Collecting]ram in Java, not C or [Garbage Collecting] [Garbage Collecting] [Garbage Collecting] [Garbage Collecting] [Garbage Collecting] ASSembler.

    With only 16Gb of [Garbage Collecting] [Garbage Collecting] [Garbage Collecting] RAM, I can compile a simple h [Garbage Collecting] [Garbage Collecting] [Garbage Collecting] [Garbage Collecting] ello W [Garbage Collecting] [Garbage Collecting] [Garbage Collecting] orld program, and it only takes 15 [Garbage Collecting] [Garbage Collecting] [Garbage Collecting] [Garbage Collecting] [Garbage Collecting] to run!

    Windows should be redone in [Garbage Collecting] [Garbage Collecting] [Garbage Collecting] [Garbage Collecting] [Garbage Collecting] ..out of memory, stack trace, garbage here:

    1. Re: Speed Improvements by BlackSabbath · · Score: 2

      Haven't had mod points for years (no idea why) but if I did, you'd get them all. Thanks for making me truly laugh out loud.

  8. Re:Java? by bobbied · · Score: 5, Informative

    Agreed. Not the best choice for anything.

    Bullocks.. There are places for using Java.. Lots of them actually...

    Now, I'm not going to blow the fan boy smoke and say Java is great for everything, it's not. I've seen applications in Java that where wholly inappropriate for the language, but because that's what the development team knew, that's what we got, with horrible results, performance and foot print problems that would make your head spin. (It made mine spin, trying to keep up with the ever expanding hardware requirements to keep that garbage running.)

    So what's Java good for? User interfaces (GUI, WEB you name it) it's great. Need it OS independent? Use Java. It's OK for data processing, but you will need lots of compute resources compared to the same thing in C++. Don't like the "hard work" involved in memory management, Use Java and restart often. However, if you have strict response time budgets, or cannot afford to cycle processes to keep running, and lots of extra hardware use something else... PLEASE use something else because I know I won't field those kinds of applications in Java for you, I've had enough pain in my life already and I'm going to quit your project if you try to make me do it again...

    --
    "File to fit, pound to insert, paint to match" - Aircraft Maintenance 101
  9. Best feature by mattyj · · Score: 2

    ... is how easy it is to remove.

  10. Marketing by alantus · · Score: 3, Interesting

    The best thing Java ever had is good marketing, that's it.

  11. Re:Java? by MightyMartian · · Score: 2

    I don't think it's Oracle astroturfing. That would involve an entire paragraph dedicated to how Google is an evil IP pirate that must be destroyed at all costs.

    --
    The world's burning. Moped Jesus spotted on I50. Details at 11.
  12. security fixes! by schklerg · · Score: 2, Informative

    I mean, it's awesome that security fixes are now separate from feature changes and that they are so easy to install and track! I love being able to so easily manage a single runtime with no compatibility issues on my clients now too. Oracle has saved java!

    --
    Be Excellent To Each Other
  13. Re:Java? by 0100010001010011 · · Score: 4, Insightful

    Tools are tools. People need to quit arguing over how a tool was made and just use them.

    I use Jenkins daily, it's written in Java. It's great. I have no desire to ever learn Java but it doesn't mean I can't use Jenkins. I have tools written in JavaScript, C, C++, Matlab, Simulink, Python, Perl, PHP, et al. As long as I have a way of getting it fixed if it's broken I don't care.

    Additionally there's good money to be made in supporting tools that everyone still uses. COBOL, Fortran, Assembly all still have a massive amount of technical debt that may never go away.

  14. Best Language Ever by watermark · · Score: 2, Funny

    They've finally done it! Java is now indisputably the best programming language available! They finally fixed all of the bugs! It's the most secure language available! Best of all, Oracle opened source the whole JVM under a copy-left license! Java 8 is indeed a game changer! These are exciting times indeed!

  15. Re:Java? by Pseudonym · · Score: 2

    I disagree. It's by far the best platform for those researching JIT compilation or designing advanced garbage collectors.

    Like you'd want to do research with Python or something?

    --
    sub f{($f)=@_;print"$f(q{$f});";}f(q{sub f{($f)=@_;print"$f(q{$f});";}f});
  16. Re:Java? by Anonymous Coward · · Score: 4, Funny

    My favorite Java 8 Feature: the uninstall feature.

  17. Clearly by QRDeNameland · · Score: 2

    ...the Ask toolbar. Who doesn't love that?

    --
    Momentarily, the need for the construction of new light will no longer exist.
  18. Re:So what would you use? by Dutch+Gun · · Score: 4, Insightful

    Unless you like staying up all night tracking down errors in pointer arithmetic.

    Lumping C and C++ together generally means you haven't looked at how dramatically the C++ language has changed recently, especially if you talk about pointer arithmetic. If you're using modern C++ and are still worrying about pointer arithmetic (i.e. you're not abstracting it away), you're probably doing it wrong.

    The nice thing about C++ is that, quite often, those abstractions either cost nothing at all, or at worst, far less than interpreted languages. Also, having used modern C++ for a few years now, I think garbage collection is vastly overrated compared to reference counted pointers and simple RAII. C++ is still harder to use than Java or C# in many subtle ways, but basic memory management is no longer one of those persistent thorns.

    Efficient compilation? Yeah, sadly, that's not C++, and likely never will be. There are some newer alternatives that have these features and compile quite efficiency, since they don't come with the baggage of backwards compatibility, but I'm not sure how much traction they're going to gain in practical measurements outside of some niche locations. Their biggest downside? Yeah, they're not backwards compatible with billions of lines of C or C++ code out in the wild.

    --
    Irony: Agile development has too much intertia to be abandoned now.
  19. Re: Row row row your boat by AuMatar · · Score: 4, Insightful

    Exactly the opposite. Streams took easy to read and understand for loops used by every language on earth and replaced it with gibberish that you need to work through to understand, and is far more difficult top debug as there's no damn place to put a break point or print statement. They're banned everywhere I've heard of

    --
    I still have more fans than freaks. WTF is wrong with you people?
  20. Re:So what would you use? by BBCWatcher · · Score: 5, Interesting

    There is a need for a light weight, garbage collected language with static typing an efficient compilation, but it does not exist. So Java it is.

    Exactly. However, Java is pretty damn lightweight and efficient nowadays -- a heck of a lot less heavy than many alternatives. Partly that's because hardware improved, but mostly it's because several Java implementations have improved tremendously over the circa two decades and counting of Java's history. So, for example, Java is a mandatory part of the Blu-ray standards on ~$50 video players. And Google's Android Runtime (ART), another implementation of Java technology, is the world's most popular smartphone platform. On the server side there are extremely fast starting, lightweight, lower memory runtimes such as IBM's WebSphere Liberty Profile. The traditional efficiency rap against Java doesn't apply any more. "Back in the day" people complained about COBOL because it was "too slow" compared to that (allegedly) hand tuned Assembler code they weren't actually writing. Well, for several years, they had a point. By about the 1970s they didn't. Hardware improved, and the compilers got a lot better -- and that process continues, also for COBOL. Java used to be slow, sure...but what's that in your hand and on your wrist now? (And color TV used to suck, and car tires used to blow out at the first pothole....)

    Another huge point in Java's (and for that matter COBOL's) favor is that it's a durable programming language. The invested value in Java code, and the ability to draw from that code portfolio to solve problems, is utterly massive. It's so massive that the Java programming language has crossed over into IT immortality along with only a very few other programming languages (FORTRAN, C, C++, and probably PL/I). Also, Java is the most demonstrably portable programming language (and compilation/runtime path) we have. (Any other nominees?) It's not at all hard to write functionally portable Java code that'll run, unmodified, on platforms ranging from Android smartwatches to z/OS mainframes. That's the default, and it really does work. High quality, performance-optimized and/or battery-optimized code is always a separate question. Any programmer can write lousy code in efficiency terms, and most do at least for Version 1.

  21. Least favorite Java feature by OrangeTide · · Score: 2

    That it is still controlled by Oracle.

    --
    “Common sense is not so common.” — Voltaire
  22. The Ask Toolbar! by Tablizer · · Score: 2

    My favorite Java 8 feature is that wonderful Ask Toolbar! You like type words into it and it finds stuff that actually has those words! It's like a personal librarian ... well, with ads glued to her ass.

  23. Re: Row row row your boat by BlackPignouf · · Score: 2

    there's no damn place to put a break point or print statement.

    https://docs.oracle.com/javase...

  24. Some good, some bad by bradley13 · · Score: 3, Interesting

    Lambda expressions: A total brainfart. Lambda notation has no place in an imperative language; mixing paradigms is confusing for the vast majority of Java programmers. Most people just use lambdas as "magic syntax" to simplify things like declaring event handlers. The ugly syntax is a problem, but lambdas are the wrong solution.

    Date/time APIs: Yes, finally!

    JavaFX: Oddly, the best feature of Java 8 isn't even mentioned in TFA. JavaFX is immensely better than Swing, in every possible way: it looks better, it works more reliably, and it's easier to program.

    And the worst feature of Java 8 is the unnecessary complexity throughout the new features. Two examples:

    - The Optional class. Instead of checking directly for a null result, you have to unpack every result out of this idiotic wrapper.

    - Factory methods instead of constructors. Java is supposed to be an object-oriented language. In OO, you create an instance of a class with a constructor, which has the name of the class. But not in Java 8, no, instead you use a whole stable of factory methods with all sorts of weird names. Look at the new date/time classes for an example.

    --
    Enjoy life! This is not a dress rehearsal.
  25. Re:So what would you use? by BBCWatcher · · Score: 3, Interesting

    Repeating something often enough doesn't make it true.

    Rather the point! The fact is that the Java programming language and runtimes, today, utterly dominate Blu-ray disc players, Android smartwatches, and Android smartphones, to pick some examples. (And what examples they are!) They're powerful evidence that Java hardware and software efficiencies have improved tremendously over two decades. Java is a raging market success, including on devices that cannot afford much inefficiency. It's reasonable and rational to mark-to-market dated views of Java's hardware and software performance attributes. The successful, high efficiency use cases are staring us in the face, literally.

    Of course it is still quite possible (a) to write lousy code that the toolchain and runtime, for any language, cannot performance-fix sufficiently for your intended use cases; (b) to have certain scenarios where Java and its toolchain/runtime (for a particular implementation at a particular moment in time) do not produce the very highest efficiency/performance result technically achievable. Point (a) is always true (although a richer and deeper toolchain, and associated skills, can help a lot), and point (b) simply means that you toss efficiency/performance into your calculus with the relative importance it merits for your particular needs. There are other programming languages (and associated runtimes) available, including five durable ones: COBOL, FORTRAN, C, C++, and PL/I. Plus myriad not-yet-durable (and most never will be) options. (Pascal, Ada, ALGOL.... IT history is littered with them.)

  26. Re:Java? by TheRaven64 · · Score: 2

    For garbage collectors, I'll agree (as long as, by Java, you mean MMTk on Jikes RVM and not OpenJDK). For JITs... no. CoreCLR is a lot nicer. It supports nested JITs with fallback, so you can add a new JIT easily and have it bail to another one when it can't handle a particular construct. This makes incremental development and research prototypes that focus on a specific area both a lot easier than anything I've seen in a JVM. Modifying the Jikes RVM JIT is horrible (actually, the Jikes RVM code in general is fragile and flakey - MMTk isn't actually good, it's just that it doesn't really have any less-buggy competition).

    --
    I am TheRaven on Soylent News
  27. Java ? Why not... by eco_illusion · · Score: 2

    Not specific to 8, but I just like the huge number of libraries at your disposal, maven/gradle make for great dependency management tools (in fact I don't think C/C++ even have something remotely similar), and Spring just helps you write even less code than you did before. The thing I love most about the JVM is that you don't have to write Java code for it. You can even make an unholy mix of Java, Scala, Kotlyn, Groovy etc.

  28. Java’s problem is memory usage by Theovon · · Score: 2

    That’s funny, although unless you’re bumping up against your VM memory limit, it’s not such a problem. When you DO approach your memory limit, performance drops to a crawl. In the 32-bit days, I hated the fact that my colleagues in AI developed in Java instead of C++ for programs that worked on really huge datasets just because of this issue. The programs would be frozen on GC for as much time as they did computation. That doesn’t mean I hate Java; I really like it, but this was the wrong time to use it.

    But a bigger problem is that Java VMs are memory-hungry. After a little while, a long-running Java app has grown to its maximum size and stays there tying up system resources that it’s not really using. This can happen in C too, but with Java, you can’t avoid allocating and freeing objects constantly, while you can keep memory allocation well under control in C/C++, keeping your process size small. You can’t keep your Java process size small AND have good performance.

    BTW, despite this, I do all kinds of work in Java. Mostly server stuff and some swing. When I need speed, I use C and/or C++. When I want to do something like string processing or just want to hack together a one-off, I use Ruby. When I want to do symbolic math, I am forced to use Python (a language whose syntax I object to on moral grounds) because sympy is the awesomest thing ever.

    My FAVORITE language? Probably Verilog. I’m a chip designer, so you can just assume that any piddling arguments you have over programming languages will just make me roll my eyes over how trivial the differences are. That’s like watching a Lutheran and a Methodist try to argue over the infinitessimally trivial differences in their religions. Just to piss people off for fun, I’m going to say that software languages (except maybe Haskell, which is scary for other reasons) are these arbitrary constructions that people argue about like religions. On the other hand, Verilog is grounded in reality and science; it has some rough edges too, but that is the way of science. (Our VHDL bretheren fully recognize that the two languages ultimately have the same semantics.)

  29. Re: Row row row your boat by AuMatar · · Score: 3, Insightful

    No,you're going to rewrite it to a for loop because its more maintainable, more easy to change with changing requirements, and more understandable.

    --
    I still have more fans than freaks. WTF is wrong with you people?
  30. Re:Java? by angel'o'sphere · · Score: 2

    Why do you say 'Jave' when you mean 'incompetent Programmer' is beyond me.
    The things you mention are not Java problems or problems of the Java library.

    A window 'programmed' in Java just goes full-screen and back to its original sizes, just like any other window ... no idea what you are talking about.

    --
    Cost free eBook I read (by iBook/Kobo/Amazon/ObookO/Gutenberg etc.): "The Green Odyssey" by Philip Jose Farmer.