Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.java.programmer > #36859
| From | Arne Vajhøj <arne@vajhoej.dk> |
|---|---|
| Newsgroups | comp.lang.java.programmer |
| Subject | Re: How to assign an object to another in it method? |
| Date | 2017-07-11 21:52 -0400 |
| Organization | Aioe.org NNTP Server |
| Message-ID | <ok3vcq$o5g$2@gioia.aioe.org> (permalink) |
| References | (14 earlier) <ojhi20$39m$1@jstuckle.eternal-september.org> <ojs006$1ls2$1@gioia.aioe.org> <ojs35k$hf4$1@jstuckle.eternal-september.org> <ok3ppi$j6k$1@gioia.aioe.org> <ok3ups$e2d$1@jstuckle.eternal-september.org> |
On 7/11/2017 9:46 PM, Jerry Stuckle wrote: > On 7/11/2017 8:16 PM, Arne Vajhøj wrote: >> On 7/8/2017 10:12 PM, Jerry Stuckle wrote: >>> On 7/8/2017 9:13 PM, Arne Vajhøj wrote: >>>> On 7/4/2017 10:18 PM, Jerry Stuckle wrote: >>>>> On 7/4/2017 9:46 PM, Arne Vajhøj wrote: >>>>>> On 7/3/2017 11:15 PM, Jerry Stuckle wrote: >>>>>>> On 7/3/2017 10:04 PM, Arne Vajhøj wrote: >>>>>>>> I hope that a static code analysis tool create warnings >>>>>>>> about doing something like that. >>>>>>> >>>>>>> Why should they, Arne? Default values are just that - values used >>>>>>> when >>>>>>> no others are given. They are not the only valid values, and are >>>>>>> there >>>>>>> to be overridden. >>>>>> >>>>>> It indicates that the author of the super class and the author of the >>>>>> sub class seems to disagree on at least one aspect of how the method >>>>>> should be. That is something that should always be examined. Do the >>>>>> classes really reflect an "is a" relation or is the difference a >>>>>> symptom of a bigger difference/problem. >>>> >>>>> If that is the case, then the author of the superclass didn't design it >>>>> properly. Default values are not there to indicate the only valid >>>>> values for a class. They are there to allow for some (or all) >>>>> values to >>>>> be assumed. >>>>> >>>>> If there is a restriction in what the values can be, then that needs to >>>>> be in the appropriate function. Otherwise, there is no restriction. >>>> >>>> Yes. But the topic was not valid values but default values. >>> >>> That is correct. And while the default values will be valid, if there >>> are restrictions on non-default values those go in the function. >>> >>>>> If the subclass does not reflect an "is-a" relationship, that is a >>>>> design problem which has nothing to do with default values. >>>> >>>> If it is the default values that break the "is a" then it has >>>> something to do with it. >>>> >>> >>> No, values don't break an is-a relationship. If the default values do, >>> then you have an invalid relationship in the first place. >> >> It is rather simple English. >> >> Type X is feature set X with a default value of A. >> >> Type Y is a feature set of X + Y with a default value of B. >> >> Y "is a" X is false. >> >> Y "is almost a" X is true. >> >>>>> The bottom line here is - none of your arguments are related to the >>>>> presence or absence of default arguments. All can occur either with or >>>>> without default arguments. >>>> >>>> My argument relates specifically to different default values, so >>>> it can not happen without default arguments. >>> >>> I stand by my statement. >> >> Given that the argument above very clearly relates to "default value" >> then you are proven wrong. >> >>> Default values in a derived class which are >>> not valid for the base class indicates an invalid relationship in the >>> first place. >> >> Yes. But that is a straw man argument because my reasons do >> not relate to valid values at all. >> >>> I would like to see an example of a valid relationship where your >>> default values cause a problem. >> >> It is obvious that there is a problem with "is a". >> >> It could be totally harmless. >> >> Or it could be a good indication of a problem. >> >> It would be worth investigating what it is. > > No, you said the default value for the derived class may be invalid for > the base class. Therefore the inheritance would be invalid. Nope. I never said anything like that. You were the one bringing up valid values. > In a valid hierarchy, derived classes are always more specialized cases > of their base classes. In a case like this you can limit the wage in > the derived class (Manager), but must stay within range of the base > class (Employee). A value in Manager that is not valid in Employee > indicates an invalid inheritance. True. But totally irrelevant for my point, which has nothing to do with valid values. Arne
Back to comp.lang.java.programmer | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to assign an object to another in it method? parmenides <xparmenides@yahoo.com> - 2017-06-18 20:02 +0800
Re: How to assign an object to another in it method? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-06-18 08:09 -0400
Re: How to assign an object to another in it method? Robert Klemme <shortcutter@googlemail.com> - 2017-06-18 15:31 +0200
Re: How to assign an object to another in it method? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-06-19 10:22 -0400
Re: How to assign an object to another in it method? Eric Douglas <e.d.programmer@gmail.com> - 2017-06-19 08:13 -0700
Re: How to assign an object to another in it method? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-06-19 11:53 -0400
Re: How to assign an object to another in it method? Eric Douglas <e.d.programmer@gmail.com> - 2017-06-19 09:06 -0700
Re: How to assign an object to another in it method? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-06-19 13:56 -0400
Re: How to assign an object to another in it method? lewbloch@gmail.com - 2017-06-27 13:49 -0700
Re: How to assign an object to another in it method? Andreas Leitgeb <avl@logic.at> - 2017-06-28 12:20 +0000
Re: How to assign an object to another in it method? Eric Douglas <e.d.programmer@gmail.com> - 2017-06-28 05:51 -0700
Re: How to assign an object to another in it method? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-06-28 14:03 -0400
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-02 21:23 -0400
Re: How to assign an object to another in it method? Martin Gregorie <martin@address-in-sig.invalid> - 2017-07-03 10:59 +0000
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-03 08:38 -0400
Re: How to assign an object to another in it method? Andreas Leitgeb <avl@logic.at> - 2017-07-03 14:04 +0000
Re: How to assign an object to another in it method? Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-03 10:39 -0400
Re: How to assign an object to another in it method? Andreas Leitgeb <avl@logic.at> - 2017-07-03 16:28 +0000
Re: How to assign an object to another in it method? Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-03 16:52 -0400
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-03 22:04 -0400
Re: How to assign an object to another in it method? Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-03 23:15 -0400
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-04 21:46 -0400
Re: How to assign an object to another in it method? Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-04 22:18 -0400
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-08 21:13 -0400
Re: How to assign an object to another in it method? Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-08 22:12 -0400
Re: How to assign an object to another in it method? Andreas Leitgeb <avl@logic.at> - 2017-07-11 17:56 +0000
Re: How to assign an object to another in it method? Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-11 15:40 -0400
Re: How to assign an object to another in it method? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-11 13:49 -0700
Re: How to assign an object to another in it method? Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-11 17:41 -0400
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-11 20:27 -0400
Re: How to assign an object to another in it method? Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-11 21:43 -0400
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-11 21:49 -0400
Re: How to assign an object to another in it method? Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-12 17:20 -0400
Re: How to assign an object to another in it method? Andreas Leitgeb <avl@logic.at> - 2017-07-13 10:08 +0000
Re: How to assign an object to another in it method? Martin Gregorie <martin@address-in-sig.invalid> - 2017-07-13 11:35 +0000
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-13 08:14 -0400
Re: How to assign an object to another in it method? Martin Gregorie <martin@address-in-sig.invalid> - 2017-07-13 14:29 +0000
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-13 13:47 -0400
Re: How to assign an object to another in it method? Andreas Leitgeb <avl@logic.at> - 2017-07-13 18:09 +0000
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-13 15:01 -0400
Re: How to assign an object to another in it method? Andreas Leitgeb <avl@logic.at> - 2017-07-13 19:19 +0000
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-13 15:39 -0400
Re: How to assign an object to another in it method? Andreas Leitgeb <avl@logic.at> - 2017-07-13 16:49 +0000
Re: How to assign an object to another in it method? Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-13 10:24 -0400
Re: How to assign an object to another in it method? Andreas Leitgeb <avl@logic.at> - 2017-07-13 17:19 +0000
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-13 21:17 -0400
Re: How to assign an object to another in it method? Andreas Leitgeb <avl@logic.at> - 2017-07-14 06:40 +0000
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-14 14:26 -0400
Re: How to assign an object to another in it method? Andreas Leitgeb <avl@logic.at> - 2017-07-15 14:36 +0000
Re: How to assign an object to another in it method? Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-14 12:10 -0400
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-14 14:40 -0400
Re: How to assign an object to another in it method? Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-14 14:51 -0400
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-14 21:05 -0400
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-14 21:06 -0400
Re: How to assign an object to another in it method? lewbloch@gmail.com - 2017-07-14 14:44 -0700
Re: How to assign an object to another in it method? Andreas Leitgeb <avl@logic.at> - 2017-07-12 16:23 +0000
Re: How to assign an object to another in it method? Eric Douglas <e.d.programmer@gmail.com> - 2017-07-12 10:12 -0700
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-11 20:16 -0400
Re: How to assign an object to another in it method? Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-11 21:46 -0400
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-11 21:52 -0400
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-11 20:24 -0400
Re: How to assign an object to another in it method? Jerry Stuckle <jstucklex@attglobal.net> - 2017-07-11 21:49 -0400
Re: How to assign an object to another in it method? Arne Vajhøj <arne@vajhoej.dk> - 2017-07-11 21:55 -0400
Re: How to assign an object to another in it method? Martin Gregorie <martin@address-in-sig.invalid> - 2017-07-03 12:37 +0000
Re: How to assign an object to another in it method? Eric Sosman <esosman@comcast-dot-net.invalid> - 2017-07-03 11:34 -0400
Re: How to assign an object to another in it method? Martin Gregorie <martin@address-in-sig.invalid> - 2017-07-03 17:28 +0000
Re: How to assign an object to another in it method? v_borchert@despammed.com (Volker Borchert) - 2017-06-19 17:13 +0000
Re: How to assign an object to another in it method? Eric Douglas <e.d.programmer@gmail.com> - 2017-06-19 13:40 -0700
csiph-web