This discussion is archived
1 2 Previous Next 29 Replies Latest reply: Dec 14, 2009 7:16 AM by 843798 Go to original post RSS
  • 15. Re: Dynamic Reflection Casting to Super-Class
    791266 Explorer
    Currently Being Moderated
    nomad311 wrote:
    kaj,
    what name have I called anyone? I called his proposed solution to my question "borderline stupid", meaning I didn't call his approach stupid much less the poster.
    Read reply #14
  • 16. Re: Dynamic Reflection Casting to Super-Class
    791266 Explorer
    Currently Being Moderated
    >
    No one who has rejected my solution is confused about the problem or the solution (which is what that article addresses),
    What article? I still don't understand what problem you are trying to solve, and thinks that what you are trying to do looks odd.
    but no one that as posted here has even attempted to presented a solution that doesn't involve this level of reflection yet solves the throughly described problem.
    Where do you explain the actual problem, and why this is needed?
    No one here seems to be interested in why I went through the trouble of researching a coming up with a solution to this problem. One person asserts that there is no need for such a dynamic solution, and gives one that can only be applied to a single scenario. Not only does no one see a problem with this, they agree. To what, that I should limit this library to handle just this one/two scenario(s)? Then what, expand it as necessary? Create another library? For what benefit? Speed? Efficiency? This library will be used on an application or utility server, not inside an Android app.
    Mind you that most of the people who have posted in this thread have more than 15 years of programming experience, and that most of us also have been programming in Java for more than 10 years. My occupation is to write frameworks and custom application servers. I didn't write that to brag, I wrote that so that you would understand the background of those who have been answering in this thread. Why? Because when we say that something sounds odd, we mean that it's probably not a common problem, or that you haven't described the problem so that we can understand it.

    I would actually bet my 5 cents on the fact that you have a real problem that you have tried to solve in the wrong way, and your original problem is not that you need to "take an instance of a known class and dynamically cast it to its super-class by string. This would allow me to start with any class and reuse the code." Your problem started somewhere else.
  • 17. Re: Dynamic Reflection Casting to Super-Class
    843798 Newbie
    Currently Being Moderated
    nomad311 wrote:
    george,
    where is your justification for your comment, you made no attempt to solve the question at hand, and you apparently didn't read the whole post before chiming in. Making the code compilable would have complicated the example, how many possible outputs could this code give
    One of the funniest things I've read on here in some time. I think I'll try that one on my PM. "Oh, sorry boss, but making the code actually work would have made in too complicated".

    What question? It's not even vaguely clear what purpose this "code" would have. Your use of the old "deliberately vague class names" trick hides any semblance of usefulness you might perceive. To be perfectly frank, all I can see is the sort of code newbs churn out when they first discover reflection, and think it magically solves every problem they might encounter, including the apparent holy grail of software development, "infinite flexibility". In my experience, hacking reflectively at members of other classes completely destroys any hope of flexibility you might have had. Not only are you dependent on a concrete class, you're dependent upon that exact implementation of that concrete class. My suspicions were first aroused by your use of the phrase "This would allow me to start with any class and reuse the code". What are you talking about? I've never stumbled upon such a requirement, and before you claim that I'm some code monkey that simply can't possibly comprehend what you're doing, I ask you to provide an actual, real example of when you had to re-use a class you had absolutely no foreknowledge of whatsoever, in a production, rathetr than "a extends b in my bedroom" environment.

    When one trims out all the pointlessness from your code, one is left with a snippet from a basic reflection tutorial. Forgive me for not seeing the big win here.
  • 18. Re: Dynamic Reflection Casting to Super-Class
    791266 Explorer
    Currently Being Moderated
    .. What I think the OP should google on is usage of interfaces, and ioc containers.
  • 19. Re: Dynamic Reflection Casting to Super-Class
    843798 Newbie
    Currently Being Moderated
    kajbj wrote:
    .. What I think the OP should google on is usage of interfaces, and ioc containers.
    Definitely.

    OP, why do you keep banging on about "nobody has tried to solve my problem" when you haven't even posted one? The closest you've come is to say "What I am trying to do Is take an instance of a known class and dynamically cast it to its super-class by string." and the answer to that is to simply refer to it via a superclass reference. You understand that we don't cast objects right?

    When you say "This would allow me to start with any class and reuse the code" you're really into the realms of fantasy here. At what point have you discovered a need to use just any old class, with zero knowledge whatsoever about it, and also needed to use it's supertypes? As far as I'm concerned, you're trying to solve a non-existent problem. Prove me wrong.
  • 20. Re: Dynamic Reflection Casting to Super-Class
    796085 Newbie
    Currently Being Moderated
    This is the best thread I've read since the "pass by reference" thread... :-)
  • 21. Re: Dynamic Reflection Casting to Super-Class
    843798 Newbie
    Currently Being Moderated
    dannyyates wrote:
    This is the best thread I've read since the "pass by reference" thread... :-)
    Oy.

    ~
  • 22. Re: Dynamic Reflection Casting to Super-Class
    843798 Newbie
    Currently Being Moderated
    dannyyates wrote:
    This is the best thread I've read since the "pass by reference" thread... :-)
    The pass by reference thread? That's like saying "this is the best joke since the one about the Scotsman, Englishman and Irishman".

    The funniest thread I remember was the "Apple screwed up by not putting a JRE on the iPhone" one. But all the funniest threads are the ones that remind me of [the latest XKCD|http://xkcd.com/] strip. This one included.
  • 23. Re: Dynamic Reflection Casting to Super-Class
    843798 Newbie
    Currently Being Moderated
    georgemc wrote:
    The pass by reference thread? That's like saying "this is the best joke since the one about the Scotsman, Englishman and Irishman".
    Indeed.
    the latest XKCD strip.
    Heh. **snort**

    ~
  • 24. Re: Dynamic Reflection Casting to Super-Class
    843798 Newbie
    Currently Being Moderated
    yawmark wrote:
    georgemc wrote:
    The pass by reference thread? That's like saying "this is the best joke since the one about the Scotsman, Englishman and Irishman".
    Indeed.
    Your search - <i>site:forums.sun.com</i>yawmark dafei pass reference - did not match any documents.

    Suggestions:

    * Make sure all words are spelled correctly.
    * Try different keywords.
    * Try more general keywords.
    * Try fewer keywords.
    >

    I'm not kidding. Seems even Google got fed up with daFei, eventually. The first hit for 'daFei "pass by reference"' is quite funny though.
  • 25. Re: Dynamic Reflection Casting to Super-Class
    843798 Newbie
    Currently Being Moderated
    georgemc wrote:
    yawmark wrote:
    georgemc wrote:
    The pass by reference thread? That's like saying "this is the best joke since the one about the Scotsman, Englishman and Irishman".
    Indeed.
    Your search - <i>site:forums.sun.com</i>yawmark dafei pass reference - did not match any documents.
    Lovely forum markup again. Quoted, the link is correct. Cripes.
    The first hit for 'daFei "pass by reference"' is quite funny though.
    Ha!

    ~
  • 26. Re: Dynamic Reflection Casting to Super-Class
    796085 Newbie
    Currently Being Moderated
    georgemc wrote:
    dannyyates wrote:
    This is the best thread I've read since the "pass by reference" thread... :-)
    The pass by reference thread?
    Yes.
    daFei "pass by reference"
    Yep. That's the one!
    yawmark wrote:
    The first hit for 'daFei "pass by reference"' is quite funny though.
    LMFAO!
  • 27. Re: Dynamic Reflection Casting to Super-Class
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated
    nomad311 wrote:
    No one here seems to be interested in why I went through the trouble of researching a coming up with a solution to this problem. One person asserts that there is no need for such a dynamic solution, and gives one that can only be applied to a single scenario. Not only does no one see a problem with this, they agree. To what, that I should limit this library to handle just this one/two scenario(s)? Then what, expand it as necessary? Create another library? For what benefit? Speed? Efficiency? This library will be used on an application or utility server, not inside an Android app. What's the ultimate goal of convincing me and others that a solution to an existing problem is invalid?
    I believe it would be interesting to see the business case. You haven't presented that at least not that I can see.

    Other than that many people come here asking why their solutions don't work and when (if) they take the time to explain the problem (not the solution) an alternative solution which does work is often apparent. Other times the problem description makes it apparent that a solution is not possible (something is wrong with the description itself). Because of this I suspect that some of us consider it more productive to have a description of an actual problem.
  • 28. Re: Dynamic Reflection Casting to Super-Class
    jschellSomeoneStoleMyAlias Expert
    Currently Being Moderated
    georgemc wrote:
    nomad311 wrote:
    george,
    where is your justification for your comment, you made no attempt to solve the question at hand, and you apparently didn't read the whole post before chiming in. Making the code compilable would have complicated the example, how many possible outputs could this code give
    One of the funniest things I've read on here in some time. I think I'll try that one on my PM. "Oh, sorry boss, but making the code actually work would have made in too complicated".
    I like it. Just think, QA can't write bugs because the app doesn't run but that itself is a feature. When they need to verify specific requirements I will just point to a comment that says it works.
  • 29. Re: Dynamic Reflection Casting to Super-Class
    843798 Newbie
    Currently Being Moderated
    jschell wrote:
    georgemc wrote:
    nomad311 wrote:
    george,
    where is your justification for your comment, you made no attempt to solve the question at hand, and you apparently didn't read the whole post before chiming in. Making the code compilable would have complicated the example, how many possible outputs could this code give
    One of the funniest things I've read on here in some time. I think I'll try that one on my PM. "Oh, sorry boss, but making the code actually work would have made in too complicated".
    I like it. Just think, QA can't write bugs because the app doesn't run but that itself is a feature. When they need to verify specific requirements I will just point to a comment that says it works.
    That tactic is actually quite a neat way to trick people into giving you requirements they'd previously gone out of their way to avoid being pinned down on.
1 2 Previous Next