From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-0.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,8591be732d0fce98 X-Google-Attributes: gid103376,domainid0,public,usenet X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news3.google.com!feeder.news-service.com!feeder6.cambrium.nl!feed.tweaknews.nl!xlned.com!feeder1.xlned.com!chloor.box.nl!217.188.199.138.MISMATCH!storethat.news.telefonica.de!telefonica.de!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: Ada OOP alternatives? Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <462e0cf4-1d53-4918-b30b-dd3d8df90f1b@p25g2000hsf.googlegroups.com> <487d9636$0$6543$9b4e6d93@newsspool3.arcor-online.net> <6e5uq2F5g7n6U2@mid.individual.net> <1y046u74vmwh3.19jm2fcdx5xpt.dlg@40tude.net> <5ob7w7usrc74$.kms2e1vqs4k0.dlg@40tude.net> <48883529$0$18826$9b4e6d93@newsspool2.arcor-online.net> <48883f41$0$18829$9b4e6d93@newsspool2.arcor-online.net> <6i1s0y8eeka.121ek9qcgunha$.dlg@40tude.net> <48885757$0$18818$9b4e6d93@newsspool2.arcor-online.net> <48899335$0$18824$9b4e6d93@newsspool2.arcor-online.net> Date: Fri, 25 Jul 2008 15:28:33 +0200 Message-ID: NNTP-Posting-Date: 25 Jul 2008 15:28:33 CEST NNTP-Posting-Host: b2503d33.newsspool1.arcor-online.net X-Trace: DXC=7YW<8_S5KeIAa;:RKVJ>LEic==]BZ:afN4Fo<]lROoRA4nDHegD_]REGmQO\>LQj:@DNcfSJ;bb[EFCTGGVUmh?DLK[5LiR>kgB On Fri, 25 Jul 2008 10:47:49 +0200, Georg Bauhaus wrote: [...] > Suppose you try to use an IDE in place of "separate", > to hide away the details of Special_Case. Then the dependences > on the with'ed package Ada.Text_IO and on All_Kinds_of_Things_Neccessary > will have to be listed for the entire package. Yes, but it would not change dependencies. The difference is merely visual, wth-es appears in the parent body. So what? I never read with clauses. They are semantically useless, impose a maintenance problem (GNAT does not always warn about superfluous with's). Better, there should be a "without" clause/pragma (:-)) > Observation 2: [...] > What amount of work is needed to make this reusable? I cannot tell, because the example is ill-designed in my eyes. IMO, it should be designed as a [private] child with: type Special_T is new T with ...; -- The "special case" is this overrides procedure Op (Item : T); -- This is an implementation of So, yes, an ADT, even if it is a singleton today. > Granted, there are cases when a child package seems a > much better choice. For example, when the special communications > procedure needs to maintain state information that is of > no concern to any other subprogram anywhere. Bad, very bad, design. Only objects should have states. Global variables is a no-no. There cannot be stateful procedures otherwise than impure, with global variables. >>> Why, e.g., build an entire type when a single procedure >>> is sufficient, and will be sufficient in the future? >> >> How can you know that? > > Sometimes the future of a program is known. For example, > known to end, because the strange device is no longer produced > and the support has ended. The special case procedure dies > with the special case device/program. Even if a strange device is no more produced, it is still used by customers. And customer requirements change. Bad design never pays off. >>> Many languages have a function type >>> built in, functions are objects. >> >> But not in the sense of a stateful object of OO. > > Yes, there are function objects in the sense of a stateful object > of OO. Hmm, if you mean active objects, like Ada task types, then observe that they are not procedures. A task type has methods (entry points), which are procedures. If you mean a procedural abstraction of some external stateful thing, like random generator, then it is a bad design. The state should be explicitly bound to some visible object to which the procedure would be applied. -- Regards, Dmitry A. Kazakov http://www.dmitry-kazakov.de