• hello (unregistered)

    first

  • Jonathan (unregistered)

    We have a joke on out team, whoever uses the blame tool only ever finds out that they were the one who committed the bad code.

  • TheCPUWizard (unregistered)

    Technically the last one is not a "Fail".... The resultant value will be globally unique and can be used as an identifier, even though it does not conform to the 128 bit number format...

  • Bert (unregistered)

    The first one looks more like a bit of a brain fart. Perhaps the block previously had other bits in too, which were later deleted and only the assert remained.

    I've also done/seen Assert.True(false) in the absence of Assert.Fail() or in an "impossible" arm of a large match block.

  • Bert (unregistered) in reply to Bert

    And then here's me not reading the title or even the first paragraph.

  • Todd (unregistered)

    TRWTF is that they mention the function generateUUID(), but then post the function generateGUID().

  • posedge clock (unregistered) in reply to Bert

    I've written code like the first one only last week! Mine was of the form:

    if (!foo()) {
        assert(foo);
    }
    

    The idea here is to put a breakpoint on the assert, which allows you to step into foo() only if it is known to fail.

  • European swallow (unregistered) in reply to posedge clock

    If only modern IDEs allowed you to set conditional breakpoints...

  • Carl Witthoft (google)

    So, what's the opposite of 'cerebral flatulence'? 'sigmoid colonic cogitation'?

  • Karl Bielefeldt (github) in reply to European swallow

    Conditional breakpoints are orders of magnitude slower than an if statement. If you're going to hit it a lot, sometimes you have no choice but to alter the code, or your timing gets corrupted to the point of being unusable, especially on embedded systems.

  • Lazerbaems (unregistered)

    My first thought on the last one is that the developer responsible didn't trust that UUIDs are actually UUIDs and so they added this clever "guarantee" part at the end of it.

  • Fnord (unregistered) in reply to Carl Witthoft

    Sigmoid Colonic Cogitation = management

  • Verisimilidude (unregistered)

    Remy, where are the unicorns today?

  • Chris (unregistered) in reply to Jonathan

    So "he who smelt it, dealt it" applies to brain farts too?

  • Bert (unregistered) in reply to European swallow

    So you're using one of the half-dozen languages that has a full-featured bells-and-whistles IDE built specifically for it? Congratulations.

  • Geg (unregistered) in reply to posedge clock

    I don't know on what platform you're working, so this may not be available, but on macOS and windows there are calls to break into the debugger.

  • derp (unregistered)

    The last one isn't generating UUIDs, its generating GUIDs... And they seem to contain meatsack readable information, so I'd wager a guess that it's for ease of tracking down problems from log entries. And they are also still perfectly unique, but with added information. They also don't need to follow a UUID format, since it's not a UUID.

    I wouldn't quite count that as a brain fart on the side of the code author, but rather on the side of the code reader and blog post author.

  • wdad (unregistered)

    click nice

  • Ethenrosethomaz (unregistered)

    one of the best download bigo live online chatting application

  • maodzedun (unregistered)

    Very interesting page, on the one hand, nothing special, but on the other it attracts attention little caesars near me

  • kangbin (unregistered)

    I loved it. I want to express my admiration of your writing skill and ability to make readers read from the beginning to the end. I would like to read newer posts and to share my thoughts with you. Thanks for posting it, again! happy wheels

  • jun (unregistered)

    It’s actually a nice and helpful piece of info. I’m satisfied that you simply shared this helpful info with us. Please keep us up to date like this. Thanks for sharing. five nights at freddy's

  • Learn Color 4Kids (unregistered)

    Good post! Thanks for sharing!

  • Dave (unregistered)

    I am the guy that submitted the last one ... the code 'worked' but it was completely useless I just noticed it was showing up as a uuid column of our audit table (tracks event logs). That already has a unique id (primary key of the database) but this developer has this method to generate a uuid .. with this method that for some reason makes it 'more unique' by adding the server name (auditlog.getContext) and time. The Context and request time that is appended to this ... are already part of the auditLog data that gets persisted to the table ... it is just weird and redundant (the author user has many such entries in our code base)

  • Dave (unregistered)

    I am the guy that submitted the last one ... the code 'worked' but it was completely useless I just noticed it was showing up as a uuid column of our audit table (tracks event logs). That already has a unique id (primary key of the database) but this developer has this method to generate a uuid .. with this method that for some reason makes it 'more unique' by adding the server name (auditlog.getContext) and time. The Context and request time that is appended to this ... are already part of the auditLog data that gets persisted to the table ... it is just weird and redundant (the author user has many such entries in our code base)

  • bouncing balls (unregistered)

    Thank you for your sharing. Thanks to this article I can learn more things. Expand your knowledge and abilities. Actually the article is very practical. Thank you!

     <a href="http://stickmanonlinegames.com/stickman-games-online" >stickman games online</a> ,      <a href="http://bouncingballsgame.com/bouncing-balls" >bouncing balls game</a> ,      <a href="http://theimpossible-game.com/impossible-game" >impossible game</a> 
    

Leave a comment on “Cerebral Flatulence”

Log In or post as a guest

Replying to comment #:

« Return to Article