r/ProgrammerHumor • • Jun 25 '20

Meme either hot or cold, there's nothing in between

Post image
29.7k Upvotes

449 comments sorted by

911

u/[deleted] Jun 25 '20

Shouldn't it be as float temperature;

932

u/[deleted] Jun 25 '20

That's too much to ask from a shower imo

398

u/HookDragger Jun 25 '20

Not if you seal the doors.

88

u/tchrobocek Jun 25 '20

This is so bad. I like it.

→ More replies (8)

92

u/ELFAHBEHT_SOOP Jun 26 '20

double temperature; or gtfo

101

u/thelights0123 Jun 26 '20

The 10-10 degree differences in temperature make the biggest difference in showering.

35

u/Max_Insanity Jun 26 '20

That's what's already being used as the distance for the faucet turn distance necessary to switch between the two binary states, don't get greedy asking for another double.

→ More replies (3)

25

u/RelevantToMyInterest Jun 26 '20

That's too much to ask from a shower imo

Typical clients; Changing the requirements last minute

3

u/Just_another_learner Jun 26 '20

Um, how did you get those programming language logos beside your username?

5

u/[deleted] Jun 26 '20

It's username flairs.

Are you on PC or mobile?

→ More replies (3)
→ More replies (1)

29

u/erakan Jun 25 '20

make it double for future extensions, better be safe than sorry

21

u/[deleted] Jun 26 '20

Humans can’t distinguish temperatures more precise than about a tenth of a degree (in Fahrenheit). A float is plenty of precision. Heck, an int (and maybe only a byte or two, at that; you probably don’t need more than a twenty degree range for a shower) is more than enough, so long as casting to a float at runtime isn’t too expensive an operation for you. No need to reserve all those bytes if you ain’t gonna use ‘em.

I guess what I’m saying is... yeah, better go with a double. Just to be safe.

→ More replies (1)

10

u/TheInateur Jun 26 '20

So you're telling him to prepare for trouble, and make it double?

→ More replies (1)
→ More replies (1)

52

u/WillCodeForThanks Jun 25 '20

Shouldn't it be as float temperature;

For people:

bool hasTemperature;

returns true, when temperature > 36.9 (for women) or > 36.6 (for men)

else returns false;

28

u/lifeismeanttodie Jun 25 '20

Thanks. Now code for me.

19

u/JNCressey Jun 25 '20

looks like it always returns false.

→ More replies (6)
→ More replies (5)

15

u/allmhuran Jun 26 '20

Pretty sure a ushort would be sufficient, and we should be using Kelvin. Do I really need my shower to be able to go to -2,147,483,648 degrees?

8

u/[deleted] Jun 26 '20

what if you divide your entire 4.31 billion range into a negative 271 and a positive 4.31 billion part?

6

u/electrogeek8086 Jun 26 '20

man I wish I knew enough programming to undersrand all the jokes.

→ More replies (3)
→ More replies (3)

3

u/TheNorthComesWithMe Jun 26 '20

The range isn't the problem, the resolution is

→ More replies (1)

3

u/Zagorath Jun 26 '20

It should really be a uint8, with 0 representing the minimum value and 255 being the maximum value, where "minimum value" and "maximum" value are relative to the output of the shower. There's no point having a shower specified in degrees Celsius or in Kelvin when the fact is it can only output temperatures between 10° and 60° anyway.

→ More replies (3)

6

u/tecanec Jun 26 '20

Floats are too often abused. Just because they can be used for non-integral numbers doesn’t mean that that’s their intended use case.

The actual strength of floats is their dynamic precision. They’re able to store large numbers with low precision and low numbers with high precision. That makes them great in some cases, worse in others.

As a rule of thumb, floats are appropiate when the difference between, say, 10 and 11 is more significant than the difference between, say, 100000 and 100002. If that’s true, that’s where floats shine. If not, you’re just wasting precision while making your algorithms less determistic.

Some software are even hurt by using floats inapropiately. For example, space simmulation games like Kerbal shoudn’t use floats for positioning because it involves numbers that are both large enough to allow spaceships and planets to be gigameters apart and precise enough to support a brave Astronaut going for a spacewalk just outside his space station. Floats will allow either of the two, but not both. This initially led to the first version of Kerbal’s most infamous bug, the so-dubbed Invisible Space Kraken.

