This discussion is archived
1 2 Previous Next 22 Replies Latest reply: Nov 30, 2012 2:19 AM by 966867 Go to original post RSS
  • 15. Re: Override generic parameters
    966867 Newbie
    Currently Being Moderated
    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:
    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);
         }
    }
    Best Regards
    Andrej
  • 16. Re: Override generic parameters
    EJP Guru
    Currently Being Moderated
    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.
    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.
    It's still called method overloading. Nothing you can do about that.
    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 Newbie
    Currently Being Moderated
    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:
    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);
         } 
    }
    Do you mean the method setMap(..) in D is redundant?
    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 Expert
    Currently Being Moderated
    zarr wrote:
    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:
    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);
         } 
    }
    Do you mean the method setMap(..) in D is redundant?
    i believe i posted exactly this about 15 comments back.
  • 19. Re: Override generic parameters
    EJP Guru
    Currently Being Moderated
    I have posted this code before:
    (snip)
    Do you mean the method setMap(..) in D is redundant?
    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.
    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 Newbie
    Currently Being Moderated
    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 Guru
    Currently Being Moderated
    zarr wrote:
    Please take a look at this not existing but possible java syntax. The generics appended to the method name. instead to class name.
    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?
  • 22. Re: Override generic parameters
    966867 Newbie
    Currently Being Moderated
    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 :-)
1 2 Previous Next

Legend

  • Correct Answers - 10 points
  • Helpful Answers - 5 points