This discussion is archived
1 Reply Latest reply: Jan 4, 2006 2:25 AM by 416044 RSS

11 new factor suggested for morden java language

843853 Newbie
Currently Being Moderated
/**
     * 1. NullPointer Suppress, according to [Nullable] annotation<br>
     * need JVM support<br>
     * avoid many null judgment code.
     */
     [Nullable]
     public void testNullable(A a){
          return a.b().c.d(); //how many line it will cost using "if-else" null check?
     }
     
     /**
     * 2. Dynamic property, for better IDE and compile time check<br>
     * need Compiler support<br>
     * @param a: A implements DynamicBean, "c" property is not defined.
     */
     public void dynamicProperty(A a){
          assert a != null;
          a.b.c = "abc"; //same as: a.getProperty("b").setProperty("c","abc");
          ResultSet rs; //for database:
          String name = rs.name; //if ResultSet defined getStringProperty(): String name = rs.getStringProperty("a");
          Element order; //for xml, element auto-created in getProperty() method.
          order.address.phone = "1234"; //order.getProperty("address").setProperty("phone","1234");
     }
     
     
     /**
     * 3. Dynamic method invocation, for better IDE and compile time check<br>
     * need Compiler support<br>
     * @param a: A implements DynamicInvoke, b() method is not defined.
     */
     public void dynamicMethod(A a){
          a.b(1,"x"); //same as: a.invoke("b",new Object[]{1,"x"]);
     }
     
     /**
     * 4. extend "class" usage, for better IDE and compiler time check<br>
     * need Compiler support<br>
     * @param a: A defined b(),c property
     */
     public void fastReflection(A a){
          Annotation[] mas = a.b().class.getAnnotations(); //a.getClass().getMethod("b").getAnnotations();
          Annotation[] mas = a.c.class.getAnnotations(); // a.getClass().getField("c").getAnnotations();
     }
     
     /**
     * 5. indexed property visit, for clean code<br>
     * need Compiler support<br>
     * @param a: A &#23454;&#29616;&#20102;List&#25509;&#21475;,Map&#25509;&#21475;
     */
     public void indexVisit(A a){
          Element order ; //xml element
          Element first = order[0]; //order.get(0);
          Element address = order["address"]; //order.getElement("address")
     }

     /**
     * 6. JVM built-in AOP<br>
     * need Runtime support<br>
     * Trace,Role,Transactional is annotation
     */
     [Trace]
     [Role("admin")][Transactional]
     public void jvmAOP(A a){
          
     }
     
     /**
     * 7. Conditional compile, different compile result for diffrent condition<br>
     * need Compiler support<br>
     * Conditional anotation may be used on field, method, class and package<br>
     */
     [Condition("Test")]
     public void testSomeMethod(){
          //this method will not be include in delivery compile result.
     }
     
     /**
     * 8. XML Schema,DataBase compile time check<br>
     * need Compiler support<br>
     */
     public static void schemaSupport() {
          [Schema(url="file://test.xsd")]
          Document doc;
          Element c = doc.a.b.c; //compiler should raise error if /a/b/c is not defined in schema
     }
     
     /**
     * 9. build-in object database,xml schema knolege-base worked like DNS server.
     * need Runtime support<br>
     */
     public void databaseSupport(){
          Database.default.find("...");
          Schema.get("http://xxx.yyy/zzz.xsd").validate(xml);
     }
     
     /**
     * 10. local platform support<br>
     * need Runtime support<br>
     * allow developer control windows service,visit registry/log/file association/schedule/menu&#12289;tool bar&#12289;desktop...
     */
     public void platformSupport(){
          PlatformRegistry.getString("....");
     }

     /**
     * 11. provide minium JRE install package to compete with Flash/Windows buildin .net CLR<br>
     * mininum JRE install package provide basic classes.<br>
     * deployer may configure other package together, such as UI/javamail/xml. <br>
     */

it's my own idea, pls tell out your hope for java in new year too :)
  • 1. Re: 11 new factor suggested for morden java language
    416044 Newbie
    Currently Being Moderated
    As some of your suggestions may sound appealing, they are too specialized for your own needs. UI is essential for Java (and any other language) as any application needs a UI - server applications are too specialized that a higher deployment cost is less intrusive. But thank god, Sun will stay with the Java system as it is for compatibility reasons. So many people just complain about things they want to have in addition of the vast feature set of Java like it offers today. And others complain that they don't need many things and want a leaner runtime environment. You can't please light and dark together - you need to find a good approach that helps most of the developers.

    In my case, I like the included APIs the most, because deploying an application occurs much more often than deploying a new JRE. And it's also a fact that every developer has at least 1 class/package/jar with it's own utilities/framework that improves the standard API of Java. This won't change ever because each developer has its own wishes of a good/smart/small/generic API. So, be happy with what Java already offers, because it's so much!