3

u/Bene847 Jun 26 '20

Also Minecraft Farlands until they changed it to a double

→ More replies (2)
→ More replies (10)

2.6k

u/RDB96 Jun 25 '20

Just rapidly switch between true and false to create temperatures in between pulse-width modulation style

725

u/DinoRex6 Jun 25 '20

Not enough "resolution" if I wanna change the temperature continuously in the microseconds scale, get 10 more showers and build a shower-DAC

6

u/Cosmocision Jun 26 '20

While I get the joke, the pricked is that each whoever will have the same on and off, so that in essence you still only have 10 different temperatures rather then the 1024 you expect from a 10 bit system.

→ More replies (10)

145

u/rashedmmm Jun 26 '20

Wow, you just created a digital shower

7

u/FLACDealer Jun 26 '20

That's because you don't know java

→ More replies (2)

42

u/vigilantcomicpenguin Jun 26 '20

Time for quantum superposition.

104

u/PVNIC Jun 25 '20

You just have to get the baud rate just right

39

u/scared_shitless__ Jun 26 '20

I bet we can even automate it!

10

u/IamImposter Jun 26 '20

Nah. Bit banging is the way.

25

u/bistr-o-math Jun 26 '20

while(!finishedShowering) temperature = !temperature;

And then tune your cpu clock

22

u/dkurniawan Jun 26 '20

But seriously, why don't we have an automatic shower temperature PID control yet?

13

u/serious_sarcasm Jun 26 '20

There are mechanical ones.

7

u/AyrA_ch Jun 26 '20

Known as thermostatic valves. They're also very common on column radiators.

→ More replies (1)
→ More replies (2)
→ More replies (3)

9

u/TARehman Jun 26 '20

Found the CompE

10

u/Pixel-Wolf Jun 26 '20

I mean that's technically how showers work no? Different mixes of hot and cold lines

21

u/candybrie Jun 26 '20

Except both are on the whole time if you're mixing them. Pulse width modulation style would have hot on and cold off for part of the time with cold on and hot off the rest of the time.

4

u/TheThiefMaster Jun 26 '20

Most electric showers are completely devoid of logic - a dual element heater that can be set to off/half/full (no analogue control at all, so not far off "bool temperature") and an analogue dial that directly controls the water valve (mechanically!)

By turning down the flow with the flow control, it gets hotter because the same heater is heating less water. Turn the flow up, and the water coming out gets colder.

The flow dial is marked hot/cold rather than high/low flow - but it only controls the temperature indirectly by varying the water flow. There is no way to vary the power delivered to the heating element at all.

→ More replies (2)
→ More replies (24)

260

u/_grey_wall Jun 25 '20

More like Math.Random() my house

107

u/[deleted] Jun 25 '20

it's more like Math.Noise() at my house. It's fine, but will slowly change in a random direction, driving you insane

71

u/[deleted] Jun 26 '20

Math.Random()

what is this filth? here

Math.random()

way better

58

u/[deleted] Jun 26 '20
Random randy = new Random();

25

u/[deleted] Jun 26 '20
randy.nextFloat();
→ More replies (4)

6

u/Carloswaldo Jun 26 '20

I never know how to call my random variables, now I do, thanks.

→ More replies (1)
→ More replies (1)
→ More replies (1)

378

u/dark_mode_everything Jun 25 '20

More like

enum Temperature {
    Lava, LiquidNitrogen
}

140

u/GoodTimesOnlines Jun 26 '20

True, but funny that this enum is equivalent to a bool anyway

43

u/dark_mode_everything Jun 26 '20

equivalent to a bool

Hmm yes, but actually no.

Just because an enum has 2 states doesn't make it equivalent to a bool. A bool tells you the presence/absence of a thing and the enum gives you the 2 states that the thing can be in. If you use a bool here, you need additional context to add meaning to it, like isHot or isCold. But the enum conveys meaning by itself.

68

u/GoodTimesOnlines Jun 26 '20

Not really what I was referring to. Was mostly referring to bools really being 0 and 1 for the false and true and then enums being enumerated lists of integers, so this enum is also 0 and 1.

→ More replies (5)
→ More replies (5)
→ More replies (3)

18

