This content has been marked as final.
Show 22 replies
-
15. Re: Override generic parameters
966867 Nov 29, 2012 6:20 AM (in response to EJP)EJP wrote:My 'point of view' is simply that you can't rationally expect anybody to understand your code before you post it
I gave a simple example which generalizes the problem. I personally don’t use such code until now, because I didn’t understand the meaning of it. I firstly want discuss it here and understand it.
EJP wrote:Modification of parameters is called method overloading.
Firstly I also thought on method overloading but I don’t like that the API became polluted by methods which I don’t want any more to use in extended classes.
EJP wrote:Modification of parameters is called method overloading.
The comparison with hook points is awkward.
I think if Generics would be more sophisticated, then it would solve the problem I speak about. Generics would be distributed in single code-fragments.
For example the syntax of future-generics could be:
Best Regardspublic class C{ public void setMap<M extends Map>(M map) { } } public class D extends C { @Override public void setMap<SortedMap>(SortedMap map) { //new logic which is based on parameter and is type-safely SortedMap<Integer, String> headMap = map.headMap(10); super.setMap(headMap); } }
Andrej -
16. Re: Override generic parameters
EJP Nov 29, 2012 9:59 AM (in response to 966867)I gave a simple example which generalizes the problem.
No. You wrote as follows:please take a look at following example and explain why entire method is redundant?
As nobody had seen the code before, let alone described as 'redundant', why you asked us to explain why it was redundant remains a mystery. It isn't. I don't know why you're still wasting time on this issue.
It's still called method overloading. Nothing you can do about that.EJP wrote:Modification of parameters is called method overloading.
Firstly I also thought on method overloading but I don’t like that the API became polluted by methods which I don’t want any more to use in extended classes.The comparison with hook points is awkward.
As nobody else knows what you're talking about, any awkwardness lies with you to resolve.I think if Generics would be more sophisticated, then it would solve the problem I speak about.
Whatever that is. You keep changing it. -
17. Re: Override generic parameters
966867 Nov 29, 2012 7:35 PM (in response to EJP)EJP wrote:As nobody had seen the code before, let alone described as 'redundant', why you asked us to explain why it was redundant remains a mystery. It isn't. I don't know why you're still wasting time on this issue.
I have posted this code before:
Do you mean the method setMap(..) in D is redundant?public class C<M extends Map<Integer, String>> { public void setMap(M map) { } } public class D extends C<SortedMap<Integer, String>> { @Override public void setMap(SortedMap<Integer, String> map) { super.setMap(map); } }
EJP wrote:It's still called method overloading. Nothing you can do about that.
I try to discuss generic methods, where parameters-types can be instantiated in the same way as Generic types in the class, but I have understood it first during our discussion :-)
EJP wrote:As nobody else knows what you're talking about, any awkwardness lies with you to resolve.
This word are well known terms in area of building of frameworks in software-technology. For example Prof. Aßmann of Technischer Universität Dresden said about it:
>
1) Variability design patterns can be used as framework variation points (framework variation hooks)
2) Extensibility design patterns can be used as framework extension points (framework extension hooks)
>
http://st.inf.tu-dresden.de/Lehre/WS09-10/dpf/slides/08-framework-variability-1x2.pdf -
18. Re: Override generic parameters
jtahlborn Nov 29, 2012 7:57 PM (in response to 966867)zarr wrote:
i believe i posted exactly this about 15 comments back.EJP wrote:As nobody had seen the code before, let alone described as 'redundant', why you asked us to explain why it was redundant remains a mystery. It isn't. I don't know why you're still wasting time on this issue.
I have posted this code before:
Do you mean the method setMap(..) in D is redundant?public class C<M extends Map<Integer, String>> { public void setMap(M map) { } } public class D extends C<SortedMap<Integer, String>> { @Override public void setMap(SortedMap<Integer, String> map) { super.setMap(map); } }
-
19. Re: Override generic parameters
EJP Nov 29, 2012 11:12 PM (in response to 966867)I have posted this code before:
That's what was said. The old code was redundant. The new code is non-redundant. Comments on the old version do not necessarily apply to the new version. I am still waiting for some evidence that you have understood this basic fact. If you can't understand plain English you have no hope of understanding computing.
(snip)
Do you mean the method setMap(..) in D is redundant?This word are well known terms in area of building of frameworks in software-technology. For example Prof. Aßmann of Technischer Universität Dresden said about it:
Not having attended this institute, or read the good Herr Professor's works, they are unknown to me. And I've been doing this for 41 years. In any case what we are doing here is defining methods, not building frameworks. We should use the terminology appropriate to the discipline. -
20. Re: Override generic parameters
966867 Nov 30, 2012 12:08 AM (in response to EJP)EJP wrote:That's what was said. The old code was redundant. The new code is non-redundant. Comments on the old version do not necessarily apply to the new version. I am still waiting for some evidence that you have understood this basic fact. If you can't understand plain English you have no hope of understanding computing.
I think you noticed English is not my mother language, but I think it's enough to understand what you mean. I believe I can’t explain my point of view.
Please take a look at this not existing but possible java syntax. The generics appended to the method name. instead to class name.public class C{ public void setMap<M extends Map>(M map) { } } public class D extends C { @Override public void setMap<SortedMap>(SortedMap map) { //new logic which is based on parameter and is type-safely SortedMap<Integer, String> headMap = map.headMap(10); super.setMap(headMap); } }
-
21. Re: Override generic parameters
gimbal2 Nov 30, 2012 9:11 AM (in response to 966867)zarr wrote:
I'm really lost. Just what after this entire misguided and largely pointless thread are you expecting people to be able to answer to this?
Please take a look at this not existing but possible java syntax. The generics appended to the method name. instead to class name. -
22. Re: Override generic parameters
966867 Nov 30, 2012 10:19 AM (in response to gimbal2)gimbal2 wrote:I'm really lost. Just what after this entire misguided and largely pointless thread are you expecting people to be able to answer to this?
There are buttons: helpful, correct it would be useful to have “pointless” button, thus posts can be filtered. Currently now we again don’t discuss the subject of this thread :-)