Groups | Search | Server Info | Keyboard shortcuts | Login | Register


Groups > comp.lang.forth > #22629

Re: The current object

From Andrew Haley <andrew29@littlepinkcloud.invalid>
Subject Re: The current object
Newsgroups comp.lang.forth
References (9 earlier) <kmm6b0$9bd$1@online.de> <518f7fbb$0$32105$14726298@news.sunsite.dk> <kmrrtk$8nm$1@online.de> <_Lmdnbce8uElYQzMnZ2dnUVZ_sidnZ2d@supernews.com> <2013May14.165102@mips.complang.tuwien.ac.at>
Message-ID <rtWdnXsnF-Vy1g7MnZ2dnUVZ_uWdnZ2d@supernews.com> (permalink)
Date 2013-05-15 03:48 -0500

Show all headers | View raw


Anton Ertl <anton@mips.complang.tuwien.ac.at> wrote:
> Andrew Haley <andrew29@littlepinkcloud.invalid> writes:
>>Bernd Paysan <bernd.paysan@gmx.de> wrote:
>>> Note that this doesn't really work.  For the user of an object, it's
>>> a black box (you can't access the ivars directly), but for derived
>>> classes, it's a "grey box" - you *can* access the ivars.
> 
> That's what e.g., objects.fs does, but there is no general way to get
> that kind of visibility in Java.
> 
>>IMO this is wrong -- it breaks encapsulation.  A subclass shouldn't
>>access ivars any more than any other class.  (But, of course, I am not
>>saying that a mechanism should prevent it, just that there's nothing
>>special about subclasses.)
> 
> That's a question of design.

Indeed.  :-)

> My collegue who is more into OO than I am tells me that inheritance is
> overrated; according to him, for long-lived programs that see quite a
> bit of change, inheritance is mostly eliminated over time,

Hmm.  I certainly haven't noticed that.  Inheritance is partly
eliminated over time, I can accept.

> and what remains is the substitution principle. In that kind of
> world, yes, a subclass probably should not access the instance
> variables of its superclass, and you probably should not be using a
> subclass at all.

Why not?  The substitution principle applies well to subclasses.

> However, if we are less intent on keeping changes local and avoiding
> rewrites, inheritance may be a way to keep code tighter, and
> accessing instance variables inherited from the parent class(es) may
> help with that goal, too. 

I'm not sure about that: the overhead (to the programmer) of creating
accessors doesn't have to be great and serves as a notice to the
reader of a class.

> If it took from 1967 (Simula-67) to 1994 to find the substitution
> principle,

It did not take until 1994 to find the substitution principle.  Liskov
herself talked about it in 1987.  People using OO for work knew it all
along, if perhaps only subconsciously.

> and if people still do not follow it when they do OO design, maybe
> the disadvantages of not following it are not so bad.

Some do, some don't.

Andrew.

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


Thread

