addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcredit-cardcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobe--smallglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1launch-new-window--smalllight-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [ljc] Re: Defender Methods

From: Tom H.
Sent on: Tuesday, August 21, 2012 10:19 AM
On 21/08/2012, Abraham Marín Pérez <[address removed]> wrote:
> Replying to my own question about a scenario for defender methods, I read
> the example of backwards compatibility for interfaces. I see the usefulness
> of that, but I understand that in that scenario defender methods are meant
> to be sort of temporal (ie, eventually all clients will implement the new
> method and hence the default implementation would be removed). However, I'd
> like to know if there is any situation where a default implementation would
> be left permanently in the interface as a design decision.

No, you can't  take a concrete method and make it abstract (outside of
JDBC). Indeed Iterator.remove is an existing abstract method which
will be given a concrete implementation (throwing
UnsupportedOperation­Exception). The idea of an "interface" as in, say,
Gang of Four, is gone. It's all impure abstract classes from now, even
if the `interface` keyword is left as an anachronism. Not that the
idea of "programming to an interface" is particularly sensible when
the interface is full of may throw UnsupportedOperation­Exception.

Tom

People in this
Meetup are also in:

Sign up

Meetup members, Log in

By clicking "Sign up" or "Sign up using Facebook", you confirm that you accept our Terms of Service & Privacy Policy