addressalign-toparrow-leftarrow-rightbackbellblockcalendarcameraccwcheckchevron-downchevron-leftchevron-rightchevron-small-downchevron-small-leftchevron-small-rightchevron-small-upchevron-upcircle-with-checkcircle-with-crosscircle-with-pluscontroller-playcrossdots-three-verticaleditemptyheartexporteye-with-lineeyefacebookfolderfullheartglobegmailgooglegroupshelp-with-circleimageimagesinstagramFill 1light-bulblinklocation-pinm-swarmSearchmailmessagesminusmoremuplabelShape 3 + Rectangle 1ShapeoutlookpersonJoin Group on CardStartprice-ribbonprintShapeShapeShapeShapeImported LayersImported LayersImported Layersshieldstartickettrashtriangle-downtriangle-uptwitteruserwarningyahoo

Re: [ljc] Re: Defender Methods

From: Abraham Marín P.
Sent on: Monday, August 20, 2012 11:04 PM
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.

Thanks,
Abraham

--
Abraham Marín Pérez

Twitter: @AbrahamMarin
LinkedIn: http://www.linkedin.com/pub/abraham-marin-perez/22/884/45b

Sent from my iPhone

On 21 Aug 2012, at 03:48, Abraham Marín Pérez<[address removed]> wrote:

Doesn't that defeat the very purpose of single class inheritance? It sounds like a hack to have multiple class inheritance: If I do interfaces where all methods are defender methods then I can mock multiple class inheritance.

I'm just trying to find a scenario where this could be useful.

Thanks,

On 20 Aug 2012, at 19:58, Kevin Wright <[address removed]> wrote:



On 20 August[masked]:45, Abraham Marín Pérez <[address removed]> wrote:
This might be a silly question but... What's the difference between an interface with a default method and an abstract class with an implementation for that method?


Java has multiple interface inheritance, but single class inheritance.  You could, potentially, inherit defender methods from multiple parents.




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Kevin Wright ([address removed]) from LJC - London Java Community.
To learn more about Kevin Wright, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]




--
Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
This message was sent by Abraham Marín Pérez ([address removed]) from LJC - London Java Community.
To learn more about Abraham Marín Pérez, visit his/her member profile
Set my mailing list to email me As they are sent | In one daily email | Don't send me mailing list messages

Meetup, PO Box 4668 #37895 New York, New York[masked] | [address removed]

Our Sponsors

  • Our Blog

    Read the latest news from the LJC

  • RecWorks Ltd

    Fixing Tech Recruitment using the Power of Community

  • jClarity

    Java/JVM Performance Analysis Tools & mentoring for Java related matters

  • LJC Aggrity

    Our LJC Aggrity site contains blog posts from our members

  • LJC Book Club

    Our Book club with book reviews from our members

  • Devoxx UK

    Java Community Conference in collaboration with the LJC, 8-10th June 16

  • SkillsMatter

    "Host, help organise, promote, film many of our meetings."

  • IBM

    Build Enterprise-grade apps at start-up speed.

  • New Relic

    New Relic makes sense of billions of metrics a day in real time.

  • Hazelcast

    Hazelcast is the leader in operating in-memory computing.

  • Java.Net

    We are an official Java User Group recognised by Oracle's JUG program

  • JRebel

    Free 3 month J-Rebel license.

  • O'Reilly

    40% discount on printed books and 50% on e-books.

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