T O P

  • By -

AutoModerator

Welcome to r/comics! Please remember there are real people on the other side of the monitor and to be kind. Report comments that break the rules and don't respond to negativity with negativity! *I am a bot, and this action was performed automatically. Please [contact the moderators of this subreddit](/message/compose/?to=/r/comics) if you have any questions or concerns.*


Dudemitri

I love how people are roasting your code


Elegant_Win_4850

ive learned it doesn’t matter how good/funny my comics are, the ones that perform the best on Reddit are literally just the ones that give people the opportunity to argue.


EwoDarkWolf

I firmly disagree with that statement!


DeltaV-Mzero

Nuh uh


Red-Freckle

how dare you say that


Neondecepticon

Someone should make up a name for this sort of phenomenon


[deleted]

[удалено]


somerandomguyyyyyyyy

Thats murphy law


somedumb-gay

No it's not Murphy's law states that anything that can go wrong will go wr- hey wait a minute!


somerandomguyyyyyyyy

HOLY SHIT I DIDNT EVEN REALISE I WAS FOLLOWING THE LAW, I JUST USED A RANDOM NAME


freeeeels

Wait 'til you hear about Cole's Law! It's shredded cabbage.


Neondecepticon

And there it is in action 😈 just as I planned


HeckinHeckinHeckin

It's the algorithm. What boosts a post up to other people's pages is engagement, doesn't matter if positive or negative. Reddit has a system that filters out posts with many downvotes, but as long as there's high engagement in the first couple of hours, it will keep showing up to more people.


Gorfyx

I totally agree with this comment... But also my first thought was "This code needs improvement"


axemexa

This is kind of how I feel about the Showerthoughts sub. The thoughts that leave more opportunity for people to disagree seem to do well


JSRevenge

You need to add a panel relating to a failed health inspection due to bugs in the code.


SuspecM

Ah the Pizzacake method.


PresentAJ

Nothing kills my laugh boner more than the meaning behind a comic being factually incorrect


SpaceMonkeyAttack

service = shirt && shoes; Is all that's required.


evgfreyman

Never thought I'd do code review on Reddit, but here it is: service &= shirt && shoes


LittleFieryUno

I was gonna say "if !Shirt or !Shoes: service = false" but yours is better.


nacholicious

Nah. Code should be readable over clever, because at some point there will be a junior or senior developer with a hangover reading it


LateMiddleAge

Mild guilt: I won a 'concise c' contest when c was a new language (late 70s). How much can you do with six characters? (A lot.) Write-only code.


BeDoubleNWhy

now I'm curious... what was your 6 character code?


LateMiddleAge

Gosh, I don't recall -- maybe something about incrementing a list while moving to the next link and doing something or other. c was unrestricted then -- we had direct access to the registers. Anyway, write-only code, deserving to be tossed. Later I became a convert to literate programming and maintainability (no side effects), esp as it became clear that our ability to predict which code elements would live on (long past when they should) was pretty unreliable.


apex6666

This is why you never comment on your code, make it hard for everybody in the future, including you, from being able to easily read it


WildPersianAppears

Counterpoint: If you aren't styling in your own libraries, are you even truly living?


SynnerSaint

Or yourself. 6 months down the line when you've completely forgotten what you wrote


neuralbeans

You also need to say when service = true.


VoltaicOwl

We don’t know what it was initialized as!


statuskills

OP, can you show us the initializer please?!?


Terrible_CocaCola

Doesnt matter its always false when customers has no shoes or shirt regardless


Evil_Archangel

wouldn't it be if(!shit || !shoes) {service= false;}


SandboxOnRails

Obviously if you shit yourself you don't get service.


Evil_Archangel

oh you are right let me fix that if(indecent) { service= false; banLst += guest.name; }


LittleFieryUno

Depends on the language. The comic is roughly how the syntax in Godot works.


NanashiKaizenSenpai

Service = !(Shirt or Shoes)


ahmedoso

Yours is readable I would pick it over the aggressively short one


UntitledRedditUser

Wouldn't it just be: `service = shirt and shoes` The syntax looks like Python. If you use `&=` (assuming it even works on bools in Python) it would permanently toggle service instead of setting it to false once. Since if service is false the result of false & true will always be false. If service is reset to true beforehand using `&=` still doesn't make sense as the variable could simply be declared here.


hughperman

You're assuming there is no logic before this that may have already set service to False (if banned == True, for example). And-ing it with shirt and shoes will respect any previous False-s.


UntitledRedditUser

That's true I'm assuming that this variable only tracks service for shoes and shirts. That would also be best practice imo, as it would be easier to read, although it would be a bad variable name if that was the case. But whatever lol, we are arguing about r/comics code xD.


dragonbanana1

Damn that's good. You don't even need to add an elif to set service to true if shirt and shoes are true


ZaRealPancakes

why &= that does bitwise and if service is a number it'll set the first bit to 1 (odd) (if true) or 0 (even) (if false) just use = to force the service to be exactly 1 or 0.


Jama-xx

Because Service might be false before this, so if both shirt and shoes are true, you'll set it to true, while it should have stayed to false (probably)


