This needs to be different



  • From my last couple of posts, you may have inferred that I'm presently working on our JUnit tests.

    Last night, I encountered a POJO with 113 private fields (with the usual misspellings), matching getters and setters with subtly different misspellings, and a few comments with the usual assorted onshored offshore misspellings.

    Then I discovered 48 more IDENTICAL classes, with the sole difference being the name of the class. They were all named ProductDataXXX, with XXX being the individual products. Then I discover 49 identical sets of JUnit tests (testing getters, setters, and useful business logic that did not belong in these classes), with the exact same typos and mispellings; each 800+ lines long.

    The reason I'm working on this is that there was a change in the underlying db data structure. As such, the class implementation (all 49 of them) needs to change. And the tests too.

    Upon querying the developer as to why he didn't have 49 instances of 1 class instead of 1 instance of each of 49 classes, he said that he needed the "this" pointer to be different.

    We now have one object that is instantiated as appropriate, and one set of JUnit tests for it. I'm waiting for someone to complain that I deleted 48*800+ lines of tests.

     



  • Hulde!


  • BINNED

    @snoofle said:

    Then I discovered 48 more IDENTICAL classes, with the sole difference being the name of the class. They were all named ProductDataXXX, with XXX being the individual products. Then I discover 49 identical sets of JUnit tests (testing getters, setters, and useful business logic that did not belong in these classes), with the exact same typos and mispellings; each 800+ lines long.

    The reason I'm working on this is that there was a change in the underlying db data structure. As such, the class implementation (all 49 of them) needs to change. And the tests too.

    Upon querying the developer as to why he didn't have 49 instances of 1 class instead of 1 instance of each of 49 classes, he said that he needed the "this" pointer to be different.

    This most likely falls in the category of "questions you don't ask because you know in advance you won't like the answer", but why did the developer need the "this" pointer to be different?



  • @PedanticCurmudgeon said:

    why did the developer need the "this" pointer to be different?
     

    The guy got that within an instance of an object, you have "this" to self-reference. He couldn't wrap his tiny little pointed head around the fact that "this" is different per instance, and not static. Thus, each product needed it's own "this" so he needed separate classes.


  • BINNED

    @snoofle said:

    The guy got that within an instance of an object, you have "this" to self-reference. He couldn't wrap his tiny little pointed head around the fact that "this" is different per instance, and not static. Thus, each product needed it's own "this" so he needed separate classes.
    I suspected that would be the answer. So replacing him with someone who actually understands OOP isn't an option?



  • @PedanticCurmudgeon said:

    @snoofle said:
    The guy got that within an instance of an object, you have "this" to self-reference. He couldn't wrap his tiny little pointed head around the fact that "this" is different per instance, and not static. Thus, each product needed it's own "this" so he needed separate classes.
    I suspected that would be the answer. So replacing him with a footstool isn't an option?

    FTFY

  • Considered Harmful

    Just when I thought I was too jaded to say "WTF" any more, you make my jaw hit the floor.



  • @snoofle said:

    @PedanticCurmudgeon said:

    why did the developer need the "this" pointer to be different?
     

    The guy got that within an instance of an object, you have "this" to self-reference. He couldn't wrap his tiny little pointed head around the fact that "this" is different per instance, and not static. Thus, each product needed it's own "this" so he needed separate classes.

    I always thought the concept of "this" was pretty self-explanatory? But I guess some people are beyond any help.



  • @The_Assimilator said:

    @snoofle said:

    @PedanticCurmudgeon said:

    why did the developer need the "this" pointer to be different?
     

    The guy got that within an instance of an object, you have "this" to self-reference. He couldn't wrap his tiny little pointed head around the fact that "this" is different per instance, and not static. Thus, each product needed it's own "this" so he needed separate classes.

    I always thought the concept of "this" was pretty self-explanatory? But I guess some people are beyond any help.

    Actually, this guy sounds like a few old VB developers I once knew. The only thing a book about OOP could be used for in the scenario is beating them with one to the point where they can no longer use a keyboard.


  • BINNED

    The footstool would most likely be an upgrade, judging by what we've been told so far.



  • @PedanticCurmudgeon said:

    The footstool would most likely be an upgrade, judging by what we've been told so far.
    Twas my point.  :)

    Everybody at one point or another has worked with a person whose work would actually improve if you replaced them with a stack of printer paper.



  • @The_Assimilator said:

    @snoofle said:

    @PedanticCurmudgeon said:

    why did the developer need the "this" pointer to be different?
     

    The guy got that within an instance of an object, you have "this" to self-reference. He couldn't wrap his tiny little pointed head around the fact that "this" is different per instance, and not static. Thus, each product needed it's own "this" so he needed separate classes.

    I always thought the concept of "this" was pretty self-explanatory? But I guess some people are beyond any help.

     

    A lot of people who've never seen OOP before have a lot of trouble with the idea of instances of a class. They tend to see classes as just a way of organizing functions. A sure sign of this is the question "How do I call a function in class X from main()?"



  • @snoofle said:

    Upon querying the developer as to why he didn't have 49 instances of 1 class instead of 1 instance of each of 49 classes, he said that he needed the "this" pointer to be different.

     

    The problem here is that the guy still works with you.  Does he get paid by the line or is he just the boss's nephew?

     

     



  • @lizardfoot said:

    @snoofle said:

    Upon querying the developer as to why he didn't have 49 instances of 1 class instead of 1 instance of each of 49 classes, he said that he needed the "this" pointer to be different.

     

    The problem here is that the guy still works with you lives.

     

    FTFY



  • @PedanticCurmudgeon said:

    @snoofle said:
    The guy got that within an instance of an object, you have "this" to self-reference. He couldn't wrap his tiny little pointed head around the fact that "this" is different per instance, and not static. Thus, each product needed it's own "this" so he needed separate classes.
    I suspected that would be the answer. So replacing him with someone who actually understands OOP isn't an option?
     

    Apparently you've never worked for a company with an HR department?  I have these people all around me, but they won't get rid of them because it's easier to hire someone else than to dump someone who's already been hired.


  • Discourse touched me in a no-no place

    @ShatteredArm said:

    Apparently you've never worked for a company with an HR department?  I
    have these people all around me, but they won't get rid of them because it's
    easier to hire someone else than to dump someone who's already been hired.

    I think labour laws have a place in whether that situation is pervasive or not. I get the impression that certain EU countries (France esp.) make disposing of unproductive staff a hassle, but other countries (US?) don't. I've seen one particularly unproductive employee (eventually) removed - took a few months (UK) but I think that was more 'give them a chance to see if they'll improve' rather than 'we can't get rid of them because of <statute>'



  • @PJH said:

    I get the impression that certain EU countries (France esp.) make disposing of unproductive staff a hassle, but other countries (US?) don't.
     

    In the US it can also depend on the state you are in, but generally keeping people like this around is more likely due to things like hiring freezes (company won't let you replace someone fired, but if they leave on their own you can beg for a replacement).



  • @PJH said:

    @ShatteredArm said:

    Apparently you've never worked for a company with an HR department?  I
    have these people all around me, but they won't get rid of them because it's
    easier to hire someone else than to dump someone who's already been hired.

    I think labour laws have a place in whether that situation is pervasive or not. I get the impression that certain EU countries (France esp.) make disposing of unproductive staff a hassle, but other countries (US?) don't. I've seen one particularly unproductive employee (eventually) removed - took a few months (UK) but I think that was more 'give them a chance to see if they'll improve' rather than 'we can't get rid of them because of <statute>'

    Where I work (UK) people are fired at the drop of a hat. The usual reason for being fired is incompetence.



  • @C-Octothorpe said:

    @PedanticCurmudgeon said:

    @snoofle said:
    The guy got that within an instance of an object, you have "this" to self-reference. He couldn't wrap his tiny little pointed head around the fact that "this" is different per instance, and not static. Thus, each product needed it's own "this" so he needed separate classes.
    I suspected that would be the answer. So replacing him with a footstool isn't an option?

    FTFY

    Actually it would probably feel more satisfying to replace a footstool with him. Stash him under your desk and use him to wipe your boots on.



  • @Matt Westwood said:

    Where I work (UK) people are fired at the drop of a hat. The usual reason for being fired is incompetence.
     

    That's not a firable offense here.  However, pointing out someone else's incompetence is.



  • @Matt Westwood said:

    Where I work (UK) people are fired at the drop of a hat. The usual reason for being fired is incompetence.

    IIRC the employee's meant to be given a month's notice per year worked (up to 12). However, I think you're allowed to fire them anyway and just send the pay in advance.


  • Discourse touched me in a no-no place

    @ais523 said:

    @Matt Westwood said:

    Where I work (UK) people are fired at the drop of a hat. The usual reason for being fired is incompetence.

    IIRC the employee's meant to be given a month's notice per year worked (up to 12). However, I think you're allowed to fire them anyway and just send the pay in advance.

    You appear to be thinking of redundancy, and it's one week's notice per year up to 12 (with the option to pay in lieu.) No notice is required for incompetency.


Log in to reply