• snoofle (unregistered)

    A long time ago, Dorothy also made the mistake of looking behind the curtain.

    My deepest sympathies...

  • DFYX (unregistered)

    Well at least the spelling of "interval(l)" is easy to explain. The article almost does so on its own. The code is originally from a Swiss developer and "Intervall" is the correct German spelling. They probably just confused the two languages for a moment or the code was originally written with German variable names and someone missed it during refactoring.

  • Appalled (unregistered)

    The ; is equivalent to do nothing. it would help had they done some indenting on that one, sloppy

    if (such and such)

    ;
    

    elseif

    etc.    
    
  • Appalled (unregistered)

    Surrounded with code> and /code>

    if (such and such) ; // do nothing else Do the rest
  • Appalled (unregistered)

    Surrounded with Pre's

    if (such and such)
    	;	// do nothing
    else
    	Do the rest
    
  • Hannes (unregistered)
    getMilliSecondsAdMidnight

    I really don't understand this. Is this Ad only displayed at Midnight? Is it for a company called "Milli Seconds"? What do they produce?

  • Zenith (unregistered)

    I'll admit, in languages without a case/switch/select structure, I'll put an error condition (null) in the if to balance against the error in the else (all real conditions being elseifs). This could also be the result of some asinine "standard" where all ifs had to be true and the developer couldn't rearrange some false statement.

  • Bonkey (unregistered)

    Negative wording in Booleans, Uggg, my first complaint. Please don't do this. Nothing worse than logic statements like:

    while (!notNow) { // do this }

  • SignalStealer (unregistered) in reply to Appalled

    Even better, do not write a condition which does nothing at all, but instead write its negation if "else" is all you need:

    if (!(such and such)) { //do SOMETHING }

    Or, depending on the situation:

    if (!such or !such) { //do SOMEtHING }

  • masonwheeler (github)

    Why an if statement that does nothing, terminating in an easily-overlooked semicolon?

    Because it doesn't "do nothing and terminate" there; it proceeds to an else if and then a catchall else.

    It might have been cleaner to have the if block use a { }, but this one isn't that big of a WTF really.

  • Somebody Somewhere (unregistered)

    On the bright side, I feel a lot better now about how FreeRTOS implements task scheduling. I'll take arcane assembly over obtuse Java any day of the week.

  • Another Anon (unregistered)

    The old "You think you can do better, why don't you do it!" routine.

    Please look at the title bar of your web browser. Notice the site name, TheDailyWTF. The site that brings you things that are worse than just failures. It exists to highlight things like these (with the rare happy ending of it actually getting fixed), mostly as an example for others and for a form of catharsis.

    I went ahead for the hell of it and tried javadoc.lucee.org. There were no entries for "calculateNextExecution" nor "Calendar" under the "C" Index. Maybe they're in another package referenced by, but external to, Lucee. Maybe they're just not documented. What apparently isn't in dispute is that the cognitive load on the author in trying to figure out WTF was going on pegged her mental processor. Things like the IF(A); ELSE (Do Something).

    Meanwhile, have you gone, looked at that bit of code, and submitted your own patch to the project maintainers to make this code clearer to others?

    Yes, it would be nice if the author could A) Understand what is actually going on here, B) Understand what needed to change, C) Understand what side effects such a change would cause anywhere and everywhere else in the code, D) Make the changes to the code, E) Submit the changes, F) Get the changes accepted. That's supposing that she could do A-D, while already busy trying to manage things in her day job. The very first paragraph explained why A was a non-starter at this moment. She was trying to resolve that. Unfortunately, the code and documentation was aggressively thwarting her.

  • Another Anon (unregistered) in reply to Somebody Somewhere

    Regarding Arcane Assembly, I'm reminded of the (C-language) Duff's Device for doing loop unrolling similar to assembler, but within C. Amusingly was his quote that, "This code forms some sort of argument in that debate, but I'm not sure whether it's for or against."

  • Herby (unregistered)

    From what I see, the author(s) of the code probably couldn't explain the code either.

    I have a philosophy when it comes to comments and clarity of code: Write and comment the code for yourself. In six months time you will have forgotten most of the underlying assumptions, tricks, etc. that you used to make the code then. It will be the clarity of the code/comments that will carry you through.

    Oh, and others will thank you was well.

  • Brad Wood (unregistered)

    Paul, there is actually a very good reason for disabling tests. The Lucee project (disclosure, I'm a member) has one of our developer resources writing failing unit tests for every single untriaged bug and enhancement in our ticket tracker (JIRA). Once the pull for the tests are written, they are merged into the repo and disabled and the ticket is placed in our product backlog. When the core dev team starts on that ticket in a future sprint, the failing test is enabled and then the code is fixed until the tests passes. We don't leave failing tests in for the obvious reason that our builds would never pass and all of our Travis CI automations and deployments are based off a passing test suite.

  • Brad Wood (unregistered) in reply to Herby

    From what I see, the author(s) of the code probably couldn't explain the code either.

    Herby, as someone know knows the primary developer of the Lucee Server personally, I can assure you he can explain any line of code in the entire project. I've worked with him for years and have asked questions about every nook and cranny in the project. Lucee is a JVM language written in Java (duh) which is used by CFML developers (most of which don't know Java) so documenting the code was sadly never a super high priority since we don't get a ton of contributions from the average user. Honestly, the code here isn't that bad IMO. Perhaps some clearer variable names would have helped. The original version of this project (started circa 2002) used to have all comments in Swiss German! Implementing some code standards is on our list of things to improve, but one doesn't do that quickly on a project with this much surface area.

  • Sole Purpose of VIsit (unregistered) in reply to Brad Wood

    And your point would be? This code is crap. Pure and simple.

  • MaxArt (unregistered)

    Well, as you said it's open source, it's on GitHub, you just have to open an issue an wait for someone to take ca... Welp, nevermind, it seems they don't allow issues there, only on Jira. Integration yay. Put it on Bitbucket then!

  • (nodebb)

    I see Coldfusion and Lucee mentioned in the article.

    So, why is the code example written in Java?

    Addendum 2017-05-24 18:10: Oh, apparently Lucee is written in Java despite being a reimplementation of ColdFusion.

  • Paul Neumann (unregistered) in reply to Brad Wood

    good reason for disabling tests. ... writing failing unit tests for every single untriaged bug and enhancement

    Point 1) Sounds like it's been triaged. Point 2) Perfect opportunity to create a bug/enhancement branch. Once the bug/enhancement is pulled into active development, re-basing to the parent and re-running the tests will give an indication if the bug has already been fixed incidentally. Once the test is passing it can be merged back into the parent. Seems like a cleaner workflow to me anyway.

  • Simon (unregistered)

    Eh, looks like pretty standard use of the old Java date APIs. Thankfully they finally obsoleted that pile of crap in Java 8...

  • Quite (unregistered)

    Am I the only one thinking of the Long Now Foundation?

  • (nodebb)

    I commented on this because when cames back sometme to early, they back it real good before they early.

  • (nodebb)

    I also like the faux-Hungarian notation. There is no distinction between member and local variables, but then there is the ‘cIntervall’, which looks like it should mean “constant”, but actually isn't constant.

  • meeeee (unregistered) in reply to Appalled

    if (not (such and such)) Do the rest

  • Scott Christian Simmons (google) in reply to powerlord

    Um, ColdFusion is written in Java too. Out of curiosity, what did you think it was written in?

  • Michael Offner (unregistered)

    I'm the author of this code...

    Interval(l) A mention by Brad, english is my 4th language, so sometimes you confuse one language with an other. Why not simply fix this? We did fix it everywhere it was exposed to the user (web admin,udf,...), we have other examples of misspelling in the code we are aware of. Fixing this, simply had not a high priority for us so far, because it does not affect a lot of people. Sadly our time is limited.

    "Empty" if statement With bugfixing we try to be as non-intrusive as possible, especially for code that has no test cases like the ST code. So instead of rewrite the complete logic of an if condition we keep it as it is, as we did in that case. Sure that is not a general rule and rarely done. when you search for empty if conditions you will only find a couple.

    Javadoc we try to make javadoc for all public methods, with private methods we try to make them as self-explaining as possible. Code that needs comments to understand sucks. But sure you always can do better!

    NotNow yeah that sucks!

    getMilliSecondsAdMidnight gives the milliseconds passed since 1/1/1970 00:00:00 UTC today ad midnight.

    Disable testcases As Brad already explained, testcases are build for any new bug reported and disabled (by adding a "_" to the name) as long the bug is not fixed. Otherwise, travis would never pass and never make snapshots/releases. We can influence if the "disabled" testcases are executed or not very easy as part of the build process. We plan in the future also to executed "disabled" testcases but in that case only report if the testcase did pass or not. so we will recognize if a test not expected to pass will pass.

    ST is very old code and we already have a complete new ST implementation in testing that will hopefully very soon available to everybody. The new version is completely CFML based. Why is that version not already out there? This version is sponsored by a company and it is up to that company when it gets released to the public.

  • just fyi (unregistered) in reply to Michael Offner

    getMilliSecondsAdMidnight has two English errors you seem unaware of – "Milliseconds" is one word, and "At" is an existing preposition while "Ad" is not.

Leave a comment on “Lucee Execution”

Log In or post as a guest

Replying to comment #:

« Return to Article