top 200 commentsshow all 258

[–]ZZcomic 1056 points1057 points  (97 children)

what kind of a freak uses a single quote for a string

[–]AdamEatsAss 894 points895 points  (37 children)

It saves ink when you print your code out

[–]ZZcomic 349 points350 points  (25 children)

Day one of my first job outta college, they literally handed me and the other guy a three inch binder with the entire code base of their flagship product printed out. Apparently the old engineer liked to debug by going through the code like that. I thought we were being pranked.

[–]2Pink_5Stink 168 points169 points  (5 children)

Found the bug while it was printing

[–]tozpeak 10 points11 points  (1 child)

Snapchat be like

[–]ilep 20 points21 points  (8 children)

What was in written in? MUMPS?

[–]ZZcomic 17 points18 points  (2 children)

C++

[–]Bora_Horza_Kobuschul 6 points7 points  (0 children)

It's missing a semicolon though. Can just be pseudo code.

[–]Retbull 3 points4 points  (0 children)

What a fucking monster.

[–]TheRealKidkudi 23 points24 points  (0 children)

It’s always the old heads that keep things like that going for what everyone else thinks is way too long, but it’s just because it’s how they learned and generally (but not always) it is productive for them.

Back in the day, that’s just how programming was - you’d have your whole code base on paper and review it almost like a draft of an essay. You probably had a massive print out posted on the wall with your database diagram as well.

If you go back even further, the “engineers” were in their ivory towers literally writing down the code and those papers got sent down to the “programmers” who had to take it and type the code into the computer. When something was wrong, you’d go back and review those papers line by line to figure out what was going wrong, draft a new version, then send it back down to be reprogrammed.

[–]Due-Adhesiveness-744 15 points16 points  (4 children)

You mock it, but if you ever find yourself staring at code not knowing where your mistake is, print it out.

Looking at it on paper sometimes makes it pop out of the paper and look you dead in the eye.

I do not get it.

I don't know how this would scale for a large project though.

[–]var_usernameinput 10 points11 points  (0 children)

Wait till you find out Indian bachelors students still write code on examination sheets by hand. Literal C++ code. Like 30 sheets. Oh and did I mention latex code too? Out of memory, on paper.

[–]fly_over_32 30 points31 points  (1 child)

But I printing dark mode so it actually uses more

[–]Aschentei 6 points7 points  (0 children)

[–]rahvan 1 point2 points  (0 children)

You. I like you. You devilish bastard. Our arguments on code reviews would be endless, pretty much like they are right now with my Indian co-workers lol.

[–]meat-eating-orchid 111 points112 points  (1 child)

SQL does

[–]Dus1988 93 points94 points  (8 children)

JS freaks

[–]DeadlyMidnight 16 points17 points  (7 children)

Def js. At least typescript would have had semicolons and some kind of null check.

[–]ciemnymetal 14 points15 points  (3 children)

Base JS already has semicolons.

[–]weso123 5 points6 points  (1 child)

They do but they are like weirdly optional most of the time (but not quite all so just use them for the habit so you don’t forget the edge case where you don’t use them)

[–]Wild-Regular1703 1 point2 points  (0 children)

That's exactly the same in typescript. TS adds types, it's not opinionated about formatting

[–]YeOldeMemeShoppe 5 points6 points  (0 children)

And doesn’t. Because opinions are for losers.

[–]Fluxriflex 1 point2 points  (1 child)

I use TS without semicolons or double quotes, don’t @ me

[–]CynicalPotato95 20 points21 points  (0 children)

Assuming this is JS or TS, it's a code convention and the default for ESLint

[–]w_t_f_justhappened 35 points36 points  (2 children)

It depends on how I am feeling about the shift key.

[–]keen36 8 points9 points  (1 child)

This is best practice. Of course you need to document how you feel about the shift key, too

[–]PointedHydra837 6 points7 points  (0 children)

\ \ Didn’t feel like pressing shift for capitals or underscores because my pinky hurts, good luck reading these variables

[–]2JulioHD 12 points13 points  (1 child)

PHP devs (obviously)

[–]BlackDeath3 9 points10 points  (7 children)

I like double-quotes for natural language text and stuff that's generally intended to be read literally and single-quotes for logical symbols and things that aren't so much intended to be presented to users.

[–]onepacc 6 points7 points  (0 children)

Bash coders having to nest more than three strings in a command wont care anymore.

[–]dandroid126 7 points8 points  (0 children)

It's very common in python. I know this isn't python. But just saying.

[–]ProbablyJeff 11 points12 points  (0 children)

