Wednesday, February 9, 2011

What features would you like to see in Java?

This is a pretty unoriginal question! Where do you stand on the Closures Proposal? What else would you want to see?

For me it has to be a new decimal type which is really a BigDecimal but allows for standard math operations using +, -, x, / etc.

  • The list of possible items being discussed for Java SE 7 is here:

    http://tech.puredanger.com/java7

    And predictions for what will actually make it are here:

    http://tech.puredanger.com/2008/08/02/java7-prediction-update/

  • I'd like the switch statement to support Strings, like in C#. Very useful feature in my opinion!

    GavinCattell : I just saw that that's in the list above, nice!
  • I made a list previously.

    I too would like operators for BigDecimals. I'd also like option types (the ability to have the compiler enforce what is allowed to be null and what isn't, eliminating most NPEs).

    I'm not convinced on the full closures proposal. The CICE proposal is OK, except for how it overloads the "public" keyword.

    Tom Hawtin - tackline : I think the motivation of CICE is to propose a goal. The syntax is incidental and up for grabs, but irrelevant until we know where we want to go.
    From Dan Dyer
  • A bit more conciseness in the syntax, with a bit of target type inference and (library defined) defaults for very common cases.

    For instance:

    Map<String,String> map = new java.util.HashMap<String,String>();
    

    should become something like:

    Map<String,String> map = new;
    

    Similar for simple anonymous inner classes.

    Grundlefleck : What happens then when you want to instantiate a subclass, just define it as before, or could there be some other clever device used? Like the idea :-)
    Richie_W : = new what exactly? A Map is an interface class. I see what you mean though...but it would only work for actual classes!
    Alex B : I'd prefer it C++09 way. Someting like "auto map = new std::map();"
    Tom Hawtin - tackline : Richie_W, if I say I want a new Map, way more than 90% of the time HashMap is the appropriate implementation. Therefore it is sensible to default Map construction to HashMap.
    Tom Hawtin - tackline : Checker, for me that loses too much information while not narrowing down the type enough. If the value came from a method I would not be able tell *locally* what they type was. Also I want the Map type, without any of the extras of HashMap.
    Tom Hawtin - tackline : C# has something like auto to support LINQ. LINQ uses anonmymous types (as in interface not class) in order to concisely use a relational model. A relatively obscure language feature isn't a great reason to upset the rest of the core language.
    Anthony : how about "var map = new java.util.HashMap();" ;)
    Tom Hawtin - tackline : Anthony, that's what auto does in C++0x (as Checkers comment).
  • Appart from closures, I'd really like some simple type inference to keep the hassle of using generics down, and language support for composite oriented programming.

  • Lots for things. I've just got into C# and there are a lot of features I like. The main one being (automatic) properties

    From Richie_W
  • Better support for embedding DSL's so that HQL, SQL, XML and other commonly used DSL can be statically verified and compiled.

  • Reified generics

  • Nested functions

    Example:

    public String myFunc(List<Sometihng>list)
    {
    
       boolean myUtilFunc(Something s) =
       {
          return s.toString != ""
       }
    
       for(Something s : list)
       {
         if(!myUtilFunc(s)
           return  s.toString
       }
       return null
    }
    
  • I know this is API and not language, but they really need to redesign javax.crypto

    From Konrad
  • As little as possible.

    Syntax sugar is very nice, but it also makes the language more complicated for new developers, and makes maintenance more difficult as there are more ways to express the same logic.

    I strongly prefer a rich ecosystem of third-party API's (think Apache Commons and the like) and a website like this where you can ask what to use.

    From extraneon
  • I'd really like to have friend classes. This would give a way to cut down greatly on mindless getters and setters, while adhering to SRP and not resulting in package explosion.

    From moffdub
  • const methods

  • I'd like to see them quit changing the language/APIs for a while and figure out what's needed after the community has had a bit of time to work it out, develop their own things, then standardise.

    From dajobe
  • I would like support of closures (with out an ugly syntax if possible)..

    I like what is proposed by Tom, that would be great

    From Alex
  • Updated or new Swing components.

    The results from open-source projects like SwingLabs should be rolled into Java - for example, JXTable, JXLoginPane.

    Swing is also missing a lot of modern UI idioms, like an Outlook Bar.

    From David
  • True property support in the language (similar to MyClass.class for class support, but MyClass.myProperty.property type support - as well as automatic handling of property change support).

    This is critical for properly implementing binding - the current lack of support is a major problem (it's not just syntactic sugar to get rid of having to type out getters and setters).

    Groovy's got this one nailed, and I really hope that Java gets it.

    From Kevin Day
  • C# style properties.

    oxbow_lakes : For those of us who don't know C# - could you expand?
    From Hans
  • class import alias - all other languages has got it (event php) and only Java remains without this feature - for big projects its a huge problem. Its quite simple, I don't understand why it was not added in 1.5. It would be really nice to write something like that:

    import java.swing.Popup as SwingPopup;
    import java.awt.Popup as AWTPopup;
    
    
    Hope that this will be added some day....

    1. Rename java process (every processes that implements by java language will show in processes list are java or javaw), It's hard for specify process.
    2. Support Daemon in linux or Windows Service, many times java need to run is backend process.

    but I luv it.

  • A "Money" class, that allows safe monetary calculations, much like one mentioned here.

    dmeister : Nice Library class, but (please) not in the standard API that is engraved in Stone until infinity
    From swapnonil
  • Java performance is now quite good - honestly at this point I'd even trade 10-15% speed for reduced memory if it were needed. This is a huge hurdle for desktop app adoption (Notes 8 regularly consumes 450MB+ memory with casual usage - 'nuf said). Biggest needs:

    user defined value types (like C# struct) - to allow 'inline' class memory usage instead of via reference. Reduces references which are really adding up memory-wise with move to 64-bit.

    Stack allocation via escape analysis - to reduce heap usage and GC

    MVM - to help pool free heap space among all running programs

    Other niceties: unsigned primitives tuples reified generics (should have been done right from the beginning) syntactic sugar to reduce redundant typing (java is very verbose)

    Michael Myers : What is "unsigned primitives tuples reified generics"? I'm guessing there are three separate terms there, but it's hard to tell just by looking.
  • I would like the restrictions on calling this and super constructors loosened to allow for the declaration of local variables and the ability to call static methods and methods on objects other than "this".

    The current restriction that calls to super or this constructors must be the first statement is often inconvenient and often leads to very torturous code if parameters to the this/super need to be synthesized or manipulated before it can be called.

  • BGGA closures and reified generics.

  • Smaller memory footprint.

  • Mixins, closures and properties.

0 comments:

Post a Comment