Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #9481

Re: Abstract Class versus an Interface, when no Members in Common

From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: Abstract Class versus an Interface, when no Members in Common
Date 2011-11-03 17:37 -0700
Organization A noiseless patient Spider
Message-ID <j8vc3o$sks$1@dont-email.me> (permalink)
References <22857359-211e-443e-9c5d-6cc2f5bd971b@m19g2000vbm.googlegroups.com>

Show all headers | View raw


On 11/3/2011 4:09 PM, KevinSimonson wrote:
> So I created an abstract class called<SearchResult>  that has no

In the real world, when there's a class like this, there's usually some 
meta data that can decode which type is being returned.  As Arne points 
out, there's usually also a "getAsType" method.  For example, the JDBC 
object has various "getBoolean()" and "getBlob()" methods for accessing 
database columns, as well as metadata describing the object.

While not the best over all (JPA is better, generally, than JDBC), it's 
more structured that just an abstract class with no methods.

I might say that no methods = interface (called a mixin), but I think 
the potential to add common methods here is high.  So, use a base class 
so that you don't get tripped up by Java's single inheritance.  It's the 
most conservative approach in this case.


Back to comp.lang.java.programmer | Previous | NextPrevious in thread | Next in thread | Find similar


Thread

Abstract Class versus an Interface, when no Members in Common KevinSimonson <kvnsmnsn@hotmail.com> - 2011-11-03 16:09 -0700
  Re: Abstract Class versus an Interface, when no Members in Common Arne Vajhøj <arne@vajhoej.dk> - 2011-11-03 19:32 -0400
  Re: Abstract Class versus an Interface, when no Members in Common markspace <-@.> - 2011-11-03 17:37 -0700
    Re: Abstract Class versus an Interface, when no Members in Common Lew <lewbloch@gmail.com> - 2011-11-03 18:10 -0700
      Re: Abstract Class versus an Interface, when no Members in Common markspace <-@.> - 2011-11-03 18:46 -0700
  Re: Abstract Class versus an Interface, when no Members in Common Roedy Green <see_website@mindprod.com.invalid> - 2011-11-03 22:06 -0700
  Re: Abstract Class versus an Interface, when no Members in Common Ian Pilcher <arequipeno@gmail.com> - 2011-11-04 00:06 -0500
  Re: Abstract Class versus an Interface, when no Members in Common Robert Klemme <shortcutter@googlemail.com> - 2011-11-04 17:57 +0100
  Re: Abstract Class versus an Interface, when no Members in Common Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-11-04 13:54 -0700
    Re: Abstract Class versus an Interface, when no Members in Common Wanja Gayk <brixomatic@yahoo.com> - 2011-11-08 23:15 +0100
      Re: Abstract Class versus an Interface, when no Members in Common Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2011-11-08 20:58 -0800
  Re: Abstract Class versus an Interface, when no Members in Common Roedy Green <see_website@mindprod.com.invalid> - 2011-11-04 15:17 -0700
  Re: Abstract Class versus an Interface, when no Members in Common Wanja Gayk <brixomatic@yahoo.com> - 2011-11-08 23:13 +0100

csiph-web