What is the appropriate way to plan for a Java API with new features over time? -


I am working with a team on a new Java API for one of our internal projects. We probably will not be able to take the time to stop all the details of the Java interface and at the beginning they will get 100% right.

We have some key features that are expected to come out, and others who are likely to be involved in later times but now it is not important, now it's time to design one of those features. We do not have the luxury especially because we do not yet have enough information to get all the design details.

The Java approach to APIs is that once you publish an interface, it is effectively irreversible and you should never change it.

What is the API development plan over time? I have read and I think we can do this:

  // First release interface IDoSomething {public void hop (); Skip Public Zero (); Public zeros jump (); } // Later the interface extends to IDoSomething2 IDoSomething {public zero waxFloor (bottom floor); Public zero top desserts (sweet dessert); } // Later still the interface IDoSomething3 IDoSomething2 {generates a public zero piece (sliceable object); Public zero dice (dice object); }   

and then upgrade our class with IDoSomething to IDoSomething2 and then with IDoSomething3 But it seems a code odor problem is there.

Then I think that many applications can use these before risking them frozen, but I do not know whether it is correct or not.

If you want flexible code generics can help.

For example:

  interface forevexer {public zero wax floor (bottom floor); }   

You may have:

  Interface Waxer & lt; T & gt; {Zero wax (tt); } Class Floor-Waxer use waxers & lt; Bottom & gt; {Zero wax (bottom floor); }   

In addition, in the default methods interface that has been provided in Java 8 which allow you to add methods in an already existing interface; With this in mind, you can interface normally. This means that you should make your interface as normal as possible; Instead:

  interface washer & lt; T & gt; {Wash with zero; }   

and then later

  interface washer & lt; T & gt; {Wash with zero; Washing the vacuum (T, Washbusten wash washroom); }   

and add later

  interface washer & lt; T & gt; {Wash with zero; Washing the vacuum (T, Washbusten wash washroom); Zero wash (T, washbasstance wash toilet, detergent detergent); }   

You can add from the beginning

  @ FunctionalInterface interface washer & lt; T & gt; {Wash with zero (T, washbusten wash toilet, detergent detergent); Default wash (T. washbaschtench wash sweens) (Wash, wash, detergent. Default DDATAGNT);} Default Wash (T, Detergent Detergents) {Wash (Wash, Washwas. DEFAL T_WASH_SUBSTANCE, Detergent);} Default Wash } {Wash (wash what, washwasten.dFAULT_WASH_SUBSTANCE, detergent.dFAULT_DETERGENT);}} Also, try to make your interface functional (only an abstract method) so that you can make lambdass greens Can benefit from the ring.   

Comments

Popular posts from this blog

php - PDO bindParam() fatal error -

logging - How can I log both the Request.InputStream and Response.OutputStream traffic in my ASP.NET MVC3 Application for specific Actions? -

java - Why my included JSP file won't get processed correctly? -