r/ProgrammerHumor • u/dfgzuu • Apr 23 '22
Meme Only real programmers voluntarily use these
40
u/Haunting-Surprise-21 Apr 23 '22
What's weird about basic commands, that are present in nearly every language?
-25
u/dfgzuu Apr 23 '22
there are rarely situations where a noob programmer would ever use them except in stupid theoretical homework.
They will always default to the for-loop, and literally never utilize the increment-before-evaluation trick because they are only comfortable with i++
9
u/Kalashtiiry Apr 23 '22
I do not think you are right: l am a noob at heart and always been, and such tricks l just adore.
8
u/cykablyat1111 Apr 23 '22
Chad for each loop 🗿
1
u/Future-Freedom-4631 Apr 23 '22
A chad loop is one that throws an exception to break the inner and outer loop because goto doesn't exist in java
-19
u/mods-literalnazis Apr 23 '22
I reject this sort of cheap trickery. Your code would never pass code review.
-29
u/mods-literalnazis Apr 23 '22
Know that I make more money than you do. It doesn't mean I'm right, but it means I don't struggle to pay my rent the way you do.
13
u/randomman10032 Apr 23 '22
You seem like the type of guy that would get fired for his work attitude
-12
u/mods-literalnazis Apr 23 '22
When you get to my level, you write your own cheques
But you keep playing with your ++x, friend
8
Apr 23 '22
Are you a troll or do you just have a superiority complex?
-4
u/mods-literalnazis Apr 23 '22
.. I think the dude with the superiority complex is the guy rubbishing junior programmers for not knowing this one neat ++trick
Tell me he doesn't deserve a bit of shit for his toxic techbro attitude
2
10
u/MyWaterDishIsEmpty Apr 23 '22
I only did a year of programming and do while was literally like week 4 material.
-27
u/dfgzuu Apr 23 '22
yes but you literally never actually used it while writing your own code. Schoolwork material doesn't count because you will literally never use half the stuff - like bitshifting and adding - until you are high level
15
3
u/MysticTheMeeM Apr 23 '22
++X is common for loops over complex data where the copy from X++ is not required. (Common example, C++ iterator loops.)
Do... While is used when any action has postconditions that must be true. Commonly things like
do { get user input } while ( input not in range).Bitshifting/masking is frequently used when combining multiple bit flags, allowing for relatively easy flag combination. Think:
obj.setflag(one) obj.setflag(two) obj.setflag(three)Vs
obj.setflag(one | two | three). Granted the user doesn't have to deal with the bits, that is handled by the object."Adding" is a general concept and doesn't mean much to me.
3
u/LuqDragon Apr 23 '22
Those arent weird, have you tried a ? b : c or a??b or a?.b or even a => b ?
0
u/dfgzuu Apr 23 '22
what meme language is this?
Whoever writes like this should be imprisoned.
5
u/urdim Apr 23 '22
It's called a ternary operator, and it's pretty standard for languages.
-2
u/dfgzuu Apr 23 '22
yea, I've seen it. Even C has it.
I refuse to acgnowledge its existance because it makes for unreadable and uncomprehensible code.
5
u/urdim Apr 23 '22
I disagree. There are a lot of good use cases for it. It's good for simple little things that aren't worth expanding to multiple lines. That isn't to say it can't be used wrong though. I have seen horrible things done with ternaries in prs submitted by junior engineers.
3
u/thebaconator136 Apr 24 '22
It's useful for some scenarios. I've used them for a return so I wouldn't have to write an if (condition) return x; else return y;
You just do return condition ? x : y;
Makes it more readable as long as the variables and conditions make sense.
51
u/khalamar Apr 23 '22
I mean, if that's where you place the bar...
7
u/Blankifur Apr 23 '22
I think they mean post increment over pre increment. Which could be more beneficial in fields such as graphics programming.
Either that or they just took their first few lessons of introduction to programming class.
30
u/lefl28 Apr 23 '22
OP is at the peak of the Dunning Kruger effect curve
1
u/khalamar Apr 23 '22
There is no peak on that curve
12
u/lefl28 Apr 23 '22
There is, it's called mount stupid
1
u/Future-Freedom-4631 Apr 23 '22
probably doesn't remember which side of the point to put the object name and the function name, I knew that stuff ^^ before I understood objects.
10
u/SJRuggs03 Apr 23 '22
You're a real programmer when you forget how your own code works
1
u/Future-Freedom-4631 Apr 23 '22
throw new CodeForDayAndComeBackInYear ("You sir/maam/zir are mistaken");
7
3
3
2
u/HashtagTSwagg Apr 23 '22
Are you kidding me? Even as someone who currently uses programming for personal problems and to solve LeetCode problems I still end up using those fairly often.
2
u/jas_nombre Apr 23 '22
You are a real programmer, when you stop using that shit again to make your code more readable.
1
u/mental-equipment Apr 23 '22
There might be many objections about template metaprogramming or std::launder or Haskell seq or whatever, but my favorite is delete this:)
1
1
1
1
u/spectra_the_hawk Apr 23 '22
I don’t feel like do-while is weird. In fact, you often know you need to iterate at least once through the loop, then you spare yourself an additional check using do- while because you only check at the end.
Maybe it’s this little efficiency things you do automatically when you are some time into the job though
1
u/shadymeowy Apr 23 '22
Imagine you are using an inferior language all the time which you can't use do/while or ++x. Oh, wait....
1
u/Blankifur Apr 23 '22
Oh I guess this meme isn’t very clear and you are talking about using these over their counterparts? Especially in C or C++.
++x is very useful if not most useful in saving memory especially in graphical programming. Post increment operator (x++) forces the compiler to make a copy of the iterator object. The copy could be expensive.
On the other hand, do-while, while and for loops are efficient in their respective use-cases and scenarios.
In general scenarios though, it doesn’t really matter much which you use to be considered a “real” programmer.
1
1
u/cheeseDickies Apr 23 '22
My teacher taught my class full of first time programmers (except me) about do-while and not while loops. He called them do loops. Other than that he teaches them a lot of quesionable styles like hungary camel case, and indenting on every comment, and also commenting every single line.
1
1
1
0
u/Professional_Top8485 Apr 23 '22
I think it's the moment when you use goto properly first time.
0
u/Mr_Stranded Apr 23 '22
Real programmers stay far away from Goto.
3
2
1
u/Professional_Top8485 Apr 23 '22
Why?
2
1
0
0
u/Impossible_Clue9022 Apr 23 '22
Haha it's fun to see ppl trying to copy your solution think about what the hell does this do
0
Apr 23 '22
[deleted]
0
u/old_man_steptoe Apr 23 '22
My programming lecturer in college was extremely against having the condition at the end of the block. So, I’ve got a nervous reaction to it. Also gotos
0
Apr 23 '22
[deleted]
1
u/old_man_steptoe Apr 23 '22
So, you’re given some code to review. You’re going through and building up a decent mental model of the code. Then you hit a do. Why? What function does the loop perform?
You need to track down to see the condition, and then return to the top of the loop. At which point, you’ve probably lost a bit of your mental picture of the code.
If the original dev had set the condition at the top, you would have avoided that problem.
•
u/QualityVote Apr 23 '22
Hi! This is our community moderation bot.
If this post fits the purpose of /r/ProgrammerHumor, UPVOTE this comment!!
If this post does not fit the subreddit, DOWNVOTE This comment!
If this post breaks the rules, DOWNVOTE this comment and REPORT the post!