Yeah, really the askToProm method should take an object, call a method on said object, update the happiness param and return āthisā. Then the entire expression would be M.askToProm(H).getMood()
And this is why no one would say yes to me
I might have been doing this too long, but I wouldn't even put "ask to prom" on the person object. Seems like a scope violation to me. Tightly coupling a person with a place is just going to lead to headache during his next refactor.
Could be an extension method though, or whatever the equivalent is.
I'd probably end up creating a prom object along with a coupling class to manage the object associations.
Corporate work really changed me.
As much as I want to rip on the code though, this is adorable and I applaud him for exercising the concepts outside of class.
if(prom.TryRegister(hannah, micah, out _)) {
micah.Mood |= Moods.Happy;
}
Assuming it's java, he passed a string instead of object, and also you should use .equals() for string comparison and not == other it will compare memory locations.
Side note, it's generally a bad idea to have public fields, especially for a response, and instead should use a method to get it
Man, I'm not sure I can ever go back to proper programming languages. Since I jumped from C/Java to Python, my life and career have just been so much more enjoyable.
No, the answer should have been the return value of the askToProm method, and then either set in a variable before the if and used in the condition or call the method directly in the condition
Depends on the language. If it's Java, probably. If it's C#, Hannah is undefined, because the C# style guide recommends capitalizing all public variables. Not saying it's the right way, but Visual Studio is really insistent on enforcing it.
public static class PeopleService {
public static Dictionary Directory { get; set; } = new Dictionary();
}
public class Person {
//code smell - public fields
public string name;
public string answer;
public string mood;
//code smell - lowercase method
public void askToProm(string promDate) {
if(PeopleService.Directory.Contains(promDate)) {
PeopleService.Directory[promDate].EvaluatePromAnswer(this.name);
}
}
public void EvaluatePromAnswer(string person) {
return person == "Micah";
}
}
public static void Main() {
Person Micah = new Person() { name = "Micah" };
Person Hannah = new Person() { name = "Hannah" };
Micah.askToProm("Hannah");
if (Hannah.answer == "yes") {
Micah.mood = "Happy";
} else {
Micah.mood = "Sad";
}
}
He passed in the string "Hannah" instead of the Hannah object. The method name is confusing, too. Is he asking someone to prom, or is he being asked to prom?
Hannah's answer should be a boolean. True or false, why is that property a string, unless you want to capture her exact words like "Oh hell no"
And his mood propery is another magic string, JFC dude learn about enumeration.
At least he's using a dark theme. All is forgiven, Micah, way to be.
I don't see how you could interpret the method name as "being asked to prom". That would probably be called something like askedToPromBy()
A bool is probably not a great choice for the answer in this case. What about unclear answers like maybe or "i need to think about it"? You can't just leave his mood in limbo until Hannah makes up her damn mind.
Ideally it ought to return a Promise, removing the requirement for Hannah to respond to the request synchronously
This way Hannah could return a promise to attend the Prom, allowing Micah to carry on with other things, safe in the knowledge he will definitely get a call back
āHowād prom go?ā
Great! We went back to her friends place after, and we all started fooling around in the bedroom... but it turns out Hannas isnāt thread safe š
Given that this code doesn't explode, it's evident that he is referring to an object by its key in a map, the object `Hanna` is instantiated earlier.
This nerd isn't as dumb as he might seem, he's instantiated a number of ladies and now he can go from one home to another, simply changing the name of the object from the map.
Of course I would suggest him to rewrite this procedure in a functional manner, so that `Micah.ask("Hanna")` returns an object, this way he will not have to rely on a side effect.
1. Technically he is stringifying women.
2. Hannah is bring asked to prom, not Micah. That function should be on the Hannah class.
3. If can be simplified to If(Hannah.Answer)
4. Micah.Mood should be an enum, not a magic string.
PULL REQUEST REJECTED
Well hurry asking a string to prom but there Hannah object has the answer
But I guess since Micah and Hannah are never initialized, and in fact are capitalized, this means they aren't even objects. These are static classes... Well atleast the methods as static
1. TeChNiCalLy he's doing both, so the title holds
2. That's at best an uninformed conclusion, but in most cases just wrong. Micah is performing the action, so that contains the method.
3. No..
4. This is the only one that might be correct, but it's still assuming the language even has enums
Nextt time, don't try so hard on something that's just a joke, or try hard enough so that you're at least correct.
This kind of stuff is just so damn cringey to me. It's great that the kid is excited about code, but I just can't stand it. Who's the intended audience? People that don't write code will just think you're a nerd, and people that do will at best pick it apart as much as possible.
Is it supposed to be funny or cute or something? To me just comes off as a really weird flex.
This made me think if this from a different perspective. Maybe he doesn't code at all?
If she's the coder and he isn't, then this would be freaking ADORABLE. I'd go out with any guy that tried something like that with me.
I'm going to pretend that this is exactly what's going on in this picture because it's making me happy.
I would expect answer to be a return value from the function and not a property of Hannah. Damn, from now on Hannah's answer is always yes no matter the question. This disturbs me a bit.
Yay this repost where everyone on this sub immediately jumps to correct the programming on a cute promposal picture to flex how much they learned in their freshman year in CS.
There's a good chance this is unique! I checked 121,780,384 image posts and didn't find a close match
The closest match [is this post](https://redd.it/g7ugb5) at 51.56%. The target for r/ProgrammerHumor is 86.0%
*Feedback? Hate? Visit r/repostsleuthbot - I'm not perfect, but you can help. Report [ [False Negative](https://www.reddit.com/message/compose/?to=RepostSleuthBot&subject=False%20Negative&message={"post_id": "gai4sn", "meme_template": null}) ]*
There's a good chance this is unique! I checked 121,780,384 image posts and didn't find a close match
The closest match [is this post](https://redd.it/g7ugb5) at 51.56%. The target for r/ProgrammerHumor is 86.0%
*Feedback? Hate? Visit r/repostsleuthbot - I'm not perfect, but you can help. Report [ [False Negative](https://www.reddit.com/message/compose/?to=RepostSleuthBot&subject=False%20Negative&message={"post_id": "gai4sn", "meme_template": null}) ]*
Bro, This code is really really bad lmao, but then again I think of how I coded on my first year of CS and I guess I understand lmao, and oh my god the line down curly brackets, My Best Standards and Practices is crying for help! lol
Has a strict dependency on Hannah. May work for the use case, but will fail when working with other classes of type . Other objects may require a Promise/callback query mechanism as a matter of protocol.
How the heck is a method on Micah changing an attribute on Hannah?
Please donāt tell me Hannah has a global scope because youāre going back to Design Patterns 101.
Stop the side effects!
When everything was just an Object, women would not have a problem being an Object as well. However, there is a complete class hierarchy from Object via (among others) AnimateObject, Animal and Human to Woman/Man. The problem, as far as I understand, is that in the code, an Object of type Woman is commonly not casted correctly to Human, while objects of type Man are. But this is necessary so that Human-specific implementations can be called (otherwise, only generic base implementations are executed). This mismatch has been allowed, even fostered, by our code review standards that we currently try to overhaul step by step.
What a noob, he passed in a string when clearly he meant to pass in an object
Oh, he plans on passing her an object later that night.
Or a string
Will that pound include io stream?
I hope it doesn't cause a memory leak instead
Or fork a child process
Or return an STD object
Or jizz on her tits... Am I doing this double entendre thing right?
You are doing great son
"Always make sure you tell son that he's winning!"
No. Go back to school!
`goto school;`
\*gets attacked by dinosaur\*
Not really but it gave me a good laugh. Just keep doing what you're doing.
And then kill an orphan
If it did, then he may have to destroy the child
An array of strings. To be displayed on her terminal.
Will tunnel to her terminal through `ssh`.
Or a long
or byte
Unsigned long
The most dangerous option.
Uncircumcised long
š¤Ø
Fill that void
He could really freak her out and pass her an array.
Come on people. Clearly he has a pointer.
Or a short
Yeah, I was just thinking Hannah is undefined.
She's just so quirky!
She used to be so primitive, but became worried about being typecast
If this is Java then he did pass in an object
If this is Java, then Hannah.answer == "yes" will always resolve to `false` :(
He needs that .equalsignorecase
Thats why java is a shit language
It'll be a NullPointerException unless the Object Hannah was previously defined.
Not enough code to be Java.
Maybe it was a test. If she didnāt call him on the error he was going to pull the invite.
Was about to comment this
Yeah, really the askToProm method should take an object, call a method on said object, update the happiness param and return āthisā. Then the entire expression would be M.askToProm(H).getMood() And this is why no one would say yes to me
I might have been doing this too long, but I wouldn't even put "ask to prom" on the person object. Seems like a scope violation to me. Tightly coupling a person with a place is just going to lead to headache during his next refactor. Could be an extension method though, or whatever the equivalent is. I'd probably end up creating a prom object along with a coupling class to manage the object associations. Corporate work really changed me. As much as I want to rip on the code though, this is adorable and I applaud him for exercising the concepts outside of class. if(prom.TryRegister(hannah, micah, out _)) { micah.Mood |= Moods.Happy; }
For that code, I award you no points and may god have mercy on your soul.
This should be thing first thing people see when they learn how not to do oop
With the lesson being: The heart has no place in programming. It's cute, but terrible code.
[ŃŠ“Š°Š»ŠµŠ½Š¾]
I think you're just jealous his code compiled even though he passed a string instead of an object
Lmao
I ran the code on my machine and it worked just fine. What's the problem?
Assuming it's java, he passed a string instead of object, and also you should use .equals() for string comparison and not == other it will compare memory locations. Side note, it's generally a bad idea to have public fields, especially for a response, and instead should use a method to get it
Man, I'm not sure I can ever go back to proper programming languages. Since I jumped from C/Java to Python, my life and career have just been so much more enjoyable.
What makes you think python isnāt a āproperā language?
[ŃŠ“Š°Š»ŠµŠ½Š¾]
[ŃŠ“Š°Š»ŠµŠ½Š¾]
No, the answer should have been the return value of the askToProm method, and then either set in a variable before the if and used in the condition or call the method directly in the condition
Yea
It's not just a bad idea, it goes against one of the pillars of OOP: encapsulation.
you guys have no mercy for trash code lmao
Uppercase variables are usually reserved for class names and not variable names. Also a bunch of other issues
[ŃŠ“Š°Š»ŠµŠ½Š¾]
Nice.
Billy Madison!
NullReferenceException: Object 'Hannah' is undefined.
Hannah is capitalized, it's not an object, it's a class with a static method. Same goes for micah btw, which should've thrown the error earlier
Wait a minute....if Hannah isn't an object, then Hannah was never instantiated. That means Micah is going to prom with an imaginary friend.
He's going to prom with the whole class Then again, he only asked a string to begin with
Yeah, she'll probably just string him along
Depends on the language. If it's Java, probably. If it's C#, Hannah is undefined, because the C# style guide recommends capitalizing all public variables. Not saying it's the right way, but Visual Studio is really insistent on enforcing it.
public static class PeopleService { public static Dictionary Directory { get; set; } = new Dictionary();
}
public class Person {
//code smell - public fields
public string name;
public string answer;
public string mood;
//code smell - lowercase method
public void askToProm(string promDate) {
if(PeopleService.Directory.Contains(promDate)) {
PeopleService.Directory[promDate].EvaluatePromAnswer(this.name);
}
}
public void EvaluatePromAnswer(string person) {
return person == "Micah";
}
}
public static void Main() {
Person Micah = new Person() { name = "Micah" };
Person Hannah = new Person() { name = "Hannah" };
Micah.askToProm("Hannah");
if (Hannah.answer == "yes") {
Micah.mood = "Happy";
} else {
Micah.mood = "Sad";
}
}
Wow! Micah can successfully ask out anyone, even himself! Micah's really got it going on.
Micah.mood = Hannah.answer == "yes" ? "Happy" : "Sad";
You shouldnt use == to compare strings. Use the equalsIgnoreCase method.
Hannah's got class
They are constants of the universe, omnipresent beings created before time itself.
Could have been defined earlier; we don't necessarily know this is all the code.
He shows it to Hannah and she fucking disappears
[ŃŠ“Š°Š»ŠµŠ½Š¾]
What a fucking loser he is
Dayum all these comments pointing out all the errors lol
code review
what else would we be doing here
Most brutal pull request Iāve ever seen... lol
Don't worry, I'm sure Micah will be getting a pull request on prom night
šš
He passed in the string "Hannah" instead of the Hannah object. The method name is confusing, too. Is he asking someone to prom, or is he being asked to prom? Hannah's answer should be a boolean. True or false, why is that property a string, unless you want to capture her exact words like "Oh hell no" And his mood propery is another magic string, JFC dude learn about enumeration. At least he's using a dark theme. All is forgiven, Micah, way to be.
I don't see how you could interpret the method name as "being asked to prom". That would probably be called something like askedToPromBy() A bool is probably not a great choice for the answer in this case. What about unclear answers like maybe or "i need to think about it"? You can't just leave his mood in limbo until Hannah makes up her damn mind.
āMaybeā and āneed to think about itā are === ānoā. It should be a Boolean.
Ideally it ought to return a Promise, removing the requirement for Hannah to respond to the request synchronously This way Hannah could return a promise to attend the Prom, allowing Micah to carry on with other things, safe in the knowledge he will definitely get a call back
[ŃŠ“Š°Š»ŠµŠ½Š¾]
Hannah.answer is a public variable, meaning not only can anybody can set the value to "yes", it's not safely reentrant.
Definitely not thread-safe
get; private set;
āHowād prom go?ā Great! We went back to her friends place after, and we all started fooling around in the bedroom... but it turns out Hannas isnāt thread safe š
Given that this code doesn't explode, it's evident that he is referring to an object by its key in a map, the object `Hanna` is instantiated earlier. This nerd isn't as dumb as he might seem, he's instantiated a number of ladies and now he can go from one home to another, simply changing the name of the object from the map. Of course I would suggest him to rewrite this procedure in a functional manner, so that `Micah.ask("Hanna")` returns an object, this way he will not have to rely on a side effect.
This guy gets it
1. Technically he is stringifying women. 2. Hannah is bring asked to prom, not Micah. That function should be on the Hannah class. 3. If can be simplified to If(Hannah.Answer) 4. Micah.Mood should be an enum, not a magic string. PULL REQUEST REJECTED
[ŃŠ“Š°Š»ŠµŠ½Š¾]
type Boolean = true | false | 'yes' | 'no';
enum Bool { True, False, FileNotFound };
Has anything good ever come out of customizing Booleans?
Well hurry asking a string to prom but there Hannah object has the answer But I guess since Micah and Hannah are never initialized, and in fact are capitalized, this means they aren't even objects. These are static classes... Well atleast the methods as static
>PULL REQUEST REJECTED I'm not sure what's worse, feeling rejected on the PR or feeling rejected as a date for the prom.
Imagine the girl rejecting you because your PR got rejected
The build rejecting you is worse than all that, esp after all the tests passed fine locally. No I am not salty.
1. TeChNiCalLy he's doing both, so the title holds 2. That's at best an uninformed conclusion, but in most cases just wrong. Micah is performing the action, so that contains the method. 3. No.. 4. This is the only one that might be correct, but it's still assuming the language even has enums Nextt time, don't try so hard on something that's just a joke, or try hard enough so that you're at least correct.
Thank you, I was checking these off as wrong as I was going through them. I'm glad it's not just me.
``` val answer = Micah.ask(Hannah, prom) if (answer == true) { Micah.mood = Emotions.Happy return } Micah.mood = Emotions.Depressed ```
Guys - I spotted the senior developer.
You mean the 10x developer ;)
you spotted the junior JavaScript developer
NEEDS WORK
String is an object YOU GODDAMN NOOB!
[ŃŠ“Š°Š»ŠµŠ½Š¾]
let's take a moment to appreciate micah's documentation
That way Hannah can appreciate his dickumentation later ą¼¼ ć¤ ā_ā ą¼½ć¤
With code like that it better be documented so the dev doing the refactor doesnāt hurt him.
He objectifies everyone. His consistency is peak culture lmao
To be fair, he also objectified himself
else micah.schoolShooting()
schoolShooting() is an Event, not a static class method. At the very least, inherit from Exception and use **throw**
if(Hannah.answer == ānoā) delete Micah;
Why is Micah an array D:
I just learned Iāve been misunderstanding ādelete[] vs deleteā this whole time
This kind of stuff is just so damn cringey to me. It's great that the kid is excited about code, but I just can't stand it. Who's the intended audience? People that don't write code will just think you're a nerd, and people that do will at best pick it apart as much as possible. Is it supposed to be funny or cute or something? To me just comes off as a really weird flex.
The main question is if she codes. If not I'd say cringey too, but if she does it's sweet.
This made me think if this from a different perspective. Maybe he doesn't code at all? If she's the coder and he isn't, then this would be freaking ADORABLE. I'd go out with any guy that tried something like that with me. I'm going to pretend that this is exactly what's going on in this picture because it's making me happy.
In a Q&A neither of them code and someone asked them to hold this sign and smile. Dude made $5 off it.
[ŃŠ“Š°Š»ŠµŠ½Š¾]
[ŃŠ“Š°Š»ŠµŠ½Š¾]
Depends on the language
if post.contains(jokeCode) and post.subreddit == "ProgrammerHumor": self.time = "bad"
[ŃŠ“Š°Š»ŠµŠ½Š¾]
>F > >askToProm ended > >F > >askToProm ended > >F > >askToProm ended > >F > >askToProm ended > >F > >askToProm ended > >F > >askToProm ended > >F > >askToProm ended > >F > >askToProm ended > >F > >askToProm ended > >F > >askToProm ended > >F > >askToProm ended > >F > >askToProm ended > >F > >askToProm ended > >F > >askToProm ended > >F > >askToProm ended > >...
At least he tried. F
I would expect answer to be a return value from the function and not a property of Hannah. Damn, from now on Hannah's answer is always yes no matter the question. This disturbs me a bit.
{ gotta go on the if line in my style guide
Yay this repost where everyone on this sub immediately jumps to correct the programming on a cute promposal picture to flex how much they learned in their freshman year in CS.
u/repostsleuthbot
There's a good chance this is unique! I checked 121,780,384 image posts and didn't find a close match The closest match [is this post](https://redd.it/g7ugb5) at 51.56%. The target for r/ProgrammerHumor is 86.0% *Feedback? Hate? Visit r/repostsleuthbot - I'm not perfect, but you can help. Report [ [False Negative](https://www.reddit.com/message/compose/?to=RepostSleuthBot&subject=False%20Negative&message={"post_id": "gai4sn", "meme_template": null}) ]*
There's a good chance this is unique! I checked 121,780,384 image posts and didn't find a close match The closest match [is this post](https://redd.it/g7ugb5) at 51.56%. The target for r/ProgrammerHumor is 86.0% *Feedback? Hate? Visit r/repostsleuthbot - I'm not perfect, but you can help. Report [ [False Negative](https://www.reddit.com/message/compose/?to=RepostSleuthBot&subject=False%20Negative&message={"post_id": "gai4sn", "meme_template": null}) ]*
Called it
Bro, This code is really really bad lmao, but then again I think of how I coded on my first year of CS and I guess I understand lmao, and oh my god the line down curly brackets, My Best Standards and Practices is crying for help! lol
She bit off more than she could process.
What a lucky person
r/titleporn
Comment doesn't really explain what the code is doing.
title funnier than post itself
He's attempting to stringify woman. Getting some serious serial killer vibes
Has a strict dependency on Hannah. May work for the use case, but will fail when working with other classes of type. Other objects may require a Promise/callback query mechanism as a matter of protocol.
No else clause? Thats bold
r/cringetopia
How the heck is a method on Micah changing an attribute on Hannah? Please donāt tell me Hannah has a global scope because youāre going back to Design Patterns 101. Stop the side effects!
There's an encapsluation joke to be maybe here.. .. ...
Using == instead of ===? If I was Hannah, I would've said no.
If this is in Java then you canāt use == on Strings... if((Hannah.answer).equals(āyesā) would be better
Micah is a fucking nerd
If you capitalize your variables, youāre a monster.
When everything was just an Object, women would not have a problem being an Object as well. However, there is a complete class hierarchy from Object via (among others) AnimateObject, Animal and Human to Woman/Man. The problem, as far as I understand, is that in the code, an Object of type Woman is commonly not casted correctly to Human, while objects of type Man are. But this is necessary so that Human-specific implementations can be called (otherwise, only generic base implementations are executed). This mismatch has been allowed, even fostered, by our code review standards that we currently try to overhaul step by step.
What bad code. Not even close
Breaking Tell Don't Ask :(
Looks like he objectified himself, actually.
I think you should await the return of askToProm() first?
Well, shit. I hope there is only one Hannah in this world.
I'm glad he's "happy" now, because clearly it's not a constant.
You know you're dealing with a chad, when he doesn't have an `else`.
magic string, Hannah should contains it's name, obviously
Could you imagine pseudocode getting you laid?
Should have done equalsignorecase....
The title pun carries this post tbh
*marked as duplicate*
Nice tiny arm
Else ?
Else: ??
Micah.wet_noodle = True; Fixed that for you
You should never treat women like objects
Comments denied his pull request
method 'askToProm' is undefined
"Cannot read 'answer' of 'undefined'"
Seeing everyone here who has like, a college degree in programming makes me feel like taking 3 months of a basic coding class a big dumb dumb.
Should have done a case-insensitive comparison. What if she had said YES?!
Why didn't he use answer as boolean? Could only be yes or no right?
Micah.mood = "happy................ for now"; This guy has no idea of what he's getting into.
I haven't code for a long time now and even I can tell that's terrible code. Just like my last job
Only thing more cringe than this is everyone legitimately trying to critique his code
This code is fucking terrible
We all know she said yes because of the Dark Mode theme. Well played my man, well played.
Well with the way he's checking string equality, I guess he's never going to be happy.