Forum Moderators: open

Message Too Old, No Replies

If you're happy and you know it

clap your hands!

         

LifeinAsia

4:57 pm on May 9, 2019 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



As a developer, I am very offended that the lyricist did not include proper exception handling for people who are:
- not happy, or
- people who are but don't know it

NickMNS

5:02 pm on May 9, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



What? Else do nothing. But it needn't be explicitly declared.

lucy24

5:33 pm on May 9, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Not every IF requires an ELSE. You’re postulating
IF (happy && knowit)
  { clap hands }
ELSE
  { take some other action}

Or perhaps better
IF (emotional state is known)
  {
  IF (emotion == happy)
    {clap hands}
  ELSE
    {take action A}
  }
ELSE
  {take action B}

But it could just as well be
IF (all conditions are met)
  {clap hands}

with no ELSE about it, unless you particularly need to verify that the conditions have at least been evaluated. I believe my php error logs are filled with “thing I was told to look for was not found” when not-finding is a perfectly legitimate result. It’s like saying “if it is raining, carry an umbrella”, and if it isn’t raining, then don’t--but don’t start yammering about error conditions just because no rain was detected.

I'm more concerned with the “happy and you know it” aspect. What is the difference between “I am not happy” and “I don’t know whether I am happy”? Is it possible to be happy and not know it? For best results, the condition should be expressed as “if you know that you’re happy”--but even that is redundant, since an emotional state only exists if it is perceived. The construction only becomes meaningful if you’re evaluating someone else’s happiness. And then you get into arguments about how dare you assume I’m happy when I, the direct agent of the relevant emotional state, say I’m not?

LifeinAsia

6:01 pm on May 9, 2019 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Is it possible to be happy and not know it?
Apparently so, as the song requires both conditions (being happy, knowing that you're happy) be met.

Granted, an ELSE is not explicitly required. But in the real world, I worry about all those OCD folks that don't meet the conditionals and have to sit listening to the rest of the song waiting for instructions.

And from a data perspective, if the person doesn't clap, then you're stuck with a NULL value as you don't know if:
- the person is not happy
- the person is happy, but doesn't know it
- the person's happiness is indeterminate
- the person didn't understand the instructions
- the person understood the instructions, but can't comply (e.g., double amputee)
- the person understood the instructions, but refuses to comply
And I'm sure there are other scenarios that I haven't though of.

lucy24

6:25 pm on May 9, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



ONERR()
  { output “I dunno, something went wrong” }

tangor

6:54 pm on May 9, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



IF ("happy" = " ")
DO
(beer+1)
UNTIL (" " = "happy)

lucy24

7:29 pm on May 9, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Seriously, though, it’s a two-step process. After the IF happy THEN claphands part, the next step is
IF (!claphands)
  { nursery school teacher == further investigation of error }

mack

9:58 pm on May 9, 2019 (gmt 0)

WebmasterWorld Administrator 10+ Year Member Top Contributors Of The Month



Nothing beats a bit of coder humour :-)

Mack.

lucy24

11:40 pm on May 9, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



Nothing beats a bit of coder humour
I will never, ever tire of

  When the lines on your screen
  Are not quite what they seem
  That’s a moiré


... even if I am surrounded by young squirts who have no idea what that means.

NickMNS

12:48 am on May 10, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



... even if I am surrounded by young squirts who have no idea what that means.

I'm far from being a young squirt, but I had to look it up.
here to save others some time: [en.wikipedia.org...]

Clever!

piatkow

8:08 am on May 13, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



But, like me, it was moiré that you looked up, not the song.

zulu_dude

10:17 am on May 14, 2019 (gmt 0)

10+ Year Member Top Contributors Of The Month



This is why I love WW!

tangor

11:08 am on May 14, 2019 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member Top Contributors Of The Month



And all of us ichthyologists are equally thrilled that morie eels are remembered!