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=-1.9 required=5.0 tests=BAYES_00,FREEMAIL_FROM autolearn=unavailable autolearn_force=no version=3.4.4 X-Received: by 10.107.32.81 with SMTP id g78mr8064834iog.120.1512420100233; Mon, 04 Dec 2017 12:41:40 -0800 (PST) X-Received: by 10.157.85.67 with SMTP id h3mr704971oti.10.1512420100134; Mon, 04 Dec 2017 12:41:40 -0800 (PST) Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!feeder.eternal-september.org!news.kjsl.com!usenet.stanford.edu!i6no3004109itb.0!news-out.google.com!s63ni3802itb.0!nntp.google.com!193no1303276itr.0!postnews.google.com!glegroupsg2000goo.googlegroups.com!not-for-mail Newsgroups: comp.lang.ada Date: Mon, 4 Dec 2017 12:41:39 -0800 (PST) In-Reply-To: Complaints-To: groups-abuse@google.com Injection-Info: glegroupsg2000goo.googlegroups.com; posting-host=173.71.208.22; posting-account=QF6XPQoAAABce2NyPxxDAaKdAkN6RgAf NNTP-Posting-Host: 173.71.208.22 References: <889a3aed-4e6b-49c8-8c1c-6f1478e8e077@googlegroups.com> User-Agent: G2/1.0 MIME-Version: 1.0 Message-ID: Subject: Re: Full view of a private partial view cannot be a subtype From: Jere Injection-Date: Mon, 04 Dec 2017 20:41:40 +0000 Content-Type: text/plain; charset="UTF-8" Xref: reader02.eternal-september.org comp.lang.ada:49365 Date: 2017-12-04T12:41:39-08:00 List-Id: On Monday, December 4, 2017 at 1:04:28 PM UTC-5, Jeffrey R. Carter wrote: > On 12/03/2017 11:23 PM, Jere wrote: > > > > Well, I think either form is a bit too polar. I've always been taught that > > you use the tool that makes the most sense given the context. If a type > > has an "is a" relationship, you favor extension. But if it has a "has a" > > relationship, you favor composition. If the situation is unique enough, > > then you do something outside the norm. > > The most important thing is to create the simplest and clearest code possible. > Tools must be judged by how well they help achieve this. Between type extension > and composition, composition is almost always easier to read and understand. > I don't disagree in general per say, but that is a very subjective thing. I don't find composition nearly as readable as you do. It has it's place and can be more readable, but (maybe it's just how I read and visualize) I find extension to be more readable in probably more cases than you typically do. It's just a personal thing with how I read. I've used and written both. In the case of the topic at hand, I do think composition leads to cleaner more readable code. I do still get stuck with some extra "noisy" conversions, but way less than the extension method in this case.