Re: The current object (was: Went open source with my GA144 ...) Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-02 02:12 +0200
  Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-02 04:52 -0400
  Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-02 04:31 -0500
    Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-02 18:25 +0200
      Re: The current object anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-02 16:58 +0000
        Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-02 22:26 +0200
          Re: The current object anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-06 14:52 +0000
            Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 03:47 +0200
              Re: The current object anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-07 15:22 +0000
      Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-02 12:12 -0500
        Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-02 21:56 +0200
          Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-03 03:19 -0500
          Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-03 06:54 -0400
  Re: The current object (was: Went open source with my GA144 ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-02 14:28 +0000
    Re: The current object (was: Went open source with my GA144 ...) Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-02 19:58 +0200
      Re: The current object (was: Went open source with my GA144 ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-03 16:50 +0000
        Re: The current object (was: Went open source with my GA144 ...) Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-04 18:58 +0200
          Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-04 13:35 -0500
            Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-05 01:08 +0200
              Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-04 18:29 -0500
                Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-05 03:00 +0200
                Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-05 03:48 -0500
                Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-05 23:15 +0200
                Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-06 05:01 -0500
                Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 03:23 +0200
                Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-07 03:39 -0500
                Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 19:00 +0200
                Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-07 13:34 -0500
                Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 22:00 +0200
                Re: The current object anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-08 07:26 +0000
                Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-05 06:39 -0400
                Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-05 09:15 -0500
                Re: The current object Paul Rubin <no.email@nospam.invalid> - 2013-05-05 09:25 -0700
                Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-05 11:43 -0500
                Re: The current object Paul Rubin <no.email@nospam.invalid> - 2013-05-05 09:59 -0700
                Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-06 05:06 -0500
                Re: The current object Mark Wills <forthfreak@gmail.com> - 2013-05-06 00:19 -0700
                Re: The current object "WJ" <w_a_x_man@yahoo.com> - 2013-05-13 22:45 +0000
              Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-05 06:39 -0400
                Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-05 23:40 +0200
          Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-05 06:39 -0400
            Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-05 23:29 +0200
              Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-06 05:10 -0500
              Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-08 07:35 -0400
                Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-09 00:06 +0200
                Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-09 06:41 -0400
                Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-11 21:31 +0200
                Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-12 07:40 -0400
                Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-14 01:10 +0200
                Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-14 03:58 -0500
                Re: The current object anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-14 14:51 +0000
                Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-15 03:48 -0500
                Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-14 18:37 +0200
                Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-14 14:42 -0500
                Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-15 00:22 +0200
                Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-15 02:56 -0500
                Re: The current object stephenXXX@mpeforth.com (Stephen Pelc) - 2013-05-15 13:52 +0000
                Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-15 17:58 +0200
                Re: The current object albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-05-17 14:01 +0000
                Re: The current object johno <email@address.com> - 2013-05-15 22:38 +0100
                Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-14 06:27 -0400
                Re: The current object albert@spenarnc.xs4all.nl (Albert van der Horst) - 2013-05-09 16:06 +0000
          Re: The current object (was: Went open source with my GA144 ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-06 16:12 +0000
            Re: The current object (was: Went open source with my GA144 ...) Alex McDonald <blog@rivadpm.com> - 2013-05-06 10:25 -0700
            Re: The current object (was: Went open source with my GA144 ...) Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 04:00 +0200
              Re: The current object (was: Went open source with my GA144 ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-07 15:02 +0000
            Re: The current object (was: Went open source with my GA144 ...) Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 04:09 +0200
              Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-07 03:41 -0500
                Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 19:02 +0200
              Re: The current object (was: Went open source with my GA144 ...) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-07 14:33 +0000
                Re: The current object (was: Went open source with my GA144 ...) Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-07 19:40 +0200
      Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-15 16:46 +0200
        Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-15 13:11 -0500
          Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-15 23:23 +0200
            Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-16 02:24 -0500
              Re: The current object anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-16 13:55 +0000
              Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-16 17:45 +0200
                Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-18 05:13 -0500
                Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-18 06:43 -0400
                Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-18 10:03 -0500
                Re: The current object Doug Hoffman <glidedog@gmail.com> - 2013-05-18 11:30 -0400
                Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-19 01:20 +0200
                Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-19 12:33 -0500
                Re: The current object Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-19 01:07 +0200
                Re: The current object Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-19 03:58 -0500
          OO dispatch (was: The current object) anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-16 14:07 +0000
            Re: OO dispatch Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-18 05:28 -0500
              Re: OO dispatch anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-20 11:28 +0000
                Re: OO dispatch Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-20 09:00 -0500
                Re: OO dispatch Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-21 01:37 +0200
                Re: OO dispatch Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-21 03:21 -0500
                Re: OO dispatch anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-21 12:24 +0000
                Re: OO dispatch Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-21 10:18 -0500
                Re: OO dispatch anton@mips.complang.tuwien.ac.at (Anton Ertl) - 2013-05-21 16:03 +0000
                Re: OO dispatch Andrew Haley <andrew29@littlepinkcloud.invalid> - 2013-05-21 12:55 -0500
                Re: OO dispatch Bernd Paysan <bernd.paysan@gmx.de> - 2013-05-29 00:00 +0200
                Re: OO dispatch Mark Wills <markrobertwills@yahoo.co.uk> - 2013-05-28 15:49 -0700

csiph-web