this post was submitted on 03 Apr 2024
1304 points (98.8% liked)

Science Memes

10842 readers
2707 users here now

Welcome to c/science_memes @ Mander.xyz!

A place for majestic STEMLORD peacocking, as well as memes about the realities of working in a lab.



Rules

  1. Don't throw mud. Behave like an intellectual and remember the human.
  2. Keep it rooted (on topic).
  3. No spam.
  4. Infographics welcome, get schooled.


Research Committee

Other Mander Communities

Science and Research

Biology and Life Sciences

Physical Sciences

Humanities and Social Sciences

Practical and Applied Sciences

Memes

Miscellaneous

founded 2 years ago
MODERATORS
 
top 50 comments
sorted by: hot top controversial new old
[–] rockerface@lemm.ee 224 points 7 months ago* (last edited 7 months ago) (7 children)

As a software developer, the less ambiguous your notation is, the better it is for everyone involved. Not only will I use brackets, I'll split my expression into multiple rows and use tabs to make it as readable as humanly possible. And maybe throw a comment or 2 if there's still some black magic involved

[–] Mikufan@ani.social 81 points 7 months ago (4 children)

No just write the entire code in one line totally perfect.

[–] rockerface@lemm.ee 39 points 7 months ago (1 children)
[–] Mikufan@ani.social 31 points 7 months ago (1 children)

"don't worry, you just need this simple one-liner to fix your project"

[–] Morphit@feddit.uk 20 points 7 months ago (1 children)

The one-liner: *parses HTML with a regex*

[–] Swedneck@discuss.tchncs.de 5 points 7 months ago

cthulhu fthagn

[–] zqwzzle@lemmy.ca 9 points 7 months ago (2 children)

That almost seems cute next to the shit the obfuscated c contest pulls off. https://www.ioccc.org/years.html

[–] Bandicoot_Academic@lemmy.one 10 points 7 months ago (3 children)

For some context this is one of the winning entries:

#include <stdio.h>

#define N(a) "%"#a"$hhn" #define O(a,b) "%10$"#a"d"N(b) #define U "%10$.*37$d" #define G(a) "%"#a"$s" #define H(a,b) G(a)G(b) #define T(a) a a #define s(a) T(a)T(a) #define A(a) s(a)T(a)a #define n(a) A(a)a #define D(a) n(a)A(a) #define C(a) D(a)a #define R C(C(N(12)G(12))) #define o(a,b,c) C(H(a,a))D(G(a))C(H(b,b)G(b))n(G(b))O(32,c)R #define SS O(78,55)R "\n\033[2J\n%26$s"; #define E(a,b,c,d) H(a,b)G(c)O(253,11)R G(11)O(255,11)R H(11,d)N(d)O(253,35)R #define S(a,b) O(254,11)H(a,b)N(68)R G(68)O(255,68)N(12)H(12,68)G(67)N(67)

char* fmt = O(10,39)N(40)N(41)N(42)N(43)N(66)N(69)N(24)O(22,65)O(5,70)O(8,44)N( 45)N(46)N (47)N(48)N( 49)N( 50)N( 51)N(52)N(53 )O( 28, 54)O(5, 55) O(2, 56)O(3,57)O( 4,58 )O(13, 73)O(4, 71 )N( 72)O (20,59 )N(60)N(61)N( 62)N (63)N (64)R R E(1,2, 3,13 )E(4, 5,6,13)E(7,8,9 ,13)E(1,4 ,7,13)E (2,5,8, 13)E( 3,6,9,13)E(1,5, 9,13)E(3 ,5,7,13 )E(14,15, 16,23) E(17,18,19,23)E( 20, 21, 22,23)E (14,17,20,23)E(15, 18,21,23)E(16,19, 22 ,23)E( 14, 18, 22,23)E(16,18,20, 23)R U O(255 ,38)R G ( 38)O( 255,36) R H(13,23)O(255, 11)R H(11,36) O(254 ,36) R G( 36 ) O( 255,36)R S(1,14 )S(2,15)S(3, 16)S(4, 17 )S (5, 18)S(6, 19)S(7,20)S(8, 21)S(9 ,22)H(13,23 )H(36, 67 )N(11)R G(11)""O(255, 25 )R s(C(G(11) ))n (G( 11) )G( 11)N(54)R C( "aa") s(A( G(25)))T (G(25))N (69)R o (14,1,26)o( 15, 2, 27)o (16,3,28 )o( 17,4, 29)o(18 ,5,30)o(19 ,6,31)o( 20,7,32)o (21,8,33)o (22 ,9, 34)n(C(U) )N( 68)R H( 36,13)G(23) N(11)R C(D( G(11))) D(G(11))G(68)N(68)R G(68)O(49,35)R H(13,23)G(67)N(11)R C(H(11,11)G( 11))A(G(11))C(H(36,36)G(36))s(G(36))O(32,58)R C(D(G(36)))A(G(36))SS

