Miltiple interfaces in Java and naming conflicts resolution


DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Miltiple interfaces in Java and naming conflicts resolution

Hybrid View

  1. #1
    valentin Guest

    Miltiple interfaces in Java and naming conflicts resolution


    Hello,
    What are advantages and disadvantages of explicit naming resolution?
    If a language supports Multiple Interfaces on single object, it can do so
    in a better way than C++. The fact that two methods have the same name still
    does not mean they should have the same implementation. Are these theses
    correct?

    I find Delphi that is very close in spirit to Java. They both don't tie polymorphism
    with inheritance, base their design on interfaces, single root object for
    objects and exceptions, support RTTI,... I feel that Delphi has even more
    powerful OOP features. IMO Java suffers of lack of covariant return types
    and irresolvable naming conflicts. If the first problem seems to be solved
    in short time (even more, hostile generics ala templates will be added),
    the community prefers not to notice the second problem.

    I can bring some examples when lack of this feature enforces to make awkward
    bypasses (hacks).
    But this feature is a key to make my design perfect.


  2. #2
    Joe \Nuke Me Xemu\ Foster Guest

    Re: Miltiple interfaces in Java and naming conflicts resolution

    "valentin" <valentin@abelectron.com> wrote in message <news:3d72030d$1@10.1.10.29>...

    > Hello,
    > What are advantages and disadvantages of explicit naming resolution?
    > If a language supports Multiple Interfaces on single object, it can do so
    > in a better way than C++. The fact that two methods have the same name still
    > does not mean they should have the same implementation. Are these theses
    > correct?


    In C++ anyway, methods from different interfaces or base classes must
    have the same signature, not just the same name, in order to clash.
    Visual Basic 5.0 and 6.0 sidestep this problem by not automatically
    importing the implemented interfaces into the new class' interface.

    > I find Delphi that is very close in spirit to Java. They both don't tie polymorphism
    > with inheritance, base their design on interfaces, single root object for
    > objects and exceptions, support RTTI,... I feel that Delphi has even more
    > powerful OOP features. IMO Java suffers of lack of covariant return types
    > and irresolvable naming conflicts. If the first problem seems to be solved
    > in short time (even more, hostile generics ala templates will be added),
    > the community prefers not to notice the second problem.
    >
    > I can bring some examples when lack of this feature enforces to make awkward
    > bypasses (hacks).
    > But this feature is a key to make my design perfect.



    URL:http://google.com/search?q=cache:Gko...urn+types&hl=e
    n&ie=UTF-8

    --
    Joe Foster <mailto:jlfoster%40znet.com> "Regged" again? <http://www.xenu.net/>
    WARNING: I cannot be held responsible for the above They're coming to
    because my cats have apparently learned to type. take me away, ha ha!



  3. #3
    MarkN Guest

    Re: Miltiple interfaces in Java and naming conflicts resolution


    > The fact that two methods have the same name still
    >does not mean they should have the same implementation. Are these theses
    >correct?


    In the same object they should. If you have a problem in this area then
    your design needs changing.

    >But this feature is a key to make my design perfect.


    No design is ever perfect. Plan to refactor and add functionality.


Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center