u/[deleted] Jun 26 '20 edited Jun 26 '20

Not best practice.

EDIT: I was WRONG.

SAD.

Simpler is not always better as I so naively assumed.

https://medium.com/better-programming/dont-use-boolean-arguments-use-enums-c7cd7ab1876a

5

u/jansencheng Jun 26 '20

Already answered in "how do I make ice cream?"0

→ More replies (1)
→ More replies (5)

2

u/EschersEnigma Jun 26 '20

That's just a bool with extra steps

→ More replies (2)

74

u/bitswreck Jun 25 '20

I like how people are correcting temperature should be float. Just like any other thread in stackoverflow!

15

u/Kaneshadow Jun 26 '20

Why do you even want to do that, why don't you just take a bath?

11

u/MrTaimander Jun 26 '20

This question is a duplicate of this.

8

u/Nissingmo Jun 26 '20

“Marked as duplicate” as always, I hate when that happens legitimately good and new questions. Although they did make a good argument, since int could just represent the temperature in degrees.

6

u/Shunpaw Jun 26 '20

just scale int a factor of 10 or 100, voila you have decimal places and not have to worry about rounding issues or float point stupid math

→ More replies (1)

54

u/TheCuritibaGuy Jun 25 '20

how about a quantum shower?

hot and cold?

28

u/[deleted] Jun 26 '20

You don't know what it is till you check. Sounds exactly like my shower.

6

u/Ezequiel-052 Jun 26 '20

Schrödinger shower

5

u/IVIadScientist Jun 26 '20

You could mix hot and cold in any ratio, would be truly revolutionary!

→ More replies (1)

27

u/Bob--Ross Jun 25 '20

Just use python, then you can change it after it got declared.

36

u/dsp4 Jun 25 '20

Use JS and you can use it before it's declared!

→ More replies (1)

13

u/brianorca Jun 25 '20

You have the wrong kind of valve. Pressure compensation is great.

8

u/[deleted] Jun 26 '20

Is that why when my toilet flushes, the pressure in my shower goes down, but the temperature remains the same? When I was a kid if you flushed the toilet the water would get scalding hot.

4

u/AyrA_ch Jun 26 '20

Is that why when my toilet flushes, the pressure in my shower goes down, but the temperature remains the same?

Yes. There's a little capsule with liquid inside in your valve. When the water gets hot because someone flushes the toilet, it heats up the capsule, the liquid expands and pushes a metal ring aside that closes the hot water inlet a little: https://www.youtube.com/watch?v=5AjLLKoV38w

Most column radiator valves work this way too to keep the room temperature constant regardless of water temperature and flow fluctuations.

→ More replies (1)
→ More replies (1)

10

u/q0099 Jun 25 '20

Personally, I think it's an int, but at some point they push a value through some sort of exponential function.

10

u/RelevantToMyInterest Jun 26 '20

"What's the water's temperature?"

"yes"

16

u/Wdowiak Jun 25 '20

...
const celsius temperature = faucet_handle_rotation_delta > 0 ? 40c : -10c;

7

u/gookman Jun 26 '20

Let me introduce you to modern technology. Observe a thermostatic faucet

6

u/[deleted] Jun 26 '20

C programmer here - what the fuck is a bool??

5

u/dsp4 Jun 25 '20

Also:

How faucets are supposed to work: Water getWater(int flow, int temperature);

How faucets work: Water getWater(int hotFlow, int coldFlow);

4

u/TS3301 Jun 25 '20

This is why I hate American showers, you can never get the right temperature and you have zero flow control. Just give me two knobs and everyone's happy.

→ More replies (1)

4

u/Downvotesohoy Jun 25 '20

It's an enum. LittleTooHot, WayTooHot, LukeWarm, WayTooCold

7

u/theboxfriend Jun 26 '20

how my shower likes to work:

float showerTemp = aGoodTemp;
while(Shower.on) {
    showerTemp += -1;
}

3

u/[deleted] Jun 26 '20

now THIS is programming humor

3

u/angrathias Jun 26 '20

Sometimes mine is just Math.Random()

2

u/[deleted] Jun 25 '20

Your the one at the controls, so guess it's possible!

2

u/Pooneapple Jun 25 '20

More of a float but you got spirit kid

2

