• Nevermind (unregistered) in reply to dg

    Whoa... Guess I can give up all hopes of ever becoming a senior developer. I shall never achieve SUCH stupidity, that's for sure.

  • (cs)

    Do you think he was simply making a point that Inheritance as a programming tool becomes so confusing in a real world (IT) application as to be very dangerous?

    Its fine with trivial animal examples of course, and I *always* use it for that sort of application:-)

  • anon (unregistered) in reply to Jeff S
    Jeff S:
    I'd love to see the rest of this system ... it does make you think, though.  What if you just started working at this company and were present for this informative demonstration?  What would you do or say?


    I would report these people to one or more of
    a) HR department, for removal
    b) Owners and board of the company, for strategic reorganization
    c) Public health authorities, for mandatory treatment
    d) Their CS professors, for the shame value
  • nSpatial (unregistered)

    A former VB programmer, I'll wager... should be taken outside and poked with sharp sticks

  • (cs) in reply to nSpatial

    And for the next question....

    Who can tell me the difference between inheritance and hierarchy?

    ...

    Walkthrough? Walkthrough my ass...(not literally, of course).

  • (cs) in reply to Ytram

    Eek, these people are just getting worse and worse. Unrolled recursion; whatever next?

  • (cs) in reply to nSpatial
    Anonymous:
    A former VB programmer, I'll wager... should be taken outside and poked with sharp sticks


    Damn. Remind me to never work with any of you folks.

    (Seriously, because you'll kill me, eventually. I'll die laughing when you take someone outside and start jabbing sharpened sticks at them)

  • vhawk (unregistered)

    This had the whole office in stitches - not to mention the comments - why can we not have a fun WTF like this every day ...  This process adds new meaning to parenting ....

  • (cs) in reply to AntiDragon

    AntiDragon:
    Who can tell me the difference between inheritance and hierarchy?

    WTF! The difference is RTFM, everybody knows [6]

  • (cs) in reply to AntiDragon

    AntiDragon:
    And for the next question....

    Who can tell me the difference between inheritance and hierarchy?

    Assuming you really want to know, a book about Object Oriented programming can give you the gory details.  Here is the basic difference. Inheritance occurs when a class gets at least part of its definition from another class, called a base class.  Hiearchy is the location of the class in the namespace and affects how you instantiate the class.

  • David (unregistered) in reply to John Bigboote

    John Bigboote:

    Chapter 3: Understanding loops

    Loops are for wimps.  What you need here is full-blow recursion.

  • David (unregistered) in reply to DanielR

    Anonymous:
    Why didn't he write a GrandParent method that returns Parent.Parent? (this.Parent.Parent.Parent.Parent.Parent.Parent != null) --> (this.GrandParent.GrandParent.GrandParent != null) And while we're at it, let's add a Sister method, a BrotherInLaw method and a CrazyAuntYouOnlyMeetOnHolidays method.

    Awesome.  I have actually written "getGrandChildren" methods (lazy) but never "brother in law". [:P]

  • (cs) in reply to David
    Anonymous:

    John Bigboote:

    Chapter 3: Understanding loops

    Loops are for wimps.  What you need here is full-blow recursion.

    Huh?  Recursion is easy.  Converting a slow stack overflowing recursive method to a loop can be challenging.

  • (cs) in reply to David
    Anonymous:

    Anonymous:
    Why didn't he write a GrandParent method that returns Parent.Parent? (this.Parent.Parent.Parent.Parent.Parent.Parent != null) --> (this.GrandParent.GrandParent.GrandParent != null) And while we're at it, let's add a Sister method, a BrotherInLaw method and a CrazyAuntYouOnlyMeetOnHolidays method.

    Awesome.  I have actually written "getGrandChildren" methods (lazy) but never "brother in law". [:P]



    I've written Uncle() and Sister() functions to travel a tree hierachy.

    Several months later, I discovered recursion and reduced my script by 75%.
  • (cs) in reply to Mike R

    Mike R:
    Anonymous:
    A former VB programmer, I'll wager... should be taken outside and poked with sharp sticks


    Damn. Remind me to never work with any of you folks.

    (Seriously, because you'll kill me, eventually. I'll die laughing when you take someone outside and start jabbing sharpened sticks at them)

    Well I guess that I would be the one being poked [:D]  But my saving grace is I also know C, C++, C#, Java, Assembly, and Pascal.  Damn, I get a head rush saying all that, way too many frickn years learning all that crap.  That is why I use VB, it's simplicity is beautiful, but (ducks more sharp instruments) you can screw up just as bad in any language.  It's the programmer not the language. [:P][:D]

  • Daniel T (unregistered) in reply to dubwai

    This one is up there :-)

    Is it even possible for Parent to be null?

  • (cs) in reply to cm5400
    cm5400:

    That is why I use VB, it's simplicity is beautiful, but (ducks more sharp instruments) you can screw up just as bad in any language.  It's the programmer not the language. [:P][:D]



    True.  However, some languages just promote irresponsible coding, by sheer virtue of being targetted at inexperienced "programmers", or adevertised as the cure for (overly) Rapid Application Development.

        dZ.
  • (cs) in reply to DZ-Jay
    DZ-Jay:
    ...or adevertised as the cure for (overly) Rapid Application Development.


    Dammit! That should have been "... as a tool for ..."

        dZ.
  • (cs)

    Sometimes I wonder about the code I see here, and if I was less experienced I might not believe someone actually wrote this.

    We should introduce a 'Wall of Shame' and post this guy's data on it, preferably linked to his CV for easy future reference for potential employers. It would be a civil service. My God, the horror ! the Horror ![:#]

  • (cs) in reply to DanielR

    Anonymous:
    Why didn't he write a GrandParent method that returns Parent.Parent? (this.Parent.Parent.Parent.Parent.Parent.Parent != null) --> (this.GrandParent.GrandParent.GrandParent != null) And while we're at it, let's add a Sister method, a BrotherInLaw method and a CrazyAuntYouOnlyMeetOnHolidays method.

    Heh, we could even write methods to XPath programatically (PrecedingSibling, AncestorOrSelf etc), and it would fit the context [:S]

  • (cs)

    <FONT size=2>What I find even more amusing is that nobody even mentioned the fact that this code won't compile anyway. The method signature indicates a bool return value. He obviously needs to be turned on to ReSharper; it wouldn't help his (advanced) design skills, but would ensure the code compiled.</FONT>

    <FONT size=2>As an exercise for anyone with TMTOTH, I'd love to see the FxCop report on the assembly.</FONT>

  • (cs) in reply to DZ-Jay
    DZ-Jay:
    cm5400:

    That is why I use VB, it's simplicity is beautiful, but (ducks more sharp instruments) you can screw up just as bad in any language.  It's the programmer not the language. [:P][:D]



    True.  However, some languages just promote irresponsible coding, by sheer virtue of being targetted at inexperienced "programmers", or adevertised as the cure for (overly) Rapid Application Development.

        dZ.

    I absolutely agree.  RAD is not necessarily the best thing in all situations, I would rather have it work than have a zillion bugs to deal with.  After a few late nighters I have written a few doozies in my day (blushes) but, I have caught them before going into production.

  • (cs) in reply to bcraun

    <FONT size=1>Drat! My copy/paste skills need a brush up. I see now that it does return a bool...</FONT>

     

  • alex (unregistered) in reply to DanielR

    Surely CrazyAuntYouOnlyMeetOnHolidays would be a property. GetKissFromCrazyAuntYouOnlyMeetOnHolidays would be a method.

  • (cs) in reply to dubwai
    dubwai:
    Anonymous:

    John Bigboote:

    Chapter 3: Understanding loops

    Loops are for wimps.  What you need here is full-blow recursion.

    Huh?  Recursion is easy.  Converting a slow stack overflowing recursive method to a loop can be challenging.



    That's only an issue with tree recursion. If your compiler doesn't do tail recursion on it's own, replace it. Even for C, there's no reason not to support at least some amount of TCO.
  • (cs) in reply to cm5400
    cm5400:
    That is why I use VB, it's simplicity is beautiful


    Whenever I hear someone describe VB as simple, it's is all I can do to keep from laughing myself silly. VB is only easy for trivial work; the language itself is a crawling horror. Even VB.Net, which cleans things up a lot, is still comparable to C++ and Ada for sheer complexity, and the fact that they keep changing it only makes things worse.

    Algol 60 was simple. Scheme is simple. The original K&R C was simple, in certain ways (but a pain to work in). Python is simple. Visual Basic is far from simple.
  • (cs) in reply to neilx
    neilx:

    [Inheritance is] fine with trivial animal examples....



    It also works well with shapes, although I can never remember if a circle is a kind of ellipse or an ellipse is a kind of circle.

    And I've heard that at Borland it is good for vehicles, with 2-doors, 4-doors, and hatchbacks being derived from ABCs (Abstract Base Cars).
  • Zatanix (unregistered) in reply to DrCode

    I'm also bad at remembering things like that. I can never really remember if 2 is a special case of a number, of a number is a special case of 2 ;)

  • Zatanix (unregistered) in reply to Zatanix

    2nd "of" = "or"

  • Barknee (unregistered)

    No ASP.NET, just an obscure object model.  'base' was not to be seen anywhere in this system. This was not the only case, it actually was a lot worse, I mean worse.  You should have seen the debugger when I tried to figure this out.  Basically, you have a base class that every other class derives from.  Instead of using a composite pattern or some other structural pattern in combination with a factory we have a model that looks like this

                                                                     Base

             Derived Derived Derived Derived Derived Derived Derived Derived Derived Derived Derived Derived

    The entire system looks like this.  Every object is a subclass of Base.  That's it.  Again, when I initially started debugging this it was a disaster.

  • Barknee (unregistered) in reply to DanielR

    Holy crap that's funny!

  • (cs) in reply to Schol-R-LEA
    Schol-R-LEA:
    VB is ... a crawling horror.
    What a great description.  Like a '50s drive-in movie.
  • (cs) in reply to neilx
    neilx:
    Do you think he was simply making a point that Inheritance as a programming tool becomes so confusing in a real world (IT) application as to be very dangerous?

    Its fine with trivial animal examples of course, and I *always* use it for that sort of application:-)


    No he wouldn't be making such a point because (1) such a point is stupid, and (2) he was using a data hierarchy and not class inheritence.  You can not point at inheritence as a programming tool and claim "it becomes so confusing in a real world application" because such a claim is ridiculously underqualified.  You benefit from inheritence every damn day if you work with the .Net framework, and even Real World applications can benefit a great deal if the domain model includes IS_A relationships.

    Seriously.  If you're going to crusade against abstractions, at least point people at a concept high school students can't grasp.

  • Charlie Collins (unregistered) in reply to Mike R
    Mike R:
    Anonymous:
    Hmm. The preview function on this forum doesn't do a very good job of it.


    Welcome to "The Daily WTF" [:P]


    Is there a threaded view of this forum or just the quoted quoted quote thing?   Forgive my ignorance with this site but I cant find a threaded view and the "reply" button seems to just stick another message on the stack? 
  • (cs) in reply to Charlie Collins
    Anonymous:
    Mike R:
    Anonymous:
    Hmm. The preview function on this forum doesn't do a very good job of it.


    Welcome to "The Daily WTF" [:P]


    Is there a threaded view of this forum or just the quoted quoted quote thing?   Forgive my ignorance with this site but I cant find a threaded view and the "reply" button seems to just stick another message on the stack? 


    This is a forum style board, as opposed to the threaded reply that you're probably used to on Kuro5hin and Slashdot, so no, there are no threaded replies, since this whole discussion is a thread in itself.
  • a key in f# minor (unregistered)

    TRTRWTF is a boolean function that doesn't return anything.

Leave a comment on “Inheritance 101”

Log In or post as a guest

Replying to comment #37948:

« Return to Article