What is the difference and relation between an interface and itsmethod?

Discussion in 'Java' started by tenxian, Apr 26, 2008.

  1. tenxian

    tenxian Guest

    Can interaction among objects only be taken place via interfaces?
     
    tenxian, Apr 26, 2008
    #1
    1. Advertising

  2. tenxian

    Roedy Green Guest

    Re: What is the difference and relation between an interface and its method?

    On Sat, 26 Apr 2008 04:47:53 -0700 (PDT), tenxian
    <> wrote, quoted or indirectly quoted someone
    who said :

    >Can interaction among objects only be taken place via interfaces?


    no. they interact via methods that change their fields.

    That is not a question a human would ask. Is this some silly question
    from some prof's test?
    --

    Roedy Green Canadian Mind Products
    The Java Glossary
    http://mindprod.com
     
    Roedy Green, Apr 26, 2008
    #2
    1. Advertising

  3. tenxian

    Mark Space Guest

    Re: What is the difference and relation between an interface andits method?

    tenxian wrote:
    > Can interaction among objects only be taken place via interfaces?


    Patricia gave you a very good answer.

    The operative word here is "can." Can they? No. "Should" they? Yes.


    If you are working with a designer who insists on using interfaces for
    all interactions, that's a good thing. There are other options, but
    generally using interfaces wherever possible is preferred.
     
    Mark Space, Apr 26, 2008
    #3
  4. tenxian

    Mark Space Guest

    Re: What is the difference and relation between an interface andits method?

    Lew wrote:
    > Mark Space wrote:
    >> tenxian wrote:
    >>> Can interaction among objects only be taken place via interfaces?

    >>
    >> Patricia gave you a very good answer.
    >>
    >> The operative word here is "can." Can they? No. "Should" they? Yes.
    >>
    >>
    >> If you are working with a designer who insists on using interfaces for
    >> all interactions, that's a good thing. There are other options, but
    >> generally using interfaces wherever possible is preferred.

    >
    > Controversial.
    >


    Huh. I'm kind of surprised. Surely anything can be taken to excess,
    but I assume that creating interfaces and coding (and testing) to those
    interfaces rather than concrete objects wouldn't be controversial at all.

    I wonder what design methodologies would make coding to interfaces
    unnecessary.
     
    Mark Space, Apr 27, 2008
    #4
  5. tenxian

    Mark Space Guest

    Re: What is the difference and relation between an interface andits method?

    Lew wrote:

    > The part that was controversial was "a designer who insists on using
    > interfaces for all interactions, that's a good thing", not a designer
    > who "creat[es] interfaces and cod[es] (and test) to those interfaces
    > rather than concrete objects". Of course I agree that the latter is a
    > good thing, and I don't think it is controversial. Nor do I think
    > serious thinkers would propose that "coding to interfaces [is]
    > unnecessary."
    >
    > Isn't that called a straw-man argument, where one restates someone's
    > position into a refutable one that was not the original point?
    >


    OK, just loose terminology on my part. I assumed that tenxian was just
    encountering his first design methodology, and was exaggerating a bit.
    Any good designer would insist on correct methods and not allow a layman
    to over rule him or her.

    This may seem unreasonable to the layman but I have to go with someone
    who has experience, without knowing any other details.

    I wasn't trying to start an argument, and it's certainly possible that
    tenxian has a designer who is being unreasonable, but without more
    details I don't see how we can say.

    > What is controversial is the carrying of that to extremes: one who
    > *insists* that *all* interactions go through interfaces, and the notion
    > that that insistence is "a good thing". In this very newsgroup, you may
    > have noticed that very controversy raging. So yes, it is
    > controversial. The evidence is the people vehemently disagreeing in
    > public on that very point.
    >
    > It has come up in the thread "Composition vs. inheritance". There's
    > some talk there about whether concrete inheritance is evil.
    >


    Nope, I haven't been reading that thread. So I'm not up on the nuances
    of design as it relates to emotions in this newsgroup. :) "Moderation
    in all things" applies to software design too. That's what I assume
    until there's evidence someone means something else.

    Maybe I should read up on that thread if it's gone beyond a simple
    discussion of composition.
     
    Mark Space, Apr 27, 2008
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. jakk
    Replies:
    4
    Views:
    12,401
  2. Naresh Agarwal
    Replies:
    1
    Views:
    1,092
    ExGuardianReader
    May 29, 2004
  3. Ganesh
    Replies:
    3
    Views:
    509
    Rolf Magnus
    May 10, 2005
  4. Satya
    Replies:
    1
    Views:
    1,267
    jmcgill
    May 16, 2006
  5. giodo
    Replies:
    0
    Views:
    453
    giodo
    Oct 10, 2007
Loading...

Share This Page