taskease.js - Tasks: task #12108, Interface versioning

 
 

You are not allowed to post comments on this tracker with your current authentication level.

task #12108: Interface versioning

Submitter:  Mike Gerwitz <mikegerwitz>
Submitted:  Sun 10 Jun 2012 04:01:06 AM UTC
   
 
Should Start On:  Thu 01 Mar 2012 05:00:00 AM UTC Should be Finished on:  Mon 01 Jul 2013 04:00:00 AM UTC
Category:  Core Priority:  5 - Normal
Item Group:  Development Status:  None
Privacy:  Public Assigned to:  mikegerwitz
Percent Complete:  0% Open/Closed:  Open
Planned Release:  None
Keywords:  interfaces, versioning

Sun 10 Jun 2012 04:01:06 AM UTC, original submission:  

The concept of versioning is applied to classes to prevent breaking of subclasses, as mentioned in #12089. However, there is still a glaring issue with interfaces. If a method declaration is added to an interface, then everything implementing that interface would be broken.

This is especially a problem with 3rd party APIs.

This problem could be resolved by providing a sensible default should the method not be implemented, but interfaces do not allow for this. This default could throw a warning (or an error depending on development mode) to notify the developer that there is an issue, but it wouldn't crash the entire app. The sensible default could be specified explicitly or be automatically generated depending on return type for certain situations (see 0000014). The default cannot be generated for any class instance except 'self', for obvious reasons.

Of course, this is outside the scope of interfaces. Likely, the best route to take would be to deprecate interfaces in favor of traits once they are implemented. Interfaces would then be removed at a later date, as they provide versioning problems.

With the warning, this will ensure that the traits can still be used as interfaces if the declaration includes the `abstract` keyword, but will save a lot of headaches when API additions roll around. It also provides the benefit that one can begin testing a class that implements a given interface (trait) without providing dummy implementations of every method right away. The warning will ensure that they do not forget to provide a complete implementation.

Mike Gerwitz <mikegerwitz>
Group administrator

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by mikegerwitz (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    No changes have been made to this item

    Back to the top

    Powered by Savane 3.13-4448.
    Corresponding source code