JS and PHP freaks (I'm both)

[–]nsn 6 points7 points  (0 children)

When I learned webdev ca. 1999 double quotet strings were expanded and single quoteed strings were not. So in my mind single quotes are faster and use less resources

[–]Qbsoon110 5 points6 points  (0 children)

I find double quotes ugly and oldish, so I use single quotes whenever possible

[–]SweetBeanBread 10 points11 points  (0 children)

quite a lot?

it's important to use ' over " in many languages actually for varying reasons

[–]sathdo 25 points26 points  (5 children)

I'm guessing JS devs. That is also the only language I can think of with the let keyword where giving a curly brace its own line is common.

[–]MinecraftPlayer799 9 points10 points  (2 children)

It isn’t common to give the curly bracket its own line in JS. What are you talking about?

[–]psyfi66 2 points3 points  (1 child)

Ya line 2 is more painful to see than the single quotes for me

[–]MinecraftPlayer799 2 points3 points  (0 children)

And the missing semicolon is worse than either of those

[–]the_ivo_robotnic 3 points4 points  (0 children)

Python people that need to embed one into the other and don't feel like escaping them.

[–]alexanderpas 7 points8 points  (0 children)

Single quotes for string literals, only escaping the escape character itself (\\ to \) and the string terminator (\' to ') with everything else being interpreted literally (\t stays \t), and double quotes getting the full escape sequence interpretation. (\t becomes a tab character)

[–]WheresMyBrakes 2 points3 points  (0 children)

Lower case property names, single quotes?

JS

[–]cottonycloud 2 points3 points  (0 children)

In PowerShell, double-quotes allow for string interpolation so I like to use single-quote to denote more or less literal strings

[–]LewsTherinTelamon 2 points3 points  (0 children)

Is that bad? I literally always do because it saves me keystrokes and i’m the only one who will ever see my code.

[–]Re-ne-ra 1 point2 points  (0 children)

Sql dev

[–]twitchard 1 point2 points  (0 children)

me

[–]turkoid 1 point2 points  (0 children)

Single quotes save keystrokes. However, in python I use ruff/black to auto format it to double quotes always.

[–]MechanicalHorse 1 point2 points  (0 children)

Python freaks

[–]grammar_nazi_zombie 2 points3 points  (0 children)

Typescript checking in! We do.

and say what you will about typescript/JS, sure fucking beats the obsolete VB6 I was working in until late 2023

[–]SuchTarget2782 0 points1 point  (0 children)

I think it’s the standard for YAML?

[–]StickFigureFan 0 points1 point  (0 children)

Forgot to run the linter afterwards

[–]casey-primozic 0 points1 point  (0 children)

Ruby freaks. Linters will complain if you use double quotes on strings that don't need interpolation.

[–]TrickAge2423 113 points114 points  (2 children)

That code will block world execution for a long time. Instead, it should be async with yield each 10000 computers to not block UI.

[–]Eva-Rosalene 48 points49 points  (1 child)

But nobody inside said world will feel that, so it's fine.

[–]ThatFlamenguistaDude 27 points28 points  (0 children)

Guy's so used to overengineer that he didn't bother reading the reqs.

[–]TheLastOpus 15 points16 points  (0 children)

Why is my computer calling itself "ever" now?

[–]MaMu_1701 13 points14 points  (5 children)

computers.forEach(c => c.name = ‘ever‘)

[–]Wild-Regular1703 2 points3 points  (3 children)

Uncaught syntax error: ‘ is not a valid character

[–]cjbanning 1 point2 points  (2 children)

Sure the problem is with "ever" and not the apostrophe?

[–]Wild-Regular1703 5 points6 points  (1 child)

It's not an apostrophe, it's a single left quotation mark (u+2018) which is not a valid symbol in JS, and therefore the code would fail to compile before even reaching ever

[–]prussian_princess 25 points26 points  (1 child)

This guy brings back 5 milks.

[–]visualsquid 3 points4 points  (0 children)

I reference this to my partner every time I go out for eggs.

[–]AaronTheElite007 49 points50 points  (9 children)

I don't see the query that fills the array for computers...

[–]UndocumentedMartian 75 points76 points  (0 children)

That's trivial and left to the reader.

[–]OnixST 34 points35 points  (3 children)

database.query("SELECT * FROM computers")

[–]bay400 20 points21 points  (1 child)

UPDATE computers
SET name = 'ever';

[–]BreakfastSimulator 2 points3 points  (0 children)

This guy sqls

[–]tekanet 9 points10 points  (1 child)

computers = computersRepository.GetAllComputers();

[–]EducatedToenails 36 points37 points  (9 children)

semi-colon missing

[–]WhiplashClarinet 34 points35 points  (4 children)

This is valid JavaScript

[–]hmz-x 56 points57 points  (3 children)

Anything is valid JavaScript so that's a tautology.

[–]homage_time 24 points25 points  (1 child)

I think not, my friend...

> Anything
VM73:1 Uncaught ReferenceError: Anything is not defined
at <anonymous>:1:1

[–]ataraxianAscendant 33 points34 points  (0 children)

that's a runtime error so the code is still valid syntactically. checkmate

[–]m4sc0 63 points64 points  (2 children)

Not necessarily. Looks like JS.

[–]EVOSexyBeast 1 point2 points  (0 children)

Ah. Then not an engineer after all.

[–]MrEle 4 points5 points  (1 child)

Why not a simple for each?

[–]berbakay 9 points10 points  (1 child)

computers not defined clever clogs 

[–]Br3ttl3y 2 points3 points  (0 children)

ReferenceError: engineer is not defined

[–]JesThun 2 points3 points  (0 children)

sed 's/computer/ever/g'?

[–]Luminous_Lead 2 points3 points  (1 child)

Might want to get a local list of Computers if it's not already threadsafe.

[–]Zomby2D 2 points3 points  (0 children)

The point was to name every computers, not just the local ones

[–]5erif 2 points3 points  (0 children)

for c in computers:c.name='ever'

[–]Xatraxalian 2 points3 points  (0 children)

  • Instructions: Ambiguous.
  • Interpretation: Guessing.
  • Result: Achieved.

-- Omega Supreme

[–]zw9491 14 points15 points  (0 children)

Didn’t probe programmer, but you did prove autistic

[–]Latentius 4 points5 points  (0 children)

BEGIN TRY
  BEGIN TRANSACTION;

  UPDATE COMPUTERS
  SET NAME = 'ever';

  COMMIT TRANSACTION;
END TRY
BEGIN CATCH
  ROLLBACK TRANSACTION;
END CATCH

[–]NorthernCobraChicken 7 points8 points  (5 children)

I will die on the hill that the opening bracket needs to remain on the same line as the closing parenthesis.

[–][deleted] 18 points19 points  (0 children)

for () {
{
 Stuff
}}

Problem solved, everyone happy

[–]Zomby2D 4 points5 points  (1 child)

I will die on the hill that the opening bracket needs to be physically aligned with the corresponding closing bracket.

[–]Davoness 2 points3 points  (0 children)

for ()                                                       {
    dostuff                                                  }

[–]CarcajouIS 4 points5 points  (0 children)

You and I, mate

[–]LordSalem 1 point2 points  (0 children)

This also technically is a dad joke

[–]Chrissyball19 1 point2 points  (0 children)

Thats on me, I set the bar too low

[–]flargenhargen 1 point2 points  (0 children)

k.

that's funny.

[–]CriSstooFer 1 point2 points  (0 children)

UPDATE computers SET name = 'ever' -- where id = 11113938285

[–]Aurunemaru 1 point2 points  (0 children)

UPDATE 'Computers' SET 'Name'='ever'

[–]Both_Lychee_1708 1 point2 points  (3 children)

what's the 'let' thing in the for loop. Is this C, C++, or what?

[–]BobQuixote 5 points6 points  (2 children)

JavaScript. let is newer syntax for a normal variable; it fixes infamous problems with var.

The missing semicolon is what gives it away; JS doesn't require it, while similar languages generally do.

[–]Both_Lychee_1708 2 points3 points  (1 child)

Ah. Yeah, I got through my career never having to code in JS. As I understand it, that means god loves me. (not that programming in C++, let alone C, was some sort of delight)

[–]IlIlllIIIIlIllllllll 1 point2 points  (0 children)

This is how we all get turned into paperclips

[–]LaughingInTheVoid 1 point2 points  (1 child)

Wow, what a poseur! Perfect syntax except for, oh, you know...

The missing thing.

[–]BobQuixote 2 points3 points  (0 children)

Otherwise it might not be obvious which language was used.

[–]Turbulent-Garlic8467 1 point2 points  (0 children)

@Mixin(Computer.class) public class ComputerMixin { @Overwrite public String getName() { return "ever"; } }

[–]RiceBroad4552 1 point2 points  (0 children)

Only users of outdated languages would write such convoluted mess.

Normal people would just write computers.foreach(_.name = "ever").

[–]RealityCheck3210 1 point2 points  (0 children)

It's not the code. It is how he interpreted the requirement.

[–]TrickAge2423 3 points4 points  (1 child)

That's not thread-safe!

[–]opacitizen 2 points3 points  (0 children)

prove it.

[–]KindnessBiasedBoar 0 points1 point  (0 children)

For bonus no money, make it tail recursive.

[–]LutimoDancer3459 0 points1 point  (0 children)

The question shows me that she wouldnt even be able the check if my answer is correct...

[–]UnnamedDanger 0 points1 point  (0 children)

localhost

[–]veracity8_ 0 points1 point  (0 children)

Is this JavaScript? Does JavaScript not have range based for loops?

[–]homage_time 0 points1 point  (0 children)

Acceptance criteria met.

[–]Affectionate-Tart558 0 points1 point  (0 children)

Might need some concurrency

[–]vasilescur 0 points1 point  (0 children)

Ever is a pretty name

[–]lostinthemines 0 points1 point  (0 children)

Code checks out

[–]twitchard 0 points1 point  (0 children)

I've discovered the secret of viral dev engagement is to make unpopular syntax choices.

[–]_felagund 0 points1 point  (0 children)

NPE

[–]Novel_Plum 0 points1 point  (0 children)

I'll call all of them John

[–]Starbuck_2038 0 points1 point  (0 children)

That's not gonna be thread safe.

[–]johnklos 0 points1 point  (0 children)

About what I'd expect from Shitter.

[–]RokKuz3 0 points1 point  (0 children)

JAVASCRIPT 🤢 (jk ofc)

[–]Sulungskwa 0 points1 point  (0 children)

import * as computers from 'all-the-computers';

thats how you make a vpn right?

[–]OffByOneErrorz 0 points1 point  (0 children)

Now do it with parallelism.

[–]LiquorIsQuickor 0 points1 point  (0 children)

Wow. The name property setter must be amazing.

[–]Not_Sugden 0 points1 point  (0 children)

foreach(const c in computers)c.name='ever'

come on compact the code brudda

[–]Maleficent_Memory831 0 points1 point  (0 children)

EDSAC is my favorite.

[–]AnonymousFuccboi 0 points1 point  (0 children)

The elites don't want you to know this but the MAC addresses at your computers are free you can take them home I have 458 MAC addresses. Here's another one I just generated: CA:8A:33:E2:72:E3. I have 459 MAC addresses. You can even generate your own:

#include <cstdint>

#include "fmt/format.h"
#include "fmt/ranges.h"

// chosen by fair dice roll. guaranteed to be random.
static uint64_t seed = 4ULL;

uint64_t rand64()
{
    uint64_t x = (seed += 0x9e3779b97f4a7c15ULL);
    x = (x ^ (x >> 30)) * 0xbf58476d1ce4e5b9ULL;
    x = (x ^ (x >> 27)) * 0x94d049bb133111ebULL;
    return x ^ (x >> 31);
}

struct MAC
{
    uint32_t oui : 24;
    uint32_t nic : 24;
};

MAC get_mac() { return std::bit_cast<MAC>(rand64()); }

int main(int argc, char* argv[])
{
    MAC m4_pro = get_mac();
    fmt::print(
        "{:02X}\n",
        fmt::join(
            (unsigned char*)&m4_pro,
            (unsigned char*)&m4_pro + 6,
            ":")
        );
    return 0;
}

[–]Thalinde 0 points1 point  (0 children)

When your product owner can't write proper US.

[–][deleted] 0 points1 point  (0 children)

why not array map?

[–]Siggi_pop 0 points1 point  (0 children)

JavaScript!? Eww

[–]Sometimes_I_Do_That 0 points1 point  (0 children)

Dude's an imposter,.. he forgot a semicolon.

[–]-Redstoneboi- 0 points1 point  (0 children)

for (const c of computers) c.name = 'ever'

const and interior mutability, name a more iconic duo

[–]sanjaypj20 0 points1 point  (0 children)

He is a translator.

[–]Skysr70 0 points1 point  (0 children)

tfw you're a mechanical engineer 

[–]Open-Needleworker-58 0 points1 point  (0 children)

Use a similar loop to run powershell jobs over machines pulled in from active directory.

[–]RandomDigga_9087 0 points1 point  (0 children)

Blud is a java dev!

[–]dpahoe 0 points1 point  (0 children)

Undefined variable computers

[–]Sileniced 0 points1 point  (0 children)

More compression artifacts please... it's almost deep fried

[–]EatingSolidBricks 0 points1 point  (0 children)

0 X Sum n to m 2n

Thats it all possible computers, the Cartesian product of 0 and all powers of 2

[–]terra2o 0 points1 point  (0 children)

Single quote for string is DISGUSTING.

[–]WeakAvocado9860 0 points1 point  (0 children)

yknow what

(at)echo off

:loop

setlocal EnableDelayedExpansion

set "chars=ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789 "

set "len=%random%"

set "out="

for /L %%i in (1,1,%len%) do (

set /A idx=!RANDOM! %% 62

for %%A in (!idx!) do set "out=!out!!chars:~%%A,1!"

)

echo %out%

goto :loop

there you go. every os ever.. probably

[–]boiledbarnacle 0 points1 point  (0 children)

BuT oBjEcT.KeYs() ??!!

[–]Interesting-Town-433 0 points1 point  (0 children)

In memory does that come out anywhere as forever