Singleton Shopping Cart



  • A developer parted ways with my company last week. His explanation for the separation was "You obviously need someone with Architecture experience, I'm only a senior developer". I just reviewed his last work and he left a faux-pas that shows what kind of result a "senior developer" produces. He was working on a fairly run-of-the-mill eCommerce application, implementing the shopping cart. He made the ShoppingCart class a singleton!!!! His comment was "I thought about it last night, it's an easy fix, give me a few minutes". What kind of brain damage do you have to have to even consider making a shopping cart a singleton?



  • Your customers have to learn to get in line and wait for their turn like everyone else.



  •  "Okay, guys, time to divvy up the check. Who had the booster box of Magic with a side of a laptop battery? Ok, you owe me $156.77, here's my paypal. And yes, we're tipping, cheapshitter."



  • On a web server doesn't that mean a singleton per client? Or am I missing something here?

    The only wtf I see is this separation of "senior developer" and "architect". Surely as a senior dev you at least have a clue on how to design a system? Or does "senior developer" mean "I've just been doing the same 5 things over and over again for the last 10 years"?



  • @DOA said:

    On a web server doesn't that mean a singleton per client? Or am I missing something here?

    Not necessarily. Depending on the exact technologies used, it might be:

    • Per request
    • Per session
    • Per server thread
    • Per server process

    In the last two cases the singleton will be the same for many different requests which may or may not be related; conversely related requests may get a different singleton if they get routed to different workers.



  • @DOA said:

    The only wtf I see is this separation of "senior developer" and "architect". Surely as a senior dev you at least have a clue on how to design a system? Or does "senior developer" mean "I've just been doing the same 5 things over and over again for the last 10 years"?

    Apparently, it does to him.  An ongoing thread in our relationship was that every time he did something like the singleton shopping cart, I would ask him what thought process led him to do it this way and what alternatives he considered.  Every single time, the answer was "I don't have a reason, I just did it that way".  Eventually, I told him "Next time you check something it, we're going to hav a chat about why you did what you did, so be prepared with answers".  He then checked something in and didn't have any answers.  He took that as a sign that I wanted a designer instead of a programmer because, in his mind, programmers don't think, they just take the shortest path to the finish line.



  • @Jaime said:

    Singleton Shopping Cart

    But a collaborative shopping cart is the ultimate Web 2.0 experience, isn't it?



  • @Jaime said:

    He took that as a sign that I wanted a designer instead of a programmer because, in his mind, programmers don't think, they just take the shortest path to the finish line.
     

    So, was he Jake or Elwood?




  • @Jaime said:

    A developer parted ways with my company last week. His explanation for the separation was "You obviously need someone with Architecture experience, I'm only a senior developer".

    To his credit, he quitted himself before you needed to fire them.



  • @PSWorx said:

    @Jaime said:
    A developer parted ways with my company last week. His explanation for the separation was "You obviously need someone with Architecture experience, I'm only a senior developer".
    To his credit, he quitted himself before you needed to fire them.
    Which is good, because in order to get fired around here, you need a couple of bad yearly performance appraisals.


Log in to reply
 

Looks like your connection to What the Daily WTF? was lost, please wait while we try to reconnect.