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

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!weretis.net!feeder4.news.weretis.net!eternal-september.org!feeder.eternal-september.org!.POSTED!not-for-mail
From markspace <-@.>
Newsgroups comp.lang.java.programmer
Subject Re: Abstract Class versus an Interface, when no Members in Common
Date Thu, 03 Nov 2011 17:37:10 -0700
Organization A noiseless patient Spider
Lines 19
Message-ID <j8vc3o$sks$1@dont-email.me> (permalink)
References <22857359-211e-443e-9c5d-6cc2f5bd971b@m19g2000vbm.googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
Injection-Date Fri, 4 Nov 2011 00:37:13 +0000 (UTC)
Injection-Info mx04.eternal-september.org; posting-host="XjIWM99mD7Ijfdu600oVPA"; logging-data="29340"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX1+F026f6RCTZU3a99gjiVweLkuIkPbbYOQ="
User-Agent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:7.0.1) Gecko/20110929 Thunderbird/7.0.1
In-Reply-To <22857359-211e-443e-9c5d-6cc2f5bd971b@m19g2000vbm.googlegroups.com>
Cancel-Lock sha1:TdcNscaAj4ugSbq5IEzE8kSfaVQ=
Xref x330-a1.tempe.blueboxinc.net comp.lang.java.programmer:9481

Show key headers only | 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 | Unroll thread


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