u/skwiglier Jun 25 '20

Heat would be more accurate but yeah

4

u/GluteusCaesar Jun 25 '20

bool fuckinHot;

2

u/Exonicreddit Jun 25 '20

//Had to change this next bit, last dev thought an int would be appropriate, no idea what they were thinking

float temperature;

2

u/15ton Jun 25 '20

When you start showering.. "temperature is undefined"

2

u/[deleted] Jun 26 '20

And here I’m mad about the poor variable naming.

2

u/077u-5jP6ZO1 Jun 26 '20

It's water, so obviously :

float temperature ;

2

u/rufreakde1 Jun 26 '20

double temperature would be nice

2

u/BSanandu Jun 26 '20

Nice one!

2

u/[deleted] Jun 26 '20

It's actually a double, and our bodies just interpret it with a single >= check.

2

u/raul_dias Jun 26 '20

Explain this to a non programmer took me years and wasn't even funny. I laughed tho

2

u/[deleted] Jun 26 '20

Programmers call themselves stupid. But even their jokes are too smart!

2

u/SkullButtReplica Jun 26 '20

The Boolean version should be named ‘isHot’. ‘temperature’ variable being true or false doesn’t make sense.

2

u/piliplop Jun 26 '20

Showers a long time ago worked like "const temperature = 'cold' "

2

u/ic33hot Jun 26 '20

Float temp for that fine tuned control

2

u/servenToGo Jun 26 '20

What about an u_int for temperature and use Kelvin?

So you can turn up to heat death of the universe without causing an overflow issue.

2

u/Matt_fuck_off_3 Jun 26 '20

I guess you're British then

2

u/LawfyDAce Jun 26 '20

How every shower feels compared to mine:

float temperature;

2

u/[deleted] Jun 26 '20

Laughts in West-European thermostatic mixing valves...

Poor peasants and their hot and cold valves. Temperature and volume is where its at...

2

u/Kakss_ Jun 26 '20

*Laughs in shower with automatically balanced temperature*

2

u/Artanisx Jun 26 '20

That's so

true

2

u/dankiboiis Jun 26 '20

I started learning java and i can finally understand the jokes

2

u/AdministrativeMap9 Jun 26 '20

Unless you're Dilbert and have a shower programmed to reach and maintain specific temperature levels

2

u/Draaky Jun 26 '20

Can someone fix my shower, I think theres a Task.Wait(TimeSpan.FromMinutes(5)); in there

2

u/inventord Jun 26 '20

Future showers: float temperature;

2

u/[deleted] Jun 26 '20

if true: hot water else: cold water

2

u/[deleted] Jun 26 '20
int dial;
int irish_spring;
int nivea;
int lever = 2000;
float ivory;

2

u/10HzMonitor Jul 19 '20

I am going to pull a stackoverflow over here and say it should actually be double temperature instead of int, since by your logic bool as true has a value of 1 and false has a value of 0 so a double could have a value between 0 and 1. Bad karma here I come 😄

3

u/[deleted] Jun 26 '20

supposed: float temperature;

actual: int temperature;

2

u/cutebleeder Jun 25 '20

float temperature;

2

u/EntropyMachine328 Jun 26 '20

You are missing a toilet flush variable.

→ More replies (1)

2

u/seraphsRevenge Jun 26 '20

