r/ProgrammerHumor • • Mar 15 '19

My experience with programming so far..

https://i.imgur.com/rQIb4Vw.gifv
4.0k Upvotes

81 comments sorted by

312

u/Oxdefac8 Mar 15 '19

truth

101

u/randomentity1 Mar 15 '19

truth++

2

u/[deleted] Mar 15 '19

(select * from truth_table where value="truth" ' or 1=1) ''=' --

0

u/[deleted] Mar 15 '19

[deleted]

50

u/Oxdefac8 Mar 15 '19

*(&truth)++

30

u/haackedc Mar 15 '19

truth = truth + 1

31

u/[deleted] Mar 15 '19

truth += 1

29

u/KungFu_CutMan Mar 15 '19

truth = truth + (truth/truth)

19

u/weetabix_gryphon Mar 15 '19

bool truth = true;

4

u/shipwreckedonalake Mar 15 '19

truths.Single(thruth => truth is Objective)

2

u/Ceros007 Mar 15 '19

int wut=truth; While(truth != wut+1) { truth = truth+(int)true; }

→ More replies (0)

1

u/trimetric Mar 15 '19

truth |= truth

1

u/Schm0ker Mar 15 '19

cries in VBA

11

u/MattieShoes Mar 15 '19

*(&truth)++

That won't work...

(*(&truth))++

That will though.

9

u/ramsay1 Mar 15 '19

this = abs(truth)

3

u/Icenomad Mar 15 '19

This is like a combo of ruby and js, I think you mean't:

this = Math.abs(truth)

3

u/ramsay1 Mar 15 '19

Heard of C? Granted the missing semicolon maybe threw you off ;)

1

u/greenSixx Mar 15 '19

Bro, I write my own abs function that returns...things.

Works in any language!

176

u/NotYetiFamous Mar 15 '19

I was asked to audit code this week. I ended up auditting the vode, rewriting large parts of it and retraining the maintainers on standards. So much truth.

43

u/randomentity1 Mar 15 '19

I ended up auditting the vode

It was so bad it wasn't even code.

7

u/NotYetiFamous Mar 15 '19

Phone keyboards suck

3

u/[deleted] Mar 15 '19

That's why one should check their spelling.

-3

u/greenSixx Mar 15 '19

Standards: the excuse coders like you use to justify their job despite not actually doing any meaningful work.

Right?

There is always someone else who has standards that your code doesnt comply with.

4

u/sirreldar Mar 15 '19

Found the non-programmer

44

u/[deleted] Mar 15 '19

[removed] — view removed comment

14

u/NotYetiFamous Mar 15 '19

Or is it the best..? I get a strange sense of satisfaction from yak shaving.

80

u/diarewse Mar 15 '19

Yeah 😄 especially when I'm asked to fix code after my colleagues who didn't bother do a proper job first time around.

21

u/[deleted] Mar 15 '19

Go into embedded. Then you can fix the hardware guys fuckups too.

10

u/EddieJones6 Mar 15 '19

It gets super fun when the workaround for the hardware defect doesn't quite satisfy the requirements. Then its software's fault again.

4

u/DurianExecutioner Mar 15 '19

Hardware engineer here. If you guys didn't try to do stupid, inefficient things just because they're a required part of some API, we wouldn't have to go looking for corner cases and spec holes to hide bugs in. :P Why can't you keep things simple?

Like I get that you don't want performance to degrade by 50% on the fourth Tuesday of every month, but the spec never actually said that couldn't happen and besides we saved a whole four DFFs doing it this way.

2

u/EddieJones6 Mar 16 '19

You’re right. And no problem, we will just scatter some loops and degrade performance by 50% except for those days.

5

u/stuckinmotion Mar 15 '19

They probably wanted to do it right, but didn't have time for that. They had yet another sprint planning meeting to attend, or design review, or Janice's retirement party to smile and wave at. Or surprise bugs jumped out at them from the last time someone whipped some code together to keep the burndown chart happy. And so the cycle continues..

2

u/pagraphdrux Mar 15 '19

Ugh this hits me in the soul.

57

u/[deleted] Mar 15 '19

[removed] — view removed comment

1

u/jiminiminimini Mar 15 '19

And sometimes the person whose bad code you've just fixed turns out to be the past-you.

30

u/The_Ty Mar 15 '19

This is so true.

So earlier this week I was developing a Wordpress plugin which uses the WooCommerce REST API.

Except WooCommerce wouldn't generate API keys properly, I can't view them. Turns out this was caused by the main plugin file generating "unexpected characters".

This in turn was caused by me using <script> in the main plugin php file (using echo), because I needed to pass a PHP Wordpress function/value onto javascript, to properly navigate the plugin directory to load a json file.

To fix that, I had to find an alternate way of passing the PHP function/value onto javascript, which then fixed all the above.

And the best part was I couldn't find a single solution for the "unexpected characters" issue, so it took me 4 hours to narrow the problem down.

