Unheritance



  • This is another recurring pattern in some of the code I have the pleasure of maintaining.  I'm coining the term 'unheritance' for it, and in the name of the realm.

    string Name { /* nonvirtual */

      get { return mName; } 

      set {

        if (this is SomeSubclass)

          SpecialProcessingForMySubclass(value);

        else

          mName = value;

      }

    }

     



  • The original author slept-in on polymorphism day eh?

    I'm a bit of the opposite, I'll mark stuff as virtual even if I never have plans to override it, just to give me that ability in some whacky scenario.



  • I only program in whacky scenarios.



  •  Hey, that's fantastic. I can see it really streamlining all the subclasses.



  • Fire the guy that wrote this.  If he's already gone, you should go to.  Rather than have to maintain this... 



  • @dogbrags said:

    Fire the guy that wrote this.  If he's already gone, you should go to.  Rather than have to maintain this... 
     

    Funny you should mention...  The last project was a pretty big WTF from beginning to end, with a precious few bright spots.  This code has 35 days to live, and then we'll be on to the next project.  The next one, while similar, will be undertaken by only two of the same people as the original (out of roughly 12), 8 of those having been laid off and 2 having moved to other projects.  We'll have management on our side this time around to practice sound engineering too.  All that being true gives a new project roughly even money of not being a WTF, but it's enough to stick around and try it. 



  • @Stupidumb said:

    I only program in whacky scenarios.

    balancing elephants on your head while dodging thrown poo from monkeys? 



  • @belgariontheking said:

    balancing elephants on your head while dodging thrown poo from monkeys? 

     

    Sounds a bit like my old job, if you substitute 'clients' for 'elephants' and 'project managers' for 'monkeys'



  • My guess is that the programmer moved from VB6 to C#.

    I am going through exactly the same thing, except with VB.NET. Poor guy has absolutely no concept off OOP, and me trying to explain it to him seems to have confused him even more. I've suggested that he get some basic OO training.


Log in to reply