Re: [ljc] Re: Defender Methods

From: Abraham Marín P.
Sent on: Wednesday, August 29, 2012 9:16 PM
By "ignore the inheritance hierarchy" I mean you can stop thinking about abstract classes when designing and use always interfaces with defender methods (if your abstract class needs protected fields or methods this won't work though).

Once you've made the design using interfaces instead of abstract classes it will work the same way: previously you could make the child class override the method in the abstract class or use the base method and now you can make the child class implement the defender method or use the default implementation; I see no difference.

Cheers,
Abraham

--
Abraham Marín Pérez

Blogs: http://www.gatogo...­
http://www.FromFr...­
Twitter: @AbrahamMarin
LinkedIn: http://www.linked...­

Sent from my iPhone

On 29 Aug 2012, at 23:36, Richard Warburton <[address removed]> wrote:

>> You can ignore the inheritance hierarchy and only use the implements hierarchy to mock multiple inheritance with interfaces+defender methods mocking abstract classes.
> 
> You can't ignore the inheritance hierarchy.  Any class that implements
> a method with the right signature will be preferred to a default
> method, regardless of how 'close' the interface is compared to the
> class.  This is a significant different between the way inheriting
> implementations works between abstract classes and default methods on
> interfaces.
> 
> regards,
> 
>  Richard
> 
> 
> 
> 
> --
> Please Note: If you hit "REPLY", your message will be sent to everyone on this mailing list ([address removed])
> http://www.meetup...­
> This message was sent by Richard Warburton ([address removed]) from LJC - London Java Community.
> To learn more about Richard Warburton, visit his/her member profile: http://www.meetup...­
> Set my mailing list to email me
> 
> As they are sent
> http://www.meetup...­
> 
> In one daily email
> http://www.meetup...­
> 
> Don't send me mailing list messages
> http://www.meetup...­
> 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 12/13 Jun 14

  • SkillsMatter

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

  • Packt Publishing

    A publishing company specializing on specific technologies and solutions

  • 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