0

u/greenSixx Mar 15 '19

Nothing you said makes sense.

This api isnt a standard api? I must just be web centric. Its either oauth, custom authorization, maybe a cli api? Would you call running an executable from command like an api?

You had to inject javascript into the api to navigate the plugins files to find some file with json in it?

Main plugin file....?

You sure its not just your newline chars? Like your ide changed linux newline to windows?

Nothing you say makes sense.

What sort of plugin, php plugin, will eval javascript and run it?

You are making huge assumptions and not sharing them with us. Makes it hard to understand.

1

u/The_Ty Mar 15 '19 edited Mar 15 '19

Yes main plugin file. As in the plugin which matches the folder name, that wordpress look at first

It sounds like you're just confused for no reason. Which is understandable if you haven't worked with WordPress plugins (which is specifically what I was referring to)

You can run javascript in a php file by using echo (like I said) to write <script> tags as you would in normal html

Like:

Echo '

<script> Var root_url ="'.echo plugin_dir_path().'" </script>

';

Cant remember the exact wordpress function I used but the above is how I did it (at first)

(Edit: Never mind, based off your post history you're just a contrarian, I assumed you were acting in good faith)

13

u/oupablo Mar 15 '19

And that's just your own code. Better hope you never inherit an old application.

2

u/Catthew918 Mar 15 '19

This. I've inherited a nice tangle at the job I started 3 months ago. I still shake my head while I'm clicking around looking for the one thing I need.

2

u/greenSixx Mar 15 '19

Different doesnt == worse

10

u/prabh321 Mar 15 '19

Truth Has Been Spoken

10

u/fabsch412 Mar 15 '19

Waited for the light bulb to turn on when he tries to fix something else

14

u/Nihilist_T21 Mar 15 '19

Youtube clip of it: https://youtu.be/AbSehcT19u0

2

u/[deleted] Mar 15 '19

Wow, thanks :) I actually came to the comments only to look for this

7

u/[deleted] Mar 15 '19

Every day at the office is like this.

6

u/[deleted] Mar 15 '19

It's so sexy that Hal has so many skills.

5

u/leonard_face Mar 15 '19

“Hal, could you replace the lightbulb in the kitchen?”

“I’m sorry Dave, I’m afraid I can’t do that.”

5

u/CosmackMagus Mar 15 '19

I've sent this to my boss before when asked as to why something wasnt done

4

u/HDmac Mar 15 '19

My boss: that button still has the wrong text in it, what have you been doing?! Me: ...

0

u/greenSixx Mar 15 '19

Fix what is visible to the person who decides your worth.

Wtf

4

u/[deleted] Mar 15 '19

Best repost

4

u/[deleted] Mar 15 '19

Would be great to see someone make the effort, get a high quality version and put proper relevant text on it.

Well it's not going to be me.

4

u/code_monkey_001 Mar 15 '19

Ah, I remember my days as a maintenance developer. It's like being an auto mechanic, finding a piece of baiing wire wrapped around the alternator of a car, and untwisting it because you have no idea why it's there. Then you hear the clang as the rear axle falls off the vehicle.

3

u/ITrollRedditEveryDay Mar 15 '19

a function in a function in a function in a funct.... WHAT DOES IT LOOK LIKE IM DOING HERE

1

u/greenSixx Mar 15 '19

..... closures

3

u/willem640 Mar 15 '19

The worst part is that it's true

3

u/LukyLuke32 Mar 15 '19

I feel personally attacked. This is not ok.

1

u/trin456 Mar 15 '19

I do not. I just think that is what happens when I use someone else's code

3

u/Secondsemblance Mar 15 '19

The technical term is "yak shaving."

2

u/[deleted] Mar 15 '19

me playing sandbox games (but forgetting about half of the stuff to do anyway)

2

u/huggiesdsc Mar 15 '19

This is what playing runescape is like

2

u/ajx_711 Mar 15 '19

Building something from source

•

u/XXAligatorXx Mar 15 '19

Your submission has been removed.

Rule[2] violation.

Rule[2]: All posts that have been on the first 2 pages of trending posts within the last six months, is part of the top of all time, or is part of common posts is considered repost and will be removed on sight.

If you feel that it has been removed in error, please message us so that we may review it.

4

u/Rrxb2 Mar 15 '19

Ouch. First time I saw this one. Guess I’ll check out the ToAT now.

1

u/mrshampoo Mar 15 '19

My daily life, send help.

1

u/[deleted] Mar 15 '19

Only few have found the exit of this impossible maze

1

u/greenSixx Mar 15 '19

You know what the best part about good enough is right?

Its that it is good enough

1

u/Hakiby Mar 15 '19

More like you change the light bulb and now your house is gone

36

u/[deleted] Mar 15 '19

[removed] — view removed comment

12

u/manfrommtl Mar 15 '19

Legacy Code 101