Get it from the db



  • From the same genius who wrote the Junit Test, I give you the following...

    We have a rules engine. Hundreds of the rules call a particular function to do something for a particular client. This function checks to see if the client purchased a particular product. If so, then go to the DB and get some status data. The code looks like this:

    public boolean someRule(...) {
    Client c = ...
    return c.getStatus();
    }

    public class Client {
    private Status status;
    public Status getStatus() {
    if (status == null && <client purchased the product>) {
    status = db.lookUpStatus();
    }
    return status;
    }
    }

    The problem is that these hundreds of rules are executed for every account and sub account of this client (thousands). If the status in the db happens to be null, it makes the db call each and every time.

    Of course I added a statusWasRetrieved flag and checked it before making the call again, but you'd think someone who claims 20 years of experience would know better than to do something like that.



  •  You are assuming that the guy knew that NULL was an acceptable value in the database. He probably thought that the corresponding column is defined as NOT NULL, in which case his code is perfectly valid for caching that data.

    Otherwise, yeah, statusWasRetrieved is definitely helpful.



  • Is that 20 years of experiance or one year of experiance 20 times.

    If you aren't still learning, it's not real experiance, just practice.



  • @KattMan said:

    experiance
     

    I think it may be 20 years of experiance, instead of 20 years experience.



  • 20 years of experiance is definitely not worth 20 years of experience. I'm not sure what the conversion ratio is though.



  • @TheRider said:

    You are assuming that the guy knew that NULL was an acceptable value in the database
    No, I know with certainty that he knew it.


  • ♿ (Parody)

    Another example of not thinking about how things scale. I get this all the time at work (though often, it's not even doing whatever it's supposed to do correctly, so maybe snoofle should count himself lucky). I'm sure some of us have been guilty of this from time to time.

    Sometimes it's a fine line between premature optimization and planning for scaling. But since you already have obvious use cases that make this stupid...his only defense could possibly be that he didn't realize that some rules would call this hundreds of times, but I suspect that's not the case, either.


  • Discourse touched me in a no-no place

    @snoofle said:

    The problem is that these hundreds of rules are executed for every account and sub account of this client (thousands). If the status in the db happens to be null, it makes the db call each and every time.

    Of course I added a statusWasRetrieved flag and checked it before making the call again, but you'd think someone who claims 20 years of experience would know better than to do something like that.

    Without doubting the WTF, I would hope your database of choice has a large enough cache that an actual physical read only happens every once in a while.



  • @FrostCat said:

    @snoofle said:

    The problem is that these hundreds of rules are executed for every account and sub account of this client (thousands). If the status in the db happens to be null, it makes the db call each and every time.

    Of course I added a statusWasRetrieved flag and checked it before making the call again, but you'd think someone who claims 20 years of experience would know better than to do something like that.

    Without doubting the WTF, I would hope your database of choice has a large enough cache that an actual physical read only happens every once in a while.

    Luckily for him, cache coherency is the only potential issue. He doesn't have to worry about network latency, or spurious queries taking up CPU time on the DB server, or spurious queries taking up CPU time on the app server, or anything of that nature.



  • @dhromed said:

    I think it may be 20 years of experiance

    Brillant!

    On a side note, was discussing with SWMBO last night that the length of experience doesn't necessarily mean expertise (although it's implied). It also implies to me that they're a niche worker, they're narrow-experienced, and they've no promotional aspirations.

     



  • I prefer Equifax.



  • A good question is why a status (which is presumably an enum) should ever be null?



  • @blakeyrat said:

    I prefer Equifax.

    As someone working in a finance company that uses Experian heavily, I give you a +1!!



  • @MeesterTurner said:

    @blakeyrat said:
    I prefer Equifax.

    As someone working in a finance company that uses Experian heavily, I give you a +1!!

    It seems most of the companies that do credit checks on me use Equifax, although a few use TransUnion. Nobody seems to use Experian.



  • @morbiuswilters said:

    A good question is why a status (which is presumably an enum) should ever be null?
    For the same reason that we allow pretty much every field except the pk id to be null- the folks who designed this db are idiots, and our team is powerless to make anything other than niche changes.



  • Maybe a rule that every 5 years the value of the experiance drops in half?

    So if the last 20 year was in tech: experiance = 5 + 2.5 + 1.25 +  0.625 or 9.375 years of current experiance.

    If you spent 10 years working, then 5 years on Disabilty/in Prison/in the Marketing epartment you would have 2.5+1.25 or 3.75 years of 'current' experiance.



  • @bgodot said:

    Maybe a rule that every 5 years the value of the experiance drops in half?

    So if the last 20 year was in tech: experiance = 5 + 2.5 + 1.25 +  0.625 or 9.375 years of current experiance.

    If you spent 10 years working, then 5 years on Disabilty/in Prison/in the Marketing epartment you would have 2.5+1.25 or 3.75 years of 'current' experiance.

    Here's my theory, expressed in code:

    if (yearsExperience <= 5) {
      println('shut the fuck up about node.js and NoSQL, you talentless hack');
    } else if (yearsExperience >= 15) {
      println('nobody gives a shit about the COBOL system you wrote that fit into 4kb of "core"');
    } else {
      println('you only get 1 decade of usefulness, so I hope you\'re not wasting it');
    }


  • @bgodot said:

    Maybe a rule that every 5 years the value of the experiance drops in half?

    So if the last 20 year was in tech: experiance = 5 + 2.5 + 1.25 +  0.625 or 9.375 years of current experiance.

    If you spent 10 years working, then 5 years on Disabilty/in Prison/in the Marketing epartment you would have 2.5+1.25 or 3.75 years of 'current' experiance.

     There is definately a valid aspect to that. Many things valued in the past do not have applicability today. On the other hand, some of the things I learned 1972-1980, are just as valuable today. There are even a few which on the rare occasions where necessary have become so rare they are worth a tremendous amount.



  • 7*log(years)?

     

     



  • @morbiuswilters said:

    @MeesterTurner said:
    @blakeyrat said:
    I prefer Equifax.

    As someone working in a finance company that uses Experian heavily, I give you a +1!!

    It seems most of the companies that do credit checks on me use Equifax, although a few use TransUnion. Nobody seems to use Experian.

    It's a bit different in here in good old Brittania. Experian is the UK's market leader, Equifax second and Callcredit -a relative newcomer- last. I also know that if I worked for Experian rather than simply being a user of their APIs, I'd be posting more WTFs than Snoofle...



  • I WAS JOKING what the fuck is wrong with you people.



  • It must be the brainworms!


  • @Daniel Beardsmore said:

    It must be the brainworms!
     

    That font is not very nice.



  • It's Impact. It's obviously not the correct font, but for the 1E−32 of a laugh it may or may not raise, it was not worth the effort of trying to determine the correct font.


  • Trolleybus Mechanic

    @Daniel Beardsmore said:

    It's Impact. It's obviously not the correct font, but for the 1E−32 of a laugh it may or may not raise, it was not worth the effort of trying to determine the correct font.
     

    Wait-- memepics have a specific font?

    Man, those guys are serious about these things. :|



  • @Lorne Kates said:

    @Daniel Beardsmore said:
    It's Impact. It's obviously not the correct font, but for the 1E−32 of a laugh it may or may not raise, it was not worth the effort of trying to determine the correct font.
     

    Wait-- memepics have a specific font?

    Man, those guys are serious about these things. :|

    Believe It!



  • @dhromed said:

    That font is not very nice.

    It looks like Impact is the correct typeface, which makes sense as PCs don't come with that many typefaces and it's one most people will have to hand.

    Apparently I forgot the black outline around the letters. I am not sure whether I should be relieved or ashamed that I'm not an expert on image macros …

    I shall fix it later.



  • @Daniel Beardsmore said:

    It looks like Impact is the correct typeface, which makes sense as PCs don't come with that many typefaces and it's one most people will have to hand.

    The weird thing is that I have Haettenschweiler, which as far as letterforms is concerned, is to Impact just as Helvetica is to Arial.



  • @dhromed said:

    The weird thing is that I have Haettenschweiler, which as far as letterforms is concerned, is to Impact just as Helvetica is to Arial.
    IIRC, both Impact and Haettenschweiler come as standard with either Windows or Office. Haettenschweiler is slightly thinner (and also slightly smaller than Impact).



  • @ender said:

    @dhromed said:
    The weird thing is that I have Haettenschweiler, which as far as letterforms is concerned, is to Impact just as Helvetica is to Arial.
    IIRC, both Impact and Haettenschweiler come as standard with either Windows or Office. Haettenschweiler is slightly thinner (and also slightly smaller than Impact).

    I have both on this PC. I would describe “slightly” as something of an understatement, in the delightful world of typeface incompatibility:

    Impact is 31% wider than Haettenschweiler

    It's not clear from that picture, but the cap heights heights differ also, and consequently the default line spacing: Impact is just overall larger. That Haettenschweiler en dash is iffy, too.

    Note that even Arial and Arial Unicode MS do not have compatible metrics, let alone common serif vs sans-serif x-heights …


  • Garbage Person

    @Daniel Beardsmore said:

    @ender said:
    @dhromed said:
    The weird thing is that I have Haettenschweiler, which as far as letterforms is concerned, is to Impact just as Helvetica is to Arial.
    IIRC, both Impact and Haettenschweiler come as standard with either Windows or Office. Haettenschweiler is slightly thinner (and also slightly smaller than Impact).

    I have both on this PC. I would describe “slightly” as something of an understatement, in the delightful world of typeface incompatibility:


    It's not clear from that picture, but the cap heights heights differ also, and consequently the default line spacing: Impact is just overall larger. That Haettenschweiler en dash is iffy, too.

    Note that even Arial and Arial Unicode MS do not have compatible metrics, let alone common serif vs sans-serif x-heights …

    Dude. My job responsibilities include being a glorified typesetter and that was too much information. Of course, my typesetting environment handily accounts for metrics and when I say "60pt" it goes ahead and ignores what the idiotic "artiste" did and gets me the typeface in a size such that the distance from baseline to cap height is 60pts. Period. And it throws away default line spacings altogether, because what is an artist doing telling me how to lay out documents?

    It actually annoys me that this isn't normal behavior.

     

    (By the way, if I have to lay out another letter to investors with million dollar balances in fucking Papyrus, I'm going to have to kill some bankers. Whatever fuckstain loaded Papyrus into our systems needs some beatin'.)



  • @Weng said:

    Dude. My job responsibilities include being a glorified typesetter and that was too much information.

    If I diagrammed out typesetting terms too here, I would get lynched! ;-)



  • @Weng said:

    ...

    (By the way, if I have to lay out another letter to investors with million dollar balances in fucking Papyrus, I'm going to have to kill some bankers. Whatever fuckstain loaded Papyrus into our systems needs some beatin'.)

    <FONT size=3>Don’t be a papyrus hater.  It serves a purpose, it is not papyrus’ fault that there are idiots out there that don’t use it for its intended purpose.<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" /><o:p></o:p></FONT>


  • You call that papyrus? This is papyrus



  • @Daniel Beardsmore said:

    You call that papyrus? This is papyrus

     

    hot.



  • @Anketam said:

    @Weng said:

    ...

    (By the way, if I have to lay out another letter to investors with million dollar balances in fucking Papyrus, I'm going to have to kill some bankers. Whatever fuckstain loaded Papyrus into our systems needs some beatin'.)

    <font size="3">Don’t be a papyrus hater.  It serves a purpose, it is not papyrus’ fault that there are idiots out there that don’t use it for its intended purpose.</font>

    You speak Na'vi?



  • @Anketam said:

    <font size="3">Don’t be a papyrus hater.  It serves a purpose, it is not papyrus’ fault that there are idiots out there that don’t use it for its intended purpose.</font>
    Yeah, just like Comic Sans!



  • <font face="impact,chicago" size="6"> I like Impact.  I find it works well for ransom notes.</font>



  • @blakeyrat said:

    @Anketam said:
    @Weng said:
    ... (By the way, if I have to lay out another letter to investors with million dollar balances in fucking Papyrus, I'm going to have to kill some bankers. Whatever fuckstain loaded Papyrus into our systems needs some beatin'.)
    <FONT size=3>Don’t be a papyrus hater.  It serves a purpose, it is not papyrus’ fault that there are idiots out there that don’t use it for its intended purpose.</FONT>
    You speak Na'vi?
    Sorry blakeyrat but you left yourself wide open for a pendatic dickweed moment...

    You realize that it was the English that was in Papyrus not the Na'vi, so ones ability to speak Na'vi has little to do with abusing Papyrus (unless of course someone here is planning on subbing Na'vi comments)?

    Srane, oe plltxe Na'vi, slä Na'vi ke 'änsyem.



  • Oh boy …



  • @Anketam said:

    @blakeyrat said:

    @Anketam said:
    <font size="3">Don’t be a papyrus hater.  It serves a purpose, it is not papyrus’ fault that there are idiots out there that don’t use it for its intended purpose.</font>
    You speak Na'vi?
    Sorry blakeyrat but you left yourself wide open for a pendatic dickweed moment...

    You realize that it was the English that was in Papyrus not the Na'vi, so ones ability to speak Na'vi has little to do with abusing Papyrus (unless of course someone here is planning on subbing Na'vi comments)?

    Srane, oe plltxe Na'vi, slä Na'vi ke 'änsyem.

    ... wow. How do you even... just... wow...



  • @blakeyrat said:

    @Anketam said:

    @blakeyrat said:

    @Anketam said:
    <font size="3">Don’t be a papyrus hater.  It serves a purpose, it is not papyrus’ fault that there are idiots out there that don’t use it for its intended purpose.</font>
    You speak Na'vi?
    Sorry blakeyrat but you left yourself wide open for a pendatic dickweed moment...

    You realize that it was the English that was in Papyrus not the Na'vi, so ones ability to speak Na'vi has little to do with abusing Papyrus (unless of course someone here is planning on subbing Na'vi comments)?

    Srane, oe plltxe Na'vi, slä Na'vi ke 'änsyem.

    ... wow. How do you even... just... wow...

    (among others)



  • @blakeyrat said:

    @Anketam said:

    @blakeyrat said:

    @Anketam said:
    <font size="3">Don’t be a papyrus hater.  It serves a purpose, it is not papyrus’ fault that there are idiots out there that don’t use it for its intended purpose.</font>
    You speak Na'vi?
    Sorry blakeyrat but you left yourself wide open for a pendatic dickweed moment...

    You realize that it was the English that was in Papyrus not the Na'vi, so ones ability to speak Na'vi has little to do with abusing Papyrus (unless of course someone here is planning on subbing Na'vi comments)?

    Srane, oe plltxe Na'vi, slä Na'vi ke 'änsyem.

    ... wow. How do you even... just... wow...

    To be fair, his home planet was destroyed by space marines and he's having a hard time adjusting to hoo-man life on Earth.



  • @morbiuswilters said:

    To be fair, his home planet was destroyed by space marines and he's having a hard time adjusting to hoo-man life on Earth.
    Yes it was a tragic tale, but don't worry there will be a sequal.



  • @TheCPUWizard said:

    @blakeyrat said:

    ... wow. How do you even... just... wow...

    (among others)

    WHAT. THE. FUCK.

    Is there a "miss the point" competition going on? First Anketam misses the point to an epic, gold medal-worthy degree. Then TheCPUWizard comes in here and decides the point wasn't missed enough and slathers on a heaping load of more point-missing.

    Stop, please. Stop. I want to participate in a forum full of human beings*, not robot automatons who don't understand these strange human concepts like "humor" or "not being a pedantic dickweed".

    *) and if you make a tired joke relating my use of the term "human beings" to the aliens in Avatar, for example saying, "but Anketam isn't a human being he's a na'vi!", I will murder you. I will come to your house while you sleep and murder you.


  • ♿ (Parody)

    @blakeyrat said:

    Is there a "miss the point" competition going on?

    I thought it was a "post without a point" competition. Does that mean I win the "miss the point" competition?



  • @Anketam said:

    You realize that it was the English that was in Papyrus not the Na'vi, so ones ability to speak Na'vi has little to do with abusing Papyrus (unless of course someone here is planning on subbing Na'vi comments)?

    Man, there are clueless people, there are really clueless people, there are fuckers that can take a clue and there is you



  • @blakeyrat said:

    . I want to participate in a forum full of human beings*, not robot automatons who don't understand these strange human concepts like "humor" or "not being a pedantic dickweed".

    Just curious how you would participate in a forum where you own desires have appeared to elimante your membership????



  • @TheCPUWizard said:

    Just curious how you would participate in a forum where you own desires have appeared to elimante your membership????

    I do hope that someone is there with a camcorder when his cranial blood pressure finally rises to catastrophic level. Probably too gruesome for claiming our £250 for a You've Been Framed showing, though.


  • BINNED

    @blakeyrat said:

    I want to participate in a forum full of human beings*, not robot automatons who don't understand these strange human concepts like "humor" or "not being a pedantic dickweed".
    Wait...are you saying you don't have to be a pedantic dickweed to post here?


Log in to reply