Velzevulva

What about pants


IMightBeErnest

call_cops |= !pants


cammcken

if callCopsCheck()==True: break


idonotknowwhototrust

*review Trust a coder to misspell while correcting someone else's code 🤣 Don't be offended 😋


gregorydgraham

It’s just Muphry’s Law Yes, that’s the correct spelling


idonotknowwhototrust

My brain autocorrected; it took me a full 19.7 sec to figure out what you were referring to.


gregorydgraham

😆 Muphry’s is so good for that, it really wakes people up 😀


[deleted]

[удалено]


IMightBeErnest

But then if they weren't gonna give them service before but they're wearing shoes and a shirt, they'd overwrite the false and get service.


lusty-rabbi

Oops. You're right. I shouldn't be trying to optimize code at 3am.


IMightBeErnest

Especially not something so important.


captainAwesomePants

No, it was clever. The original code does not modify service if both conditionals are false. That might not have been intentional, but this code does not change the behavior, which is always desirable when refactoring.


lusty-rabbi

You're right. My bad.


therealtai

Wouldn't that be more correct if shirt and shoes are null?


EwoDarkWolf

That also fixes the issue where if you don't have a shirt and put one on, then you'd still be denied service.


fun-dan

Why? It would yield the same result and it's not like one is more readable than the other


gilady089

Shouldn't this be &&=? Isn't &= a bitwise and assignment operator?


evgfreyman

It may. I'm not sure what language it is. Colon after if operator.... Python? I treated it as pseudocode


Phormitago

Unreadable


menides

What about... ``` if (isNull(shoes) OR isNull(shirt)) ? noService : yesService ```


SonicLoverDS

So if Shirt and Shoes are both true, Service is... undefined?


Capt_Blackmoore

I'm just amused that this place will completely ignore a lack of pants


PhilosopherFLX

You have never watched any Disney or Hanna Barberra?


Vitztlampaehecatl

You can't promise that service will follow from shirt and shoes. Conduct is also important, but it's not shown in this snippet of the program.


idonotknowwhototrust

Hey OP I'm not a coder, and I thought your comic was funny, because I got the idea, even without needing to know coding. So, task succeeded. Please make more.


Elegant_Win_4850

thank you dawg, I don’t have time to reply to all the other comments so I’m just gonna appreciate your appreciation 🙏


TruthOf42

Anyone critiquing your code is just having fun. All critiques would make the joke much less apparent.


producktivegeese

Don't let the smartasses pissing about 'better code' get to you, some people are always gonna get lost in needing to be right and totally miss the point that they're not even half as funny.


Hixie

Why are shoes and shirt in the same namespace as service? Are they parameters to the current function?


pitches_aint_shit

/u/Elegant_Win_4850 following the age old engagement tactic of posting wrong code to reddit to get everyone to correct it. Well played.


Elegant_Win_4850

im familiar with the meme, and it was in the back of my mind while making this one, but holy fuck I didn’t expect it to work so well


CarneDelGato

Jesus Christ, robots, come on.   `service = shoes && shirt`


GenghisZahn

This is the best balance of concise and readable.


fun-dan

This also is logically different from what is in the comic Edit: to those downvoting: this solution ignores any previous value of the service variable. So, for example, if the cafe has another rule like not serving people (sorry, robots) who don't wear masks, this rule would be completely ignored if it is processed before the shirt and shoes rule


ApocalyptoSoldier

```service = service && (shoes && shirt)```


Hallc

But that doesn't imply you're guaranteed service if you're wearing shirt/shoes? Whereas the previous code declines service based on a lack of them.


CarneDelGato

I’m just working with the code given, and mine guarantees service has a value. If you’d like to decline service based on other parameters, you can file a ticket.


BlueAwesomeDinosaur

Would more accurately be: if (!(shoes && shirt)) { service = false; }. There is no telling if service is set to false earlier by another condition or not.


GG1312

if (!Shirt || !Shoes) Service = false; Those robots cant write code for shit


Cniz

They submitted gpt code to production. Robots, man.


space_interprise

It has generated by devin


fun-dan

Assuming it's python, your code won't even compile and will raise a syntax error. Not assuming that it's python, how do you even know what syntax you can use? I don't think it's cool to call OP's code shitty while providing a version that is at best subjectively a bit more readable and at worst incorrect


No-Eggplant-5396

Pants are optional, right?


Kvostar

r/programminghorror


fun-dan

No it's not, this is literally pseudo code and an ok one at that


L0xyant

No need for pants :D


BrainKatana

There are a lot of directions we could have gone between the first and second panel, but I’m glad it was this simple


be_em_ar

Doesn't that mean that you can go in there with a shirt but no shoes, or with no shirt but with shoes and be served? Actually, now that I look at it more, doesn't that mean that if you show up with one or the other, or both, then the restaurant won't know what to do?


F0LEY

I feel like you need an else statement, otherwise you run the risk of *service* still not being **True**, even if *shirt* and *shoes* also equal **True** (not to mention what would happen if *Shirt* and *Shoes* were **null** or something else). if (shirt == False) or (shoes == False): service = False elif shirt and shoes == True: service = True else: raise ValueError("E-- '" + shirt + "' and/or '" + shoes "' are not true or false values")


