r/ProgrammerHumor • • Feb 07 '19

other Spotted on GitHub 🤓

Post image
57.0k Upvotes

934 comments sorted by

View all comments

1.3k

u/[deleted] Feb 07 '19

Link please

1.2k

u/[deleted] Feb 07 '19

105

u/TheOldTubaroo Feb 07 '19 edited Feb 07 '19
days_late*100/days_deadline/100

Isn't that pointless? Aren't all js numbers floats, so you don't need to worry about integer division?

And also clamping the opacity to [0,1] and then checking if opacity is greater than 0 and less than 1...

321

u/shitmyspacebar Feb 07 '19

You mean you don't add redundant checks just in case the laws of mathematics suddenly change?

64

u/TheLuckySpades Feb 07 '19

I'm studying math and when programming by my own I'll have a bunch of redundant checks, even if it's just implementing something I just proved to always work.

If I'm stressed, say an exam, I'll skip any and all checka, even if I'm not even sure if the math is correct and won't accidentally summon a great old one.

27

u/joe579003 Feb 07 '19

If in the process of compiling a choir starts chanting in Latin and an organ starts playing out of thin air you know you done fucked up.

15

u/TheLuckySpades Feb 07 '19

Depends o if the unearthly light is coming from above or below.

Above you have a chance it's thw angelic hostcome to take away your code and they might spare your soul.

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

159

u/UsedCondition1 Feb 07 '19

Well, if we are talking about the implementation of those laws in javascript... yes, yes you should.

77

u/Finchyy Feb 07 '19

Ah, JavaScript... where 2 + 2 is 4 but also sometimes 4.00000000001...

32

u/Layers3d Feb 07 '19

2+2 = 5 if the party says so.

23

u/thecravenone Feb 07 '19

And also for large values of 2

→ More replies (12)

14

u/JasonDeroelo Feb 07 '19

This is my fear

13

u/TexMexxx Feb 07 '19

Well when developing in a big team (or teamS) some redundant checks might not be the worst idea. Someone WILL break your interface and if you have some checks in place the culprit MAY see what he is doing wrong... MAYBE! (OK, chances are good he just delets your check) ;)

23

u/TechnicallyAnIdiot Feb 07 '19

"Sir, do you know why I stopped you today?"

"No?"

"You were dividing in an addition only zone. You really need to know the laws of mathematics."

"Oh jeez, I didn't see the sign, when did they put that in? This won't make me lose my mathematical operator license will it?"

→ More replies (2)