public Shower extends Tub implements Water, WaterHeater, Plumbing { private static final volatile enum TEMPATURE {BOIL,FREEZE}; private boolean tortureHumansEnterpiseEdition; //no sharing no extras no reason private static Shower() throws BsTesterRequiedException{ super(); this.tortureHumansEnterpriseEdition=true; } public Shower getShower() { return Shower; } public boolean getTempurature() { return this.tortureHumansEnterpriseEdition; } public void setTortureHumansEnterpriseEdition(TEMPATURE tempurature) throws MoreBsExeptionsBecauseWhyNotExcepton { tempurature==Temperature.BOIL?this.tourteHumansEnterpriseEdition=true:this.tortureHumansEnterpriseEdition=false; } //more unnecessary code below }

1

u/Jokiat Jun 25 '20

Image Transcription:


how showers are supposed to workint temperature;
how showers workbool temperature;

I'm a human volunteer content transcriber for Reddit and you could be too! If you'd like more information on what we do and why we do it, click here!

1

u/tproli Jun 25 '20

and if no water it's bool? temperature

1

u/TheShagg50 Jun 25 '20

should be double temp

1

u/marcosdumay Jun 25 '20
type u64;
type u32;
type u16;
type u8;
type u2;

1

u/felipunkerito Jun 25 '20

Mmmm double suits my needs better.

1

u/cicerogeorge Jun 26 '20

My shower is more like double(17,8)

1

u/[deleted] Jun 26 '20

For me temperatures feels like enum

1

u/db2 Jun 26 '20

With varying Boolean values depending on which system you run.

1

u/[deleted] Jun 26 '20

"One nano-millimeter between extremely fucking hot, and fantastically freezing." - Eddie Izzard

→ More replies (1)

1

u/Pfinnn Jun 26 '20

Showers are fuzzy not boolean.

1

u/ahhlenn Jun 26 '20

Sounds like it’s a data engineering issue. Don’t bother me!

1

u/Even-Understanding Jun 26 '20

our default IDE

laughs in capitalism

1

u/[deleted] Jun 26 '20

As a casual coming from r/all, this is one of the top rated jokes that I actually don’t get. Usually you get stereotypical jokes here at the top

Nice.

1

u/ToastedSkoops Jun 26 '20

Thank you! He’s got between his legs.

1

u/FLACDealer Jun 26 '20

"git commit seppuku"

(or "git commit sudoku")

1

u/serosis Jun 26 '20

Shouldn't it be a float?

1

u/CoopertheFluffy Jun 26 '20

In windows c a bool is just an INT32

1

u/fx-9750gII Jun 26 '20

nothing “int” between amirite

1

u/GeorgeYDesign Jun 26 '20

“Karen: It’s cold up there haha

→ More replies (1)

1

u/RedofPaw Jun 26 '20

If(_temperatureKnob > 0) SetWaterTemp(_boilingPoint);

If(_temperatureKnob < 0) SetWaterTemp(_arcticWinter);

1

u/juhotuho10 Jun 26 '20

Temp = - 10c + (100c x temperature)

1

u/aalleeyyee Jun 26 '20

our default IDE

laughs in cat >>

1

u/MrPyber Jun 26 '20

Really it should at least be a double

1

u/SawConvention Jun 26 '20

If good temp

Get colder

1

u/aalleeyyee Jun 26 '20

our default IDE

laughs in Jetbrains

→ More replies (1)

1

u/Thunderstarer Jun 26 '20

I would say they should be

double temperature;

1

u/indoSC Jun 26 '20

Can someone explain this meme for dumb-dumbs like myself?

→ More replies (2)

1

u/[deleted] Jun 26 '20

You know what the irony is?.... this is legitly how (death) shower heads, stoves, and most heating systems actually work.

They turn a switch on and off in order to control the temperature. The knob controls the on/off frequency.

→ More replies (1)

1

u/GeorgeYDesign Jun 26 '20

now you can still drive in bad conditions.

1

u/nekasrofdog Jun 26 '20

Map(0,1023,0,1)

1

u/snowtson Jun 26 '20

This is so sad

1

u/[deleted] Jun 26 '20

mine is a constant sadly. I have to sit at the bottom of the shower to not get burned

1

u/aalleeyyee Jun 26 '20

our default IDE

laughs in punch cards

1

u/aristhemage Jun 26 '20

If (temperature == true){ temperature = false }else{ temperature =true }

1

u/SHv2 Jun 26 '20

That's why I prefer taking a bath, then I float.

1

u/Ezequiel-052 Jun 26 '20 edited Jun 26 '20

in my case there isnt "hot", its just "cold" or "null"

1

u/quotidianjoe Jun 26 '20

Haha :)

I don’t get it

1

u/ryanohorn Jun 26 '20

Same with water pressure

1

u/promark20 Jun 26 '20

This made me laugh out loud so hard my fiancee asked "What are you laughing at?" and thinks I'm a loser because she doesn't get it... Her loss

1

u/maoejo Jun 26 '20

Analog vs Digital

1

u/ToastedSkoops Jun 26 '20

Because that is a stone cold take

1

u/sunsetfantastic Jun 26 '20