#define arg d+6,d+8,d+10,d+12,d+14,d+16,d+18,d+20,d+22,0,d+46,d+52,d+48,d+24,d
+26,d+28,d+30,d+32,d+34,d+36,d+38,d+40,d+50,(scanf(d+126,d+4),d+(6
-2)+18*(1-d[2]%2)+d[4]*2),d,d+66,d+68,d+70, d+78,d+80,d+82,d+90,d+
92,d+94,d+97,d+54,d[2],d+2,d+71,d+77,d+83,d+89,d+95,d+72,d+73,d+74
,d+75,d+76,d+84,d+85,d+86,d+87,d+88,d+100,d+101,d+96,d+102,d+99,d+
67,d+69,d+79,d+81,d+91,d+93,d+98,d+103,d+58,d+60,d+98,d+126,d+127,
d+128,d+129

char d[538] = {1,0,10,0,10};

int main() { while(*d) printf(fmt, arg); }

[–] FreshLight@sh.itjust.works 8 points 7 months ago (2 children)

I tried to read that out loud and summoned something. Please help me, I'm scared.

[–] dejected_warp_core@lemmy.world 4 points 7 months ago

I thought this was a simple piece of software?

Pinhead: No. It is a means by which to summon us.

load more comments (1 replies)
[–] Swedneck@discuss.tchncs.de 6 points 7 months ago

this straight up looks like a chemical formula

load more comments (1 replies)
[–] dejected_warp_core@lemmy.world 5 points 7 months ago

Further up the thread, someone mentioned that writing good software is about communicating concepts to people, first and foremost.

This, code obfuscation, is what it looks like to communicate exclusively to the compiler instead.

[–] CommissarVulpin@lemmy.world 6 points 7 months ago (1 children)

Excel has entered the chat

[–] Mic_Check_One_Two@reddthat.com 13 points 7 months ago* (last edited 7 months ago) (1 children)

For real though, I have written some truly monstrous operations in Excel.

What do you mean you want to use Excel to manage everyone’s calendars? And now you want to export that horribly built calendar management spreadsheet to Google Calendar? What do you mean you want the Google Calendar entries automatically formatted based on who is working on a particular day? I mean yes it’s possible but-…

load more comments (1 replies)
load more comments (1 replies)
[–] dustyData@lemmy.world 65 points 7 months ago (6 children)

As a professor said, most programming languages don't care about readability and whitespace. But we care because humans need it to parse meaning. Thus, write code for people, not for the machine. Always assume that someone with no knowledge of the context will have to debug it, and be kind to them. Because that someone might be you in six months when you have completely forgotten how the code works.

[–] zalgotext@sh.itjust.works 18 points 7 months ago

Exactly. You read code way more times than you write it, so it makes all the sense in the world to prioritize readability.

[–] Swedneck@discuss.tchncs.de 13 points 7 months ago

Source code is for humans, then the compiler turns it into code for machines.

[–] oce@jlai.lu 7 points 7 months ago (2 children)

Python forcing end of line and tabs kinda does. Add Black auto-formatter and it's pretty good.

load more comments (2 replies)
[–] rockerface@lemm.ee 6 points 7 months ago* (last edited 7 months ago) (1 children)

Yep, if you're writing code for a machine, just do it in binary to save compilation time (/s just in case). Also, you in six months will indeed be someone with no knowledge of the context. And every piece of code you think you write for one-time use is guaranteed to be reused every day for the next 5 years

[–] Mic_Check_One_Two@reddthat.com 20 points 7 months ago

And every piece of code you think you write for one-time use is guaranteed to be reused every day for the next 5 years

[–] feinstruktur@lemmy.ml 5 points 7 months ago

This. Always be kind to your future self.

load more comments (1 replies)
[–] Quetzalcutlass@lemmy.world 59 points 7 months ago (1 children)

