• Bosshog (unregistered)
    Transformer optimusPrime = new Transformer()

    WIN!

  • (cs)

    Whoever wrote that article seems to be the one that's "in a rush", judging by all the copy/paste errors.

    -- Note from Alex: Whoa. I swear, at like 3AM last nite it looked perfect! (Fixed)

  • @Deprecated (unregistered)
    WhiskeyJack:
    Whoever wrote that article seems to be the one that's "in a rush", judging by all the copy/paste errors.

    Hey give Alex a break, he's all wiped after having to implement some impossible features that were sold to a customer.

    As for the: public long getLength() { return 1000000; // no clue }

    I am afraid I have done something similar from time to time, when I am going through some inherited code where the original dev is long gone, and putting in something like // OMGWTF I can't believe this #$$@#

    Why do I put that in there? Venting or something, I guess...

  • SR (unregistered)

    The comments for validation one is something I'd do while still learning to program effectively. Of course I'd go back and replace them with code before putting it into production.

    As for optimusPrime = new Transformer() - that is teh awesome! :oD

  • Richard T. Roll (unregistered)

    All of this is fine on embedded platforms which might not have a file system.

  • AndyC (unregistered)

    It's a bit unfair to just clip bits of code out of context. If you'd left in the public class PieceOfString bit the getLength method makes perfect sense!

  • Another PHP Guy (unregistered)
    function DeUnicode($_input){
      //added to strip out italics tag  from name
      $_input = str_replace('', '', $_input);
      $_input = str_replace('', '', $_input);
      return $_input;
    }

    Sure the PHP guy wasn't in a rush. He had simply could use strip_tags instead of his own function.

    facilisi -- facilis is latin for easy to do

  • me_again (unregistered)

    Transformer optimusPrime = new Transformer();

    is this a wtf because it's cool?

    captcha: vulputate - A vulture that likes tater tots.

  • TheSpiesMustFlow (unregistered) in reply to me_again
    me_again:
    Transformer optimusPrime = new Transformer();

    is this a wtf because it's cool?

    Half because it's cool, half because jokes shouldn't go in production systems I guess.

  • (cs)

    I find all this anti-Italic sentiment disturbing.

  • True that (unregistered) in reply to me_again

    Transformer optimusPrime = new Transformer(); is only cool if you're working in a graphical environment and instantiating models for rendering where you can pass the constructor arguments, like 'TRUCK', or 'ROBOT', or 'GORILLA' (for the optimusPrimal version).

  • (cs) in reply to SR
    SR:
    The comments for validation one is something I'd do while still learning to program effectively. Of course I'd go back and replace them with code before putting it into production.

    In that case, it helps to have something greppable (such as FIXME) in the placeholder comments to make sure it doesn't get forgotten before deploying the code.

  • (cs)

    class Transformer

    class Transformers : Transformer, Collection

    Transformer optimusPrime = new Transformer();

    Transformers autobots = new Transformers();

    optimusPrime->Address(autobots);

    optimusPrime->IssueCommand("Transform!!!!");

    AwesomeSoundEffectsFactory::GetSoundEffect("ch ch ch CH!")->Play();

  • Anonymous (unregistered)

    I'm pretty sure that the first function posted (the more I read into it) is a waste of space.

  • jrk (unregistered)

    I tried to put some italic tags around a bit of text today, but somehow, it doubled my text

    I tried to put some italic tags around a bit of text today, but somehow, it doubled my text

  • (cs)
    //Fixed for naming and precision
    Public Function kgf()
        kgf = 9.80665
    End Function
    
  • (cs)
    public interface Transformer { ... }
    
    public interface Car extends Transformer { ... }
    
    List<Transformer> transformers = new ArrayList<Transformer>();
    transformers.add(new Transformer());
    
    List<Car> robotsInDisguise = (List<Car>) transformers;
    
  • Anon (unregistered) in reply to AndyC
    AndyC:
    It's a bit unfair to just clip bits of code out of context. If you'd left in the public class PieceOfString bit the getLength method makes perfect sense!

    Indeed, and the Optimus Prime bit might have been from code for a Transformers game, in which case it's perfectly cromulent.

  • SR (unregistered) in reply to Erasmus Darwin
    Erasmus Darwin:
    In that case, it helps to have something greppable (such as FIXME) in the placeholder comments to make sure it doesn't get forgotten before deploying the code.

    That's exactly what I did. "FIXME" and "TODO write this code" are good, though I've still a soft spot for "banana"

  • highphilosopher (unregistered)

    Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.

    -- Note from Alex: there were several comments pointing out typos/mistakes, but since the errors were fixed, the comments were no longer relavent; I did keep one, which was at the top and was a good balance of poking fun at me and explaining the original problem. On the same note, comments that respond to this will probably be deleted, too, since it's double-meta (I think?) discussion.

  • Dave (unregistered) in reply to Bosshog
    Bosshog:
    Transformer optimusPrime = new Transformer() WIN!

    Too right. I have been guilty of similar naming conventions, like having a boolean flag to indicate if the current user is local or remote (in circumstances where "local" security has been requested to be lower for convenience on the assumption that other protections will mitigate the extra risk) called b_from_round_these_parts. Then you can check

    if not b_from_round_these_parts
    (needs to be read in either a west country accent or with a hick slur)

  • AndersI (unregistered)
    "A nice example of ahead planning," Robert writes, "just in case the Earth's mass dramatically changes overnight, we are prepared for a fast, system-wide adjustment."
    Public Function Newton()
        Newton = 9.81
    End Function
    

    Actually, this should be a function of latitude - see http://en.wikipedia.org/wiki/Gravitational_acceleration.

    For us here in Sweden, 9.82 is the best approximation.

  • MP (unregistered) in reply to Anon
    Anon:
    AndyC:
    It's a bit unfair to just clip bits of code out of context. If you'd left in the public class PieceOfString bit the getLength method makes perfect sense!

    Indeed, and the Optimus Prime bit might have been from code for a Transformers game, in which case it's perfectly cromulent.

    That would make it even more of a WTF since the article states:

    "I was going through some obscure code from the developers before me, and something caught my eye," Philippe wrote. "It was a class whose task was to transform data, and this is how it was instantiated."

  • (cs) in reply to frits
    'Fixed for naming and precision
    Public Function kgf()
        kgf = 9.80665
    End Function
    
    
    
    'Added to fix the code the jerkoff Senior
    'Software Consultant broke.
    
    Public Function Newton()
        Newton= kgf
    End Function
    
  • (cs) in reply to Richard T. Roll
    Richard T. Roll:
    All of this is fine on embedded platforms which might not have a file system.
    'it's not good
  • (cs) in reply to toshir0
    toshir0:
    Richard T. Roll:
    All of this is fine on embedded platforms which might not have a file system.
    'it's not good
    'it's good
  • Matt Westwood (unregistered) in reply to frits
    frits:
    'Fixed for naming and precision
    Public Function kgf()
        kgf = 9.80665
    End Function
    

    'Added to fix the code the jerkoff Senior 'Software Consultant broke.

    Public Function Newton() Newton= kgf End Function

    Amateur.

    Public Function Newton() Newton= kgf() End Function

  • Adrian (unregistered)
    Public Function Newton()
        Newton = 9.81
    End Function 

    As a mech engineer, I would say it is not too bad, it makes sure you always use the same value and a known accuracy for g trougout the program.

    Some people use 9,81, others just 9,8 and some others round it to 10, and the actual value depends on a lot of things ( where you are on the globe, position of the moon....)

    This allows get some accuracy of the result and eventualy improve it.

  • (cs)

    RE the italics that become bold I would say that using italic tags is the real wtf. Though it feels strange to redefine this in css, html wasn't meant for defining presentation. That's why you have and . It is unfortunate tags like or exist at all.

    Since you can redefine everything in css it is a mistake to think those tags will do what you think.

  • (cs)

    RE the italics that become bold I would say that using italic tags is the real wtf. Though it feels strange to redefine this in css, html wasn't meant for defining presentation. That's why you have and . It is unfortunate tags like or exist at all.

    Since you can redefine everything in css it is a mistake to think those tags will do what you think.

  • Anonymous (unregistered) in reply to frits
    frits:
    'Fixed for naming and precision
    Public Function kgf()
        kgf = 9.80665
    End Function
    

    'Added to fix the code the jerkoff Senior 'Software Consultant broke.

    Public Function Newton() Newton= kgf End Function

    ROFL, senior software consultant! We've been reading your crappy angst-ridden comments long enough to know you're still in high-school, frits! Now get the hell back to class!
  • grizz (unregistered)

    The Newton function probably is to avoid having a magic number in a calculation. Seems to me that's generally considered A Good Thing, not a WTF.

  • (cs) in reply to Matt Westwood
    Matt Westwood:
    frits:
    'Fixed for naming and precision
    Public Function kgf()
        kgf = 9.80665
    End Function
    

    'Added to fix the code the jerkoff Senior 'Software Consultant broke.

    Public Function Newton() Newton= kgf End Function

    Amateur.

    Public Function Newton() Newton= kgf() End Function

    Hey man, this is VB. Parentheses optional.

  • (cs) in reply to Another PHP Guy
    Another PHP Guy:
    function DeUnicode($_input){
      //added to strip out italics tag  from name
      $_input = str_replace('', '', $_input);
      $_input = str_replace('', '', $_input);
      return $_input;
    }

    Sure the PHP guy wasn't in a rush. He had simply could use strip_tags instead of his own function.

    I don't know about you, but <i<i>>I</</i>i> for one can see another problem with it.
  • Leo (unregistered) in reply to grizz
    grizz:
    The Newton function probably is to avoid having a magic number in a calculation. Seems to me that's generally considered A Good Thing, not a WTF.

    You're the one that does

    #define ONE 1 #define TWO 2

    aren't you?

    Sometimes you really don't need it.

  • Matt Westwood (unregistered) in reply to grizz
    grizz:
    The Newton function probably is to avoid having a magic number in a calculation. Seems to me that's generally considered A Good Thing, not a WTF.

    Agreed - the only problem I might possibly have with it is its name - NewtonsPerKg would be better - but as a concept it's fine. No WTF.

  • Zachary (unregistered)
    "I tried to put some italic tags around a bit of text today," writes Derek, "but somehow, it emboldened my text. I did some digging, and I found that our front-end developer has this in our CSS stylesheet."
    i { color: #000; font-weight: bold; font-style: normal; }</div></BLOCKQUOTE>
    

    The real WTF here is that he is using the i tag to begin with. Any real web developer/designer uses pure CSS.

  • (cs) in reply to highphilosopher
    highphilosopher:
    Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.

    -- Note from Alex: there were several comments pointing out typos/mistakes, but since the errors were fixed, the comments were no longer relavent; I did keep one, which was at the top and was a good balance of poking fun at me and explaining the original problem

    relevant

  • Nitpickers R. Lame (unregistered)
    Anonymous:
    I must admit I tend to agree; delete trolls and totally off-topic posts but don't delete relevant stuff. And if the original article is that messed up then it is perfectly relevant to point it out. Most people were being light-hearted about it, why purge perfectly innocent comments? Can the WTF community not enjoy a meta-WTF once in a while?
    highphilosopher:
    Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.
    md5sum:
    It's not the first time I've seen Alex nix a comment that didn't agree with him (including one or two of mine). Lame, but hey, he's the "god" of the wtf, right? Like "WTF did you delete my perfectly valid comment for?". Although, deleting peoples' comments is gonna bite him. Nobody comes here to read the articles, the articles mostly make no sense as a WTF, often containing valid code that the submitter and the writer are unable to comprehend. The COMMENTS though are almost ALWAYS an entertaining read.

    In this case none of yours are. Get over yourselves.

    Now as to whether this comment about useless comments being useless is useful... Well that's a different question entirely....

  • (cs) in reply to Leo
    Leo:
    grizz:
    The Newton function probably is to avoid having a magic number in a calculation. Seems to me that's generally considered A Good Thing, not a WTF.

    You're the one that does

    #define ONE 1 #define TWO 2

    aren't you?

    Sometimes you really don't need it.

    And sometimes you do, because some scientific software has to give actually *correct* results, at any latitude, and even up a mountain, down a mineshaft, or in an orbiting spacecraft. It depends how much precision is required, which is something none of us can infer from a contextless snippet, but if it's even doing physics-based calculations at all, it's certainly possible they might want two or three significant digits of precision, which is the level at which it becomes worth considering variations in g.
  • (cs) in reply to Anonymous
    Anonymous:
    ROFL, senior software consultant! We've been reading your crappy angst-ridden comments long enough to know you're still in high-school, frits! Now get the hell back to class!

    We? Is there a frog in your pocket? For the dense, "senior software consultant" is a callback to the article.

  • SR (unregistered) in reply to TheJasper
    TheJasper:
    RE the italics that become bold I would say that using italic tags is the real wtf. Though it feels strange to redefine this in css, html wasn't meant for defining presentation. That's why you have and . It is unfortunate tags like or exist at all.

    Since you can redefine everything in css it is a mistake to think those tags will do what you think.

    I agree that it's preferable to use EM and STRONG in place of I and B but redefining expected behaviour is definitely a WTF in my book.

  • Simon (unregistered)
    I tried to put some italic tags around a bit of text today," writes Derek, "but somehow, it emboldened my text."

    This was a deliberate feature to tell you to stop using to italicise text. The correct XHTML-compliant tag is .

  • (cs) in reply to jrk
    jrk:
    I tried to put some italic tags around a bit of text today, but somehow, it doubled my text

    I tried to put some italic tags around a bit of text today, but somehow, it doubled my text

    [image] Perhaps you could explain how that works?
  • (cs) in reply to Simon
    Simon:
    I tried to put some italic tags around a bit of text today," writes Derek, "but somehow, it emboldened my text."

    This was a deliberate feature to tell you to stop using to italicise text.

    Don't you mean "... tell you to stop using unicode to italicise text ..."?
  • SR (unregistered) in reply to DaveK
    DaveK:
    jrk:
    I tried to put some italic tags around a bit of text today, but somehow, it doubled my text

    I tried to put some italic tags around a bit of text today, but somehow, it doubled my text

    [image] Perhaps you could explain how that works?

    That was referring to a copy and paste error that Alex has now fixed. Kudos on O'Rly, thuogh. It's ages since I've seen one.

  • (cs) in reply to DaveK
    DaveK:
    highphilosopher:
    Wow, you poke at Alex just a little bit, and your comments get deleted? That's really, well, sad. I do understand that everyone makes mistakes, but on a Blog that's dedicated to pointing out mistakes, that's just kind of well hypocritical. Everyone here has made a WTF including you Alex.

    -- Note from Alex: there were several comments pointing out typos/mistakes, but since the errors were fixed, the comments were no longer relavent; I did keep one, which was at the top and was a good balance of poking fun at me and explaining the original problem

    relevant

    Strangly by discussing about the spelling of relevant you have created a triple-meta comment.

  • ath (unregistered) in reply to grizz
    grizz:
    The Newton function probably is to avoid having a magic number in a calculation. Seems to me that's generally considered A Good Thing, not a WTF.

    Agree. If you hardcode the values you may screw up badly. For example, Alice calculates the force as F = 9.81 * m. Later Bob wants to do the inverse so he calculates m = F / 9.8128. Then the swedish guy comes along and calculates F again as F = 9.82 * m. You'd better wish they're programming a game and not the guidance system for an Ariane V rocket.

    Sure, I'd prefer a constant to a function but it's still better than hardcoded values...

  • Quirkafleeg (unregistered) in reply to Zachary
    Zachary:
    Any real web developer/designer uses pure CSS.
    That's pointless. You need something else to which to apply the CSS.
  • Quirkafleeg (unregistered) in reply to Helix
    Helix:
    Strangly by discussing about the spelling of relevant you have created a triple-meta comment.
    ‘Strangely’. But then you knew that…

Leave a comment on “In A Rush, Properly Handled, and More”

Log In or post as a guest

Replying to comment #301897:

« Return to Article