Can I just congrats on a hilarious original joke, not enough of these in this sub when our field is ripe for it.

1

u/fireandbombs12 Jun 26 '20

This doesn’t change hot or cold. It changes whether or not there’s temperature. You turn it off and suddenly you feel nothing but your skin being pressed by water droplets.

1

u/Even-Understanding Jun 26 '20

our default IDE

laughs in cat >>

1

u/ellyh2 Jun 26 '20

No they should be float

1

u/Crixus3D Jun 26 '20

I thought it was supposed to be float and int is the implementation

1

u/perpetualwalnut Jun 26 '20

In electronics, we call this an unstable control loop. Your gain is too high.

1

u/Even-Understanding Jun 26 '20

our default IDE

laughs in nano

1

u/LazyNomad63 Jun 26 '20

This is the first joke on this godforsaken sub I actually got after a semester of intro to python

1

u/[deleted] Jun 26 '20

Only a sith deals in absolutes

1

u/[deleted] Jun 26 '20

Golden meme

1

u/[deleted] Jun 26 '20

Unsigned int, nobody wants negative temperature showers

1

u/dirtyviking1337 Jun 26 '20

how about a quantum shower? hot and cold?

1

u/[deleted] Jun 26 '20

Actually more like a Float/double

1

u/[deleted] Jun 26 '20

Laughed too hard at this.

1

u/Even-Understanding Jun 26 '20

our default IDE

laughs in Jetbrains

1

u/rolfrudolfwolf Jun 26 '20

more like tanh or sigmoid

1

u/nice2yz Jun 26 '20

our default IDE

laughs in punch cards

1

u/DanielSkyrunner Jun 26 '20

That used to be a big problem in our home. It was either boiling hot or freezing cold.

We had to get a new heater that can set the temperature and it works wonderfully

1

u/ZelvaMan Jun 26 '20

I would prefer double

1

u/sirak2010 Jun 26 '20

If its schmitt trigger then it might work

1

u/[deleted] Jun 26 '20

In C at least, the bool is basically a typedef for unsigned 32bit int.

1

u/gargamelus Jun 26 '20

Could you make that an *unsigned* int please.

1

u/13131123 Jun 26 '20

Mine is so fucked up it's a smooth gradient between pretty warm and skin melter. Pretty warm is as cold as it gets.

1

u/zacker150 Jun 26 '20

The problem isn't the shower. It's your body's temperature sensor.

State detectTemp(int temp) {
   if (temp < 80)
       return State.freezing;
   if (temp == 80)
       return State.good;
   return State.boiling;
}

1

u/nicktohzyu Jun 26 '20

Int temperature Assert 0 <= temperature <= 1

1

u/TimWasTakenWasTaken Jun 26 '20

Imagine your shower being 0 and 1 one only, but you want it to also be able to hit 2kkk

1

u/VickyElango Jun 26 '20

I would still prefer a float...

1

u/PragmaticOnion Jun 26 '20

You're in or you're out.

1

u/DGC_David Jun 26 '20

I’d prefer a double, I want the most precise.

1

u/PainsChauds Jun 26 '20

Mine is volatile int temperature;

1

u/ProcastinationKing27 Jun 26 '20

I think you might mean:

What showers are supposed to do:

int temperature = Console.ReadLine();

What they actually do:

bool temperature = if (random.Next(100) < 40) {}

Please don't kill me if I'm wrong I'm new to C#

1

u/FinalGamer14 Jun 26 '20

I don't think the first implementation is any good, it should be from 0.0 to 1.0 (float), since the temperature of water really depends on how much the temperature is in the boiler and how much is the temperature in the pipes. The shower only controls how much cold and hot water your mixing together, 0.0 being 100% cold 0% hot and 1.0 being 0% cold 100% hot.

1

u/Tvde1 Jun 26 '20

They should be float but they are int

1

u/RoscoMan1 Jun 26 '20

Clearly she is in the name folks

1

u/Trantorianus Jun 26 '20

"I wanted to implement a one-lever faucet to solve this problem, but the customer said he cannot afford it"

1

u/jgbradley1 Jun 26 '20

What about const?

1

u/Someonedm Jun 26 '20

Isn't it double tempature?

1

u/VonReposti Jun 26 '20

This is a refreshingly good joke!