• (nodebb)

    it's not got noticed because:

    1. having two of something when you should have one is generally not nearly as bad a problem as having none
    2. it requires 2 people to have generated the same report. I don't know how often that happens in the OPs case, but it would affect the rate at which this happened

    Also FRIST

  • COBOL Dilettante (unregistered)

    If it's anything like my work:

    a.) The report was set up 20 years ago "for audit purposes";

    b.) Nobody has read it since then, but the word "audit" makes everyone too scared to get rid of it.

  • Neurotic Network (unregistered)

    I know, I know, hating on JS is overdone ... but how in the name of all that is holy is half the planet running on a language that gets a bool where an int should be and says "Sure, this is fine"? Software isn't eating the world, it's covering it in vomit.

  • Darren (unregistered) in reply to COBOL Dilettante

    So much of this. At my place we have reports that go out by email - sometimes several times a day - that the recipients just move into a folder in their mailbox. They never look at them, they're just keeping them around 'just in case'.

    We even have people receiving these reports even when they've changed jobs and no longer require the reports - they've just become so used to getting the email, marking as read and moving into a folder that they no longer realise what it is they're actually doing, it's entirely autonomic at this point.

  • (nodebb)

    Possibly the report is output to a PDF which gets emailed and no one bothered to notice (or simply ignored) there were more pages after the end of the first report. Or alternatively, they were all good bureaucrats who expect things to be done in duplicate or triplicate because that's how they roll.

  • (nodebb)

    The really organized ones have an email client incoming mail rule to do it for them.

    A fun thing about "duplicate" reports is that depending on the report design and the time interval between repeats, they may not be identical. A week-to-date sales report run twice 3 minutes apart may have different numbers. Such fun when other people or their Excel-based "systems" start using those divergent numbers unaware

  • JW (unregistered)

    Even aside from the transposition, shouldn't that also be a == comparison anyway?

  • (nodebb)

    I got a feeling with the rise of GenAI code generators we will see A LOT more of those in the future. Hope everyone is prepared to become a constant CodeReview slave until the bubble bursts :-)

  • (nodebb) in reply to JW

    If anything, it would be != in this case.

  • Kleyguerth (github) in reply to Neurotic Network

    It's not getting a bool where an int should be. It's getting a bool where any object should be. It is looking for the index of true (presumably the result of newStatus > -1) in the array, not finding it, and returning -1 to signal it was not found in the array. The if looks at -1 and considers that as truthy. There's no JS weirdness here.

  • (nodebb) in reply to Neurotic Network

    JS is hardly the only language that automatically converts bools to integers. C and C++ don't even have a distinct boolean type. In Python, bool is a subtype of int. PHP automatically converts between bool and int in many contexts.

  • (nodebb) in reply to Neurotic Network

    because pretty much all languages do that sadly. there were generations of developers who thought fortran was evil because it wouldn't let you do that, and c/c++/...(long list of languages) were awesome because they would.

  • Klimax (unregistered) in reply to Barry Margolin

    Ehm, C++ always had separate bool (it is even considered fundamental type!).

  • (nodebb)

    Errors like this are easy to make in dynamically typed languages. Personally, I prefer TypeScript to plain JavaScript for Node.js development.

  • (nodebb) in reply to Klimax

    a) 'bool' wasn't a standard type until c++98

    b) int to bool conversion, or vice versa, is implicit, so it's not really a lot of help in avoiding that particular type of problem. 'int a = b < 5;' will compile, setting a to 1 if b < 5 and 0 otherwise. And with most peoples compiler flags, it will compile without a warning.

  • Neurotic Network (unregistered) in reply to Kleyguerth

    Overassumption on my part - I read reportStatuses as a collection of enum values which (dangerously, I know) my brain still treats as ints. I think that's missing the point, however. Allowing differing types into the same collection is a grade A footgun, and I'm very much pro footgun control. JS, though, seems to made entirely of footguns that you have to carefully reposition. And is at the same time described as beginner-friendly because all those footguns don't care where you point them, so the fledgling dev doesn't have to, either. ( And yes, I know Python will let you do that as well. Doesn't mean I have to like it. IEnumerable<T> for me, please.)

  • (nodebb) in reply to Neurotic Network

    I know, I know, hating on JS is overdone ... but how in the name of all that is holy is half the planet running on a language that gets a bool where an int should be and says "Sure, this is fine"? Software isn't eating the world, it's covering it in vomit.

    And before that, Perl. Happy to now have moved on to Dart, which has real types and can be compiled to JS to use browser-side and server side (node.js).

  • (nodebb) in reply to thosrtanner

    a) 'bool' wasn't a standard type until c++98

    That's because there weren't C++ standards until C++98, but bool was a type in C++, with all its current behaviour, almost right from the beginning.

    And it was first included as a standard type (with a different name, but the same behaviour as in C++) for C in C99, so we can regard it as pretty much settled as a standard type in both C and C++, for more than a quarter of a century.

  • 516052 (unregistered) in reply to Steve_The_Cynic

    You say that as if it was a long time. Kids these days...

  • (nodebb) in reply to 516052

    At least we've mostly managed to migrate away from K&R C these days.

Leave a comment on “Duplicate Reports”

Log In or post as a guest

Replying to comment #688464:

« Return to Article