• (cs) in reply to ubersoldat
    ubersoldat:
    Why should software apologize?
    Maybe the person who wrote it was trained on Microsoft Bob? In which case, the software would probably need to apologize.
  • (cs) in reply to Anon
    Anon:
    Arantor:
    Is it wrong that I might actually consider this for non-serious errors, mostly as a form of easter egg? (i.e. for errors that should never appear in production but that if they do, it's just tripping a safety net, and would actually still list the real error underneath)

    No. Its not wrong. You should definately implement this. And you should definately keep the part where Now.Millisecond is partitioned into ten options. Because splitting it into two would not make it random enough.

    You need MOAR!!! Moar error messages to confuse the user. That way when they get like 3 different error messages in a row they will think that there is a different problem causing them.

  • (cs) in reply to Melnorme
    Melnorme:
    Two words: Female programmer
    As sexy as that sounds... what you're saying is she shoulda stayed in the kitchen?
  • (cs)

    Random error messages are introduced for purpose of leting client beleive that something euniquely different occur in computer each time. This way client think, he has wonderfull system

  • Gary (unregistered) in reply to Colubra

    You are in a maze of twisty passages all alike.

  • Gary (unregistered) in reply to Gary
    Gary:
    You are in a maze of twisty passages all alike.
    Plugh! Someone posted this already.
  • whatevs (unregistered) in reply to ObiWayneKenobi

    Starship Catan.

  • Secret (unregistered) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    One of the errors should have been: "It's a sad thing your adventure has ended here!"

    Props if anyone knows what that's from.

    You have died of cholera.

  • Schrödinger's cat (unregistered) in reply to Throck
    Throck:
    Greetings from the future. Your olden ways are fascinating. Just think this to your synthetic personal assistant, and it'll update your code for you:
    Private Function GenerateApologyMessage() As String
    	Return If(Qubit.Collapse, "Whoops!  Something went slighty awry...", "How embarassing, I seem to have failed that task!")
    End Function
    
    It returned [image].
  • (cs) in reply to Zunesis: Nothing Less Than The Best
    Zunesis: Nothing Less Than The Best:
    String[] array = (String[]) list.toArray();
    Now I know you don't write Java code for a living.
  • Gneius (unregistered) in reply to Netherous
    Netherous:
    Altourus:
    If (number % 200 < 100) ErrorMessageFrist else ErrorMessageTwo

    ??

    Silly noob, you need to get an instance from RandomErrorMessageApologyGeneratorFactory and attach the MillisecondDomainPartitioningBehavior and give it your callbacks to ensure your code is flexible and robust enough for the enterprise environment.

    These two classes look a bit too tightly coupled in concept for my liking. I think the core logic needs to be factored out into implementation(s) of a TimeDomainDrivenErrorMessageGenerationStrategy interface, then the Behaviour object can probably be pared down to a simple collection of key/value pairs.

  • Darkstar (unregistered) in reply to Schrödinger's cat

    In fact, this has already been covered by Damian Conway (notable perl hacker) with the module Quantum::Superpositions.

  • Jimmy (unregistered) in reply to Andrew
    Andrew:
    Ignoring the attempted randomisation, I just hate those would-be-cute error messages. Unfortunately they even crop up in supposedly professional software, e.g. Firefox when it can't recover from an aborted session: "Well, this is embarrassing". Developers - just say no.
    I dunno, I used to love tar (yes I know it's not an error message, but same principle): "Cowardly refusing to create empty archive"

    Also IIRC, many of the Sierra Games used to crash with: "You did something we didn't expect"

  • Mick (unregistered) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    One of the errors should have been: "It's a sad thing your adventure has ended here!"

    Props if anyone knows what that's from.

    Pick-A-Path/"Choose your own adventure" books?

  • Gunslinger (unregistered) in reply to Arantor
    Arantor:
    Is it wrong that I might actually consider this for non-serious errors, mostly as a form of easter egg? (i.e. for errors that should never appear in production but that if they do, it's just tripping a safety net, and would actually still list the real error underneath)

    As long as you have more than 2 error messages when there's 10 cases, sure, it's all good.

  • Gunslinger (unregistered) in reply to dkf
    dkf:
    Zunesis: Nothing Less Than The Best:
    String[] array = (String[]) list.toArray();
    Now I hope you don't write Java code for a living.

    FTFY

  • (cs) in reply to Mick
    Mick:
    ObiWayneKenobi:
    One of the errors should have been: "It's a sad thing your adventure has ended here!"

    Props if anyone knows what that's from.

    Pick-A-Path/"Choose your own adventure" books?

    Was it Shadowgate? I remember my adventure ending in that a lot, mostly involving falling into pits and such :)

  • (cs)

    It certainly beats the "Oh bugger" that used to spontaneously appear at the bottom of the screen when running a program that appeared on my list of programs to maintain and upgrade a few years ago.

    When I reprogrammed it to get the error to explain itself, disappointment was raised by all the people who would never again be graced with the delights of "Oh bugger" when they fatfingered the input. Silly buggers.

  • Anonymous Coward (unregistered) in reply to boog

    Still seems over-engineered.

    return System.currentTimeMillis() / 100 % 2 == 0 ? "Whoops!  Something went slighty awry..." : "How embarassing, I seem to have failed that task!";
  • CZeke (unregistered) in reply to Arantor
    Arantor:
    Is it wrong that I might actually consider this for non-serious errors, mostly as a form of easter egg?

    Not at all -- but for the sake of sanity, at least calculate the millisecond only once. This guy probably thought he was setting up the equivalent of a switch() structure, but instead it's a sieve: the first error message has a 10% chance of triggering, the second has a 20% chance, and so on, all independent. It needs a variable, like the GWBasic version posted upthread. If you're gonna do the wrong thing, do it correctly!

  • FuBar (unregistered)
    If Now.Millisecond = 666 Then
            Return "Be afraid. Be very afraid."
  • (cs) in reply to Throck
    Throck:
    Greetings from the future. Your olden ways are fascinating. Just think this to your synthetic personal assistant, and it'll update your code for you:
    Private Function GenerateApologyMessage() As String
    	Return If(Qubit.Collapse, "Whoops!  Something went slighty awry...", "How embarassing, I seem to have failed that task!")
    End Function
    

    Fool! This function is not multiverse-safe!

  • (cs) in reply to towel
    towel:
    Zunesis: Nothing Less Than The Best:
    boog:
    Fixed?
    ...<snip>...
    return list.get(System.currentTimeMillis() % list.size());
    
    What, are you just going to let all that memory get eaten up by using an ArrayList? You've got a lot to learn, nub:
    ...<snip>...
    return array[System.currentTimeMillis() % array.length];
    
    Ha! 293 million years from now, when System.currentTimeMillis() returns a negative value, your indexes will be out of bounds. Prepare to have your code posted here.

    So, -7 % 2 != 1?

  • Mick (unregistered) in reply to click
    click:
    towel:
    Zunesis: Nothing Less Than The Best:
    boog:
    Fixed?
    ...<snip>...
    return list.get(System.currentTimeMillis() % list.size());
    
    What, are you just going to let all that memory get eaten up by using an ArrayList? You've got a lot to learn, nub:
    ...<snip>...
    return array[System.currentTimeMillis() % array.length];
    
    Ha! 293 million years from now, when System.currentTimeMillis() returns a negative value, your indexes will be out of bounds. Prepare to have your code posted here.

    So, -7 % 2 != 1?

    in Java, -7 % 2 = -1 I think....

  • Mick (unregistered) in reply to Mick
    Mick:
    click:
    towel:
    Zunesis: Nothing Less Than The Best:
    boog:
    Fixed?
    ...<snip>...
    return list.get(System.currentTimeMillis() % list.size());
    
    What, are you just going to let all that memory get eaten up by using an ArrayList? You've got a lot to learn, nub:
    ...<snip>...
    return array[System.currentTimeMillis() % array.length];
    
    Ha! 293 million years from now, when System.currentTimeMillis() returns a negative value, your indexes will be out of bounds. Prepare to have your code posted here.

    So, -7 % 2 != 1?

    in Java, -7 % 2 = -1 I think....

    http://docs.oracle.com/javase/specs/jls/se7/html/jls-15.html#jls-15.17.3

    Akismet blows dead goats fallopian tubes

  • Stivlo (unregistered) in reply to Altourus

    Your solution is not as efficient as the original code, but nice try.

    I would have enjoyed more messages, like 'I tried my best, but I failed, sorry', 'I've to confess that the task didn't go the way I planned', 'I messed this one up, I am so sorry!', 'Apologies, the task was aborted'

  • The Darned (unregistered)

    Shouldn't we suspect ambiguous requirements: it probably said "give a different message for each error condition."

    Admittedly the solution doesn't quite do that.

  • daef (unregistered) in reply to Anonymous Coward
    return System.currentTimeMillis() / 100 % 2 == 0 ? "Whoops!  Something went slighty awry..." : "How embarassing, I seem to have failed that task!";
    

    i smell a off-by-1-error there - didn't check thou since i am lazy by nature (=> i code for livin')

  • (cs) in reply to Gunslinger
    Gunslinger:
    dkf:
    Zunesis: Nothing Less Than The Best:
    String[] array = (String[]) list.toArray();
    Now I hope you don't write Java code for a living.
    FTFY
    No, I meant exactly what I said. That code snippet above will never work. It will always produce an exception, every single time. I know how to fix it, but that's not the point: any Java coder who has ever used toArray() has encountered this, and it's one of the most annoying misfeatures of the type-system. (Damnit, I know why it is this way and I can see clearly how every step into this sinkhole was taken, but it's still stupid!)
  • (cs)

    Usual case when people keep shift from PHP to PERL to PYTHON to JAVA to C# to VB.NET, confusion occuring on massive scale in brain.

    Without compiler it is difficult to sort out problem. Real programmer using Notepad and avoid this issue of mixed languages.

    In real world, I use Hindi word while speaking in English. Happens every day. Now lets go jaldi-jaldi on next topic please.

  • (cs)

    Aren't random, useless error messages an industry standard ?

  • BitDreamer (unregistered) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    One of the errors should have been: "It's a sad thing your adventure has ended here!"

    Props if anyone knows what that's from.

    According to Google, it's from a website called TheDailyWTF.com. Check it!

  • asmand (unregistered) in reply to ObiWayneKenobi
    ObiWayneKenobi:
    One of the errors should have been: "It's a sad thing your adventure has ended here!"

    Props if anyone knows what that's from.

    Shadowgate?

  • Patrick (unregistered) in reply to Anketam
    Anketam:
    PiisAWheeL:
    RuBen:
    "How embarassing, I seem to not be frist!"
    Whoops! Something went slighty awry...
    How embarassing, you seem to have failed that task!
    Whoops! Commenting went slightly awry...
  • (cs) in reply to Secret
    Secret:
    ObiWayneKenobi:
    One of the errors should have been: "It's a sad thing your adventure has ended here!"

    Props if anyone knows what that's from.

    You have died of cholera.

    No, that's Oregon Trail.

    The correct answer is Shadowgate.

    Props to anyone who got it :D

  • Al (unregistered)

    Nice that it keeps system testers busy.

    Is this a repeatable error? Sometimes. OK, possibly a separate defect for each error message. I'll raise one for each.


    Anyway, forget the apology. How about including a message that tries to shift the blame and accuses the user of system mis-use? Maybe with a reminder that all errors are logged and reported?

  • Ben Jammin (unregistered) in reply to Al
    Al:
    Nice that it keeps system testers busy.

    Is this a repeatable error? Sometimes. OK, possibly a separate defect for each error message. I'll raise one for each.


    Anyway, forget the apology. How about including a message that tries to shift the blame and accuses the user of system mis-use? Maybe with a reminder that all errors are logged and reported?

    I like accusatory validation on user input i.e. "Email address is invalid" changes to "Do you not really know your email address? Have you not really learned to tpye? We're blocking your IP cause obviously you are one of 'those' clients who is gonna be clogging all our support lines."

    (yes, in that instance tpye would be purposeful)

  • Brogrammer (unregistered) in reply to PiisAWheeL
    PiisAWheeL:
    Melnorme:
    Two words: Female programmer
    As sexy as that sounds... what you're saying is she shoulda stayed in the kitchen?

    Just like Bachmann. Wonder what ol' Crazy Eyes is up to nowadays...

  • boog (unregistered)

    I'm pretty sure Alex needs to write a GenerateApologyMessage() method for the days he can't get this site up and running or I'll pound his face.

  • a nonny mouse (unregistered) in reply to boog
    boog:
    I'm pretty sure Alex needs to write a GenerateApologyMessage() method for the days he can't get this site up and running or I'll pound his face.

    Is that a new .net language? "hisface#"

  • (cs) in reply to boog
    boog:
    I'm pretty sure Alex needs to write a GenerateApologyMessage() method for the days he can't get this site up and running or I'll pound his face.
    I'm pretty sure you don't know what "up and running" means. Your not to smart, are you?
  • (cs) in reply to frits
    boog:
    I'm pretty sure Alex needs to write a GenerateApologyMessage() method for the days he can't get this site up and running or I'll pound his face.
    The Daily WTF (top left corner of the site):
    Louisville, KY - see you at Code PaLOUsa (Mar 15-17)
    Read Much?
  • (cs) in reply to a nonny mouse
    a nonny mouse:
    boog:
    I'm pretty sure Alex needs to write a GenerateApologyMessage() method for the days he can't get this site up and running or I'll pound his face.

    Is that a new .net language? "hisface#"

    Wtf is "hisface sharp"?

  • blank (unregistered) in reply to boog
    boog:
    Fixed?
    java.util.ArrayList<String> list = new java.util.ArrayList<String>();
    list.add("Whoops!  Something went slighty awry...");
    list.add("How embarassing, I seem to have failed that task!");
    return list.get(System.currentTimeMillis() % list.size());
    

    probably being trolled, but the frist thing to hurt my eyes was the declared type being anything more specific than java.util.List

  • (cs) in reply to Ben Jammin
    Ben Jammin:
    I like accusatory validation on user input i.e. "Email address is invalid" changes to "Do you not really know your email address? Have you not really learned to tpye? We're blocking your IP cause obviously you are one of 'those' clients who is gonna be clogging all our support lines."

    (yes, in that instance tpye would be purposeful)

    I actually had an instance once to do something like this. There was an executive manager that would constantly try to delete something, get the popup asking if he is sure, always saying yes, then suddenly realizing what he did and come running in to us to fix it. Of course the system just marked it as deleted, without really delting it so recovering was easy.

    On the next release he found something interesting. He tries to delete a record, it asks if he is sure, he clicks yes, then it asks if he is posistive, then absolutly sure, then unequivically certian, then politly denied him the right to delete said record. He had to have his secretary do it for him. We triggered this only on his user id so no one else saw it.

    Took two weeks before the next release came out so he could get back to normal and he rarely ever had his "mistakes" again. He was actually a good guy to IT, he saw the humor in it and laughed about it later with us.

  • (cs) in reply to KattMan
    KattMan:
    There was an executive manager that would constantly try to delete something, get the popup asking if he is sure, always saying yes, then suddenly realizing what he did and come running in to us to fix it. Of course the system just marked it as deleted, without really deleting it so recovering was easy.
    This is why we need robust undo functionality. Confirmation dialogues may make us feel good but they just don't quite work as intended, do they? Users either waste time trying to navigate them, or they learn to always click yes and end up like your executive manager, at some point clicking yes when they ought to have clicked no. And by users I mean all of us!

    In this case, since you were already using soft deletions, an undo feature should have been fairly straightforward to implement.

  • (cs) in reply to Kivi
    Kivi:
    KattMan:
    There was an executive manager that would constantly try to delete something, get the popup asking if he is sure, always saying yes, then suddenly realizing what he did and come running in to us to fix it. Of course the system just marked it as deleted, without really deleting it so recovering was easy.
    This is why we need robust undo functionality. Confirmation dialogues may make us feel good but they just don't quite work as intended, do they? Users either waste time trying to navigate them, or they learn to always click yes and end up like your executive manager, at some point clicking yes when they ought to have clicked no. And by users I mean all of us!

    In this case, since you were already using soft deletions, an undo feature should have been fairly straightforward to implement.

    I agree, would have been easy, but they did not want it, imagine the chaos, people randomly deletign and undeleting at will! The undo feature was in our hands only, it was called a SQL script, though undoing mistakes made by that would have been far more difficult.

  • (cs) in reply to Al
    Al:
    How about including a message that tries to shift the blame and accuses the user of system mis-use? Maybe with a reminder that all errors are logged and reported?

    I see you're familiar with PowerSchool.

  • Indigo (unregistered) in reply to Melnorme
    Melnorme:
    Two words: Female programmer
    Oh, you're so right!

    They'd really need someone like that to prevent such awful code.

  • (cs) in reply to Indigo
    Indigo:
    Melnorme:
    Two words: Female programmer
    Oh, you're so right!

    They'd really need someone like that to prevent such awful code.

    I know right, havign a female programmer walk in would stop all code from being written as the male programmers all stop and stare in disbelief. Then of course everyone gets back to work once they realize it's just Jim in drag.

Leave a comment on “GenerateApologyMessage()”

Log In or post as a guest

Replying to comment #:

« Return to Article