• Quite (unregistered)

    No big deal, it should just throw a NullPointerException and then shut the program down with extreme prejudice, reformatting the C and D drives while it's about it. Where's the problem?

  • (nodebb)

    On its surface, it’s terrible. [...] When we dig deeper, though, it gets worse.

    Sometimes life is like that. On TDWTF, it is frequently like that. And we appreciate it.

    I don't know any APEX, lucky me, but shouldn't CreateDate.GetTime() fail if it's null?

  • arty (unregistered)

    The five-second rule is not a "myth":


  • Ron Fox (google)

    I want to be able to like the frist comment here but :

    Yesterday it worked Today it is not working TDWTF is like that

  • Nicholas "LB" Braden (github)

    Love the ERV on this one, Remy.

  • (nodebb)

    Note the added WTF of seconds becoming milliseconds.

  • Brett (unregistered)

    Or he could have just written update & create triggers on the object and know for sure.

  • Ryan (unregistered)

    The 'f' in Salesforce should not be capitalized. I always have to correct my pointy haired boss on that too. Source: Every spelling of Salesforce on salesforce.com.

  • JW (unregistered)

    'The “Five Second Rule” is, of course, a myth.' Actually, it has some basis in fact. A scientific study of dropped food found that, in institutional cafeterias and the like, the floor is cleaned so often, and with such harsh chemicals, that there's simply no detectable bacteria on the floor. Drop it, pick it up, eat it, no worries.

    (There are, of course, obvious caveats, which further comments will no doubt enumerate.)

  • D-Coder (unregistered)

    Amazingly, (part of) your immune system does work like this. New immune cells are born with random "identifiers." If they match anything within the first month or so of their life, they assume it should be there and they die. After that, if they match something, it must be "new" and they tell the rest of the immune system to attack.

    Dogs also work like this: Something new? Bark at it!

  • Pete (unregistered)

    Mythbusters also tested the 5 second rule, and found that it wasn't entirely without merit.

  • Geoff (unregistered) in reply to D-Coder

    Humans also work like this we pay attention to new things. A university near here just made many of the speed limits on the campus '29 MPH' just for that reason. You see something different you react.

  • Wolf (unregistered) in reply to Geoff

    The Fisher Price radar guns only go to 30MPH, so they had to set the signs to 29MPH. ;)

  • (nodebb) in reply to Wolf

    What if they're going 29.1 MPH? Does the display read "Er"?

  • Lar (unregistered)

    TRWTF is that they didn't use Salesforce's built-in "System.Trigger.isInsert", which would have solved the problem all by itself.

    But if every developer could be bothered to read the API, we wouldn't have TDWTF. :)

  • balazs as guest (unregistered)

    5 second rule works only if the dropped food has something that will be left on the floor, e.g. butter. If you pick it up, it will leave a thin layer of butter on the floor that is thick enough that bacteria can't "climb" it in 5 seconds. In any other cases, the dropped food will pick up everything from the floor.

    I can imagine, that the record is inserted by one thread (or the same thread in a separate transaction) then an other one will do some work on it so they really needed a way to determine which case it is, but the solution is terrible (or it couldn't make it up here). They should have added a pink pony to the new record and removed it when all the new-item-processes finished their jobs.

  • Olafgarten (unregistered)

    The easiest solution here is just to check if the creation date is null. There is no need for triggers or anything complicated like that.

  • Guest (unregistered)

    Try writing a FileMonitor to detect New vs Updated files using Microsoft's FileSystemWatcher/Events method. Then Google up how to make it actually work. Countless examples of Timer Event work arounds. This is because the that act of creating a file actually returns one or more "Create" events and several "Change" events with no practical way to tell the difference other than time proximity. Start timer when first "Create" hits (a timer for each and every file of course). When timer expires afte x milliseconds with no activity, the New file is presumably there with all it's attributes and your File Monitor can do what it wanted to do with a new file.

  • Joseph Osako (google)

    This is in SalesForce’s APEX language: ... On its surface, it’s terrible.

    That's redundant. Everything written in Nadir is terrible.

Leave a comment on “The Three Second Rule”

Log In or post as a guest

Replying to comment #:

« Return to Article