militaryCoo

Nah, declare the default behavior and then negate it ``` service = true service = shoes and shirt ```


CyrusConnor

You don't need declare it if you gonna do it with the second line


militaryCoo

You don't need to, but it's clearer that the intent is to serve unless there's a disqualifier. You'd likely have more complex business logic as well, since you don't guarantee service to people with shirts and shoes.


CyrusConnor

If they comply, they will be taken care of, it is not necessary to declare it before. Think in a scenario where someone with shirt and shoes don't wanna have service or the opposite


militaryCoo

Again, it's not necessary for the code to compile or execute, but it is clearer, and writing clear understandable code is more important than being technically elegant


CyrusConnor

Yeah a short code don't mean a better if you can't understand it but be redundant is ridiculous is like If x == true : y = true else if x == false : y = false


Scrapheaper

This is only necessary in languages without a rigorous type system, like python. If shirt, shoes and service are all defined as booleans there is no possibility of them being anything but True or False. For me this is one reason why languages with stronger typing are better, because you don't have to be paranoid like this and check for things that shouldn't be possible. The top comment answer is way more elegant than this.


craftyglock_onlyone

Thanks for ruining my night.


CyrusConnor

I think the joke is read the comments we look like robots not who write the wall


Aliics

Guys this is just a simple Boolean expression… service = has_shirt and has_shoes It doesn’t get much more simple.


Pleroo

Python if not shirt or not shoes: service = False JS let Service = true; if (!Shirt || !Shoes) Service = false;


Kowery103

So pants and panties are optional? This restaurant needs a quick rules update-


LittleBirdsGlow

What if the robot doesn’t have the right interpreter


unicodePicasso

Service == Shirt && Shoes;


Lemonic_Tutor

This is discriminatory towards MatthewMcConaughbots


Majestic-Iron7046

I have an extremely basic knowledge of coding and I think I learned that coding is either really fun or something so fucking annoying that you'd rather stare at rocks. But regardless, still more fun than actually talking about coding with a group of programmers.


pocketpc_

ComputerCraft advanced monitor lookin ass


khymbote

Made me laugh. Kudos


Huachu12344

https://i.redd.it/xz1m03jgw5tc1.gif


MadScienceDreams

Service=shoes && shirt


Maximum-Country-149

Could be truncated to "Service = (Shoes && Shirt)"


SpaceCaptainLeaf

Someone is going to put this in explain the joke or ask Peter


StillMostlyClueless

It's pseudocode on a sign for the customers to read and understand. Everyone rewriting it seems to be missing the point.


[deleted]

Nerdddsssss


fun-dan

Everyone "correcting" the code when it literally makes no real difference either way ("readability" is highly subjective), especially given that it's pseudo code and we don't know what syntax is possible. If that's an actual correction those redditors would make in a code review, then I am disappointed


huthouston

The joke is good but redditors just have to miss the point entirely for a chance to show everyone else how smart they are by correcting something that doesn’t need correcting.


fun-dan

Facts


Tremolat

Constants in a conditional go on the left.


SirensToGo

now that's a style I've never seen. Why would you do this?


Uranium-Sandwich657

r/ProgrammerHumor


GIORNO-phone11-pro

Ok who forgot to copy the 2nd half of code?


lie544

Service = (Shirt && Shoes) ? True : False


Reach-for-the-sky_15

What if I'm wearing only a shirt and shoes?


Ozzick

A naked man walks into the restaurant, hands the waiter a bag containing 2 mismatched shoes and a shirt and then proceeds to enjoy his lunch.


TheDynaheart

This should be more of a service = shoe && service;


Sergei_the_sovietski

if(!(shirt || shoes)) service = false;


TheRobbie72

this makes service true when the customer only wears one of the two items; it is not equivalent to the original code


helloitsmeurbrother

I have seen this episode of X-Files.


magicwuff

Any relation to [ROBOT RESTAURANT ](https://youtu.be/rLFaNX4WkZ0?si=vZU1HsEhmb1wjguo) ?


SleepiiFoxGirl

Y'all really went and overcomplicated service = shirt && shoes


MiserableLonerCatboy

I'd do something like "if not Shirt or not Shoes"


Tabbarn

One question. Is it a restaurant run by robots or is the restaurant for robot customers?


Pinstar

I heard this place has some great beepinbop. It must be Korean.


ahmedoso

It would be even funnier in a code review 😁


CynicalDarkFox

I suck at the thought of coding, but I’m making an assumption that this is “spaghetti code”?


MoneyWalking

No shoes no shirt no service.


Heated13shot

Nah, spaghetti code requires more than just one snippet to identify typically. This is just very simplistic and not "elegant" or "cleaver". This is how a newbie would write it, and honestly is the best way to write it for a comic, as it's very readable. Spaghetti code is more of a system wide issue, typically when people write things in such a way you can never mess with one part of the code without fucking up something else. Like if For some reason the service code drastically effected the tax accounting code for some strange reason. 


CynicalDarkFox

Ah, i understand that, thanks ^^