• map (unregistered)

    "Objective-C. That’s not the WTF."

    It might not be THE WTF, but it is A WTF.

    frist

  • Derp (unregistered)

    Given the off by one bug, I am actually frist.

  • Greg (unregistered)

    Who knows, maybe it used to update some progress or status info in the past...

  • Quite (unregistered)

    I can see why he may have thought it was a good idea -- because then it's easy to make the number of seconds variable when calling it. The two most difficult things in programming, of course, are cache management, naming things, and off-by-one errors.

  • Mason Wheeler (unregistered)

    Dan has inherited a pile of Objective-C. That’s not the WTF.

    Yes it is...

  • Anonymous (unregistered)

    Best part is he shouldn't have typed the code in the first place. You can just specify the splashscreen storyboard in the project settings and the os would have done the heavy lifting.

  • Paul Neumann (unregistered)

    He forgot to call Application.DoEvents!

  • maurizio (unregistered)

    I always though somebody should define a non deterministic programming language that allows to write algorithms that tolerate by one error in both directions :->

    Maurizio

  • Ron Fox (google)

    TRWTF is the constant magic number 3: The time to wait should be loaded from a configuration file (XML of course for better enterpriseness) or perhaps selected from a database that is pointed to by a configuration file.

  • TheDailyWTF - Where every language choice is wrong (unregistered)

    This could have been recast into any given language and the first few comments would still be people saying that the language choice is "the real WTF".

  • Hannes (unregistered) in reply to TheDailyWTF - Where every language choice is wrong

    Not entirely true. There's actually a list of "WTF"-languages here. Every programming language not on the list is NOT a WTF.

    The REAL WTF is that I needed FOUR tries to prove that I am not a robot. :(

  • Jajcus (unregistered) in reply to Hannes

    The REAL WTF is that I needed FOUR tries to prove that I am not a robot. :(

    It was supposed to be three times, but the counter was increased late.

  • IP-guru (unregistered)
    Not entirely true. There's actually a list of "WTF"-languages here. Every programming language not on the list is NOT a WTF.

    so bassed on that list Malbolge would not be considerd a WTF

  • Hannes (unregistered) in reply to IP-guru

    How could a language be considered a WTF if this beauty prints out "Hello World"?

    (=<`:9876Z4321UT.-Q+)M'&%$H"!~}|Bzy?=|{z]KwZY44Eq0/{mlk* hKs_dG5[m_BA{?-Y;;Vb'rR5431M}/.zHGwEDCBA@98\6543W10/.R,+O<

  • Hannes (unregistered) in reply to IP-guru

    I wanted to add it to the list, but found this: <!-- Malbolge belongs on the esoteric page --> So, I guess that means it has to be considered WTF as well.

  • PedantsRUs (unregistered) in reply to maurizio

    That might have been done already -- google "failure oblivious computing"

  • Shufflepants (unregistered) in reply to Hannes

    So, by your statement, https://esolangs.org/wiki/Unary is not a WTF?

  • isthisunique (unregistered)

    Instead if you want to achieve anything with that or like that you would store the start time, making sure the timer didn't return early and catching up with a new timer if it did.

    What this code does instead is if you have some mega lag is to make your splash take a ridiculous amount of time. Lets say it's taking 10 seconds because of something bagging CPU somewhere for each timer to finish for example.

    You can catch up from premature, not catch down from delayed. What this does is catches up on a delay. It's bad joo joo.

  • isthisunique (unregistered)

    I also forgot, when you do it the right way, in which it only catches up on premature and as for overshoot just immediately goes to the next thing, you're now only one or two steps away from using the [animation frame/paint event/render loop/whatever] properly.

  • isthisunique (unregistered)

    I forgot the other thing, my friend reminded me when pointing out == isn't good practice for safety. With set interval like timers (repeating) if there's a big delay they can all build up on the stack. It's implementation dependent but there's actually a possibility of the callback being called any number of times. In this case it wont be disastrous regarding the internal variable state unless count is used elsewhere but it can stack up count++ or exxentially loads of work for the CPU bagging it even more in a bad case.

  • Kashim (unregistered) in reply to Hannes

    Esoteric languages are not WTFs because no one actually tries to use them for anything useful. As such, one must simply marvel at the beauty of Hello World written in Shakespeare, Malbolge, befunge, grass, or even whitespace or Ook!.

    If someone were to actually try to write real server code or use these languages in a real way in a corporate setting, then yes, it would be a WTF, and it would definitely end up here. But they don't, because it turns out that anyone smart enough to actually write a meaningful program in one of these languages is smart enough to not use them.

    TRWTF is that our desire to make programming more usable for ourselves carries the downside that they are more usable for others, and the threshold for programming falls to people who are not smart enough to know why they shouldn't do certain things. No one has figured out how to make a language with a high intelligence threshold in order to work with it, but also great efficiency and accessibility.

    Coming soon: a git extension that gives the user a computer science test before allowing them to commit.

  • smf (unregistered)

    How do you know they didn't want it to appear for four seconds?

  • Scarlet_Manuka (nodebb) in reply to Quite

    I can see why he may have thought it was a good idea -- because then it's easy to make the number of seconds variable when calling it.

    How is it any easier to update the number of times you ask for a 1-second timer than it is to update the number of seconds you ask for in a single timer?

  • gnasher729 (unregistered)

    @isthisunique: This is a Cocoa timer, that is set to be repeating at one second intervals. The system will schedule the timer to run in one second intervals calculated from the creation of the timer (so it doesn't drift if it is scheduled after 1.01 seconds thousand times). If the system is so busy that the next scheduled point in time is reached before the previous one is executed, a call will be skipped. Exact timing can vary slightly to avoid waking up the CPU needlessly (the system will try to schedule multiple timers in close proximity).

    There is no chance in hell that timer events build up on the stack. And there will be absolutely no callbacks after one callback invalidates the timer.

  • urkerab (nodebb)

    First shalt thou show the splash screen, then shalt thou count to three, no more, no less. Three shall be the number thou shalt count, and the number of the counting shall be three. Four shalt thou not count, neither count thou two, excepting that thou then proceed to three. Five is right out. Once the number three, being the third number, be reached, then lobbest thou thy Holy Hand Grenade of Antioch towards thy splash screen, who being naughty in My sight, shall snuff it."

  • Olive (unregistered)

    I think you're confusing the inception of a new idea with the work involved in creating something. For instance, Michelangelo didn't come up with the idea of oil paint -- his work involved planning, sketching, and painting, which are not easy tasks, but which don't require insight or serious problem-solving. The process had been well-defined long before he climbed onto that scaffolding -- he just had to argue it out with the pope and the various cardinals.

    As a writer who wrote research paper for sale on the same I'd say better examples would be Watson and Crick, or Edison, or Curie, or Prokudin-Gorskii, or Gates, or Frank Lloyd Wright. They came up with something new.

Leave a comment on “Countup Timer”

Log In or post as a guest

Replying to comment #:

« Return to Article