I had someone submit a pull request recently that, in addition to their actual changes, also removed every single parenthesis that wasn't strictly necessary in a file full of 3D math functions. I know it was probably the fault of an autoformatter they used, but I was still the most offended I've ever been at a pull request.

[–] rockerface@lemm.ee 29 points 7 months ago

Autoformatter? More like obfuscator

[–] MotoAsh@lemmy.world 9 points 7 months ago

I genuinely hate being human for this stuff. So many things have such crazy computational shortcuts, it's sometimes difficult to remember which part represents reality. Outside of the realm of math, where "imaginary" numbers are still a touch of enigma to me, so many algorithms are based on general assumptions about reality or the specific task, that the programmatic approach NEVER encapsulates the full scope of the problem.

As in, sometimes if you know EXACTLY how a tool works, you might still have no idea about the significance of that tool. Even in a universe where no one is lazy, and everyone wants to know "why?", the answers are NOT forthcoming.

load more comments (3 replies)
[–] unexposedhazard@discuss.tchncs.de 29 points 7 months ago

Also works if you dont trust yourself with correctly ordering your operations.

[–] mathic@lemmy.world 29 points 7 months ago (1 children)

I, my head, shake.

  • RPN user
[–] rockerface@lemm.ee 6 points 7 months ago

Also known as: Japanese speaker

[–] ASeriesOfPoorChoices@lemmy.world 24 points 7 months ago (1 children)
load more comments (1 replies)
[–] Qkall@lemmy.ml 23 points 7 months ago (6 children)
load more comments (6 replies)
[–] Omega_Haxors@lemmy.ml 19 points 7 months ago* (last edited 7 months ago) (2 children)

(I used(LISP)one time(and it(permanently))changed the way I (program(computers)))

load more comments (2 replies)
[–] SmoothLiquidation@lemmy.world 17 points 7 months ago (2 children)

This is why every calculator should be a RPN calculator.

[–] lemmyng@lemmy.ca 5 points 7 months ago

I still have my HP 48 series calculator. It's a sturdy beast.

load more comments (1 replies)
[–] MeDuViNoX@sh.itjust.works 11 points 7 months ago (1 children)

( . ) ( . ) ( . Y . )

[–] Voyajer@lemmy.world 11 points 7 months ago

Improved readability is always good

[–] MotoAsh@lemmy.world 11 points 7 months ago* (last edited 7 months ago) (10 children)

The underlying truth of this joke is: Programming syntax is less confusing than mathematical syntax. There are genuinely ambiguous layouts of syntax in math (to a human reader that hasn't internalized PEMDAS, anyways) whereas you get a compilation error if ANYTHING is ambiguous in programming. (yes, I am WELL aware of the frustrations of runtime errors)

[–] DragonTypeWyvern@literature.cafe 7 points 7 months ago (12 children)

Internalized PEMDAS without knowing it's literally the same thing as BODMAS is exactly the problem!

load more comments (12 replies)
load more comments (9 replies)
[–] FatTony@lemmy.world 7 points 7 months ago* (last edited 7 months ago) (4 children)

My calculator says -2² = -4, so yeah...

[–] ByGourou@sh.itjust.works 7 points 7 months ago (5 children)

Isn't the "-" order of operations the same as a multiply ? I think I learned powers take priority over the "-" so your calculator would be right.
But either way if it can cause confusion you should use parentheses.

load more comments (5 replies)
load more comments (3 replies)
[–] Lemmy_Cook@lemmy.world 5 points 7 months ago

I feel this in my bones

[–] lolcatnip@reddthat.com 5 points 7 months ago* (last edited 7 months ago) (3 children)

I've never seen a calculator that had bracket keys but didn't implement the conventional order of operations.

But anyway, I'm on Team RPN.

[–] isolatedscotch@discuss.tchncs.de 9 points 7 months ago (1 children)

my dumb ass reading this: "Team rock paper nscissors"

load more comments (1 replies)
load more comments (1 replies)
[–] ooli@lemmy.world 5 points 7 months ago (1 children)

I just used the calc on window.. it cannot respect order of operation. Any simple calculator from 1980 was better than that

load more comments (1 replies)
[–] EunieIsTheBus@feddit.de 4 points 7 months ago* (last edited 7 months ago) (1 children)

I recall that there is a myriad of memes of the form 'what is 4-2*3' under which there is always a never ending discussion of confidently incorrect dumbasses denying the existence of the multiplication before addition rule.

So your suspicion is at least not unreasonable

load more comments (1 replies)
load more comments
view more: next ›