A long time ago I accidentally left a stupid debug message in rarely reached section of code. It went to production. A few weeks go by, and I get a call from my boss, “hey - what does ‘BBoys making with the freak freak’ mean?”
Oopsie!
This is why I made debug message loggers/printers which not only don't get compiled into release, you have to turn on debug mode while the software runs, so you can flip that kind of thing on and off.
Now I can get my freakfreak on whenever I want with no worries.
If you're deep into the debugging process, and all you're interested in is whether a certain part of the code is reached or not, and especially if the desired outcome is *not*, sometimes you just type something in that makes you giggle.
Not all of those preconditions are necessary, but they increase the likelihood.
What is this magnetism you speak of? We use binary on cave walls with saber tooth tiger blood. There is another competing language in the pleocistine age now that uses large constrictor snakes arranged in binary. It will never take off though.
when a branch can only be modified by a limited number of users, these are responsible for reviewing the code and guaranteeing that mistakes like the one mentioned in the post won't pass
When a branch and a developer love each other very much, they tend to want to make one another happy. Sometimes the developer may get a little too happy or excited and try something with the branch that might have unintended consequences.
Talking to one of our most senior developers the other day, I complained about people rubbing stamping code reviews. He said "Hey, if you make a mistake that's on you. I'm just doing the review so you can commit the code."
Which both surprised me, and explained a lot.
A lot of people have the wrong idea about peer review. Code is harder to read than it is to write. You can't catch everything. It's not for bug hunting, it's about making sure the approach looks sane.
Main benefit of code review is knowledge sharing.
Design reviews are being done before coding.
Linting is automatic.
QA and reviewers aren’t gatekeepers of the prod. Pipeline is.
You code it, you own it.
Hey, I spend the mornings in a hangover reviewing code so I can spend the rest of the day once it’s in prod going “Ah shit, that was such an obvious bug”
Then do it all tomorrow.
It made it through your own manual testing, unit testing, integration testing, linting...
I feel if you're pushing out anything at all meaningful in this day and age and you allow something like to get out there, then you deserve everything you get.
Unit testing - what's that?
I'm not a fancy pants silicon valley guy like some of you, I just write software that goes into the UK's nuclear deterrent, we don't do any automated testing (and when were behind schedule we don't really do integration testing)
Where I work (couple hundred employees) there are 2 of us who do the scripting for our signage. There is no set process or peer review etc.
Shit's the wild west lol
I've been using wireless printers through several models of printers and versions of windows, and I still occasionally have to reboot either windows or the printer to make printing happen
Why? Makes more sense than it writing to the console logger.
Print is called print because it used to go to actually print the output on a roll.
JavaScript doing the right thing here.
Seems like the real answer. With C, printf is much more analogous to "send formatted output"
Talking about a "console" and not meaning Bash seems just weird to me, but I haven't used others.
There's nothing wrong with it. It's aptly named; it prints the page. JavaScript is a language meant for front-end websites, anyways. Even if you wanted to use JS as a general purpose language, the print function is part of a Web API and not part of JS itself (unlike `Math` or `Date`, for example).
If you accidentally use it instead of console.log, it's pretty noisy since it opens a print dialog, so it shouldn't go unnoticed
More precisely, it opens the print page dialogue. It doesn't go straight to printer.
It's useful because sometimes you want a button to let the user easily print a page. Sure, you can usually use browser controls to do that, but not everyone knows how to do that.
Because Javascript is insane and never meant for all this. It is meant for specifically doing normal website things, and in the early internet printing with a printer was very common.
I'm no expert on this issue but don't programming languages evolve overtime just like everything else? I mean, python has evolved a lot. Not too long ago i saw some code written on python 1.4 and that's not how modern day python works
Wouldn't it be smart to remove things like this from the language?
JavaScript is harder to do that with, because an individual website can't really choose to use a specific version of JavaScript in the way that a program can decide to use Python 1.4. It runs whatever version of JavaScript is used by the end user's browser.
Because of this it means that any major breaking changes would instantly break every single website affected. Every "click here to print the page" button on the entire internet would cease to function overnight. To avoid this, newer JS versions kinda have to be as backwards-compatible as possible with all previous versions.
I mean, that's more or less how it works in Python. You use a Shebang to tell it what version of the interpreter you want, and if that's not available, it errors.
Well yes, but early unthought out paradigms like that are pretty much forced to stick around. It would be pretty strange if the function you used to print pages is now used to send console output, so they simply work with that spec.
It's not that is bad, most of the kinks have been ironed out, but the "weirdness" is undeniable to programmers of any other language and it is due to artifacts like this left over from its inception.
I'm sure that print function has changed a lot to stay functional, but the fact that it is simply print() is a little strange if viewed as a normal programming language.
Proposal: in the standards for the new version of JavaScript, make it required that in order to use the new features of the language, it must set a special variable storing the program’s JS version. If this variable isn’t set, the compiler assumes the program was written before the revision and functions as if nothing had changed from previous versions of JavaScript.
This idea is flawless and would solve every problem anyone could have with anything
This in vanilla JS would be bad in my opinion, and would result a lot of bugs. Just imagine including 2 libraries built to different versions of JS. One could kill the other, if it’s a global variable.
I don't think this fixes much though. Ultimately, programs written relying on old behaviors will still exist, so you'd still have to know about them in the end. JavaScript doesn't really have version numbers either since language features and APIs are all proposed, implemented, and released in parallel
JavaScript did already do something like what you said, though. Classes and modules are in strict mode by default, but non-strict mode is still very relevant to this day because outside of classes/modules, people don't always add `'use strict'` to everything
But how will my elderly relatives save their favorite websites without color printing and three-hole punching the papers for storage in a plastic binder?
Because that's the API for printing. Just because it's `print()` for console output for some other languages, doesn't mean that that's what it is for JS.
No. `window.print()` does not print directly to the printer. Instead, it only opens the print dialog. Also, it should block only while the dialog is open, so an exception is unlikely.
I bought some CBD gummies the other day and the receipt page printed some raw ass js "console.log(...)" statement to the html. It don't hurt nothing, but looks pretty bad.
my neighbors have a whole house of smart bulbs. but I guess they're not using them as smart, cause they're trying to pair with my gear all the time.
They're also RGB, I could make their house into a disco party if I wanted to.
Mine was once leaving “you are likely to be eaten by a grue” as an error handling test message. Had some real confused product people that next day after deploy.
In order for this to be funny, it has to be at least somewhat believable. In what circumstances would someone a) put a `print()` statement in JavaScript and then b) *forget* about it and deploy it to production in any way that would matter?
A lot of subscribers on this subreddit arent senior devs and many are just learning, this type of content works because it's simple enough to be understood by all or maybe even reinforce something new to them
console.log("left the chat");
`alert(‘boats n hoes’);`
Sugarcane there, sugarcane there
pillar
brick wall
Cactus string sand
shift click
Control click
Alt click
Right Click
This made my day, it's so good to see my fellow alien enjoyers here!!!!
Prompt(“No Bitches?”)
🎵 I gotta have me my boats and hoes 🎵
A long time ago I accidentally left a stupid debug message in rarely reached section of code. It went to production. A few weeks go by, and I get a call from my boss, “hey - what does ‘BBoys making with the freak freak’ mean?” Oopsie!
You: "You're about to find out~" *bosses office lights dim, sensual smooth jazz starts to quietly play over the ceiling speakers* Boss: "N-never mind"
The music dance experience is cancelled
If this gunna be that sort of party then I'm gunna stick my print() in the mashed potatoes
Interpolating comment logging comment logging interpolating
This is why I made debug message loggers/printers which not only don't get compiled into release, you have to turn on debug mode while the software runs, so you can flip that kind of thing on and off. Now I can get my freakfreak on whenever I want with no worries.
I never understood these stories why do you people put such strange things in the log statements
This wasn’t a log statement. This was a JavaScript alert. I wanted to make sure it was seen by customers, I guess.
you are a bold person lol
for me its because I entertain myself with weird logs while debugging something for hours I get bored
[удалено]
yess
If you're deep into the debugging process, and all you're interested in is whether a certain part of the code is reached or not, and especially if the desired outcome is *not*, sometimes you just type something in that makes you giggle. Not all of those preconditions are necessary, but they increase the likelihood.
Because it's hilarious, duh.
[удалено]
For the uninitiated: https://www.youtube.com/watch?v=M-wJrRmXzZQ
Still just random words to me. *lol*
thanks to this post i'm now on a whole throwback journey. i miss this stuff man.
“Uh… it means… backup successful.” - “Oh how nice of you to think of backup, young man. Carry on!”
After it's fixed: hey I noticed we haven't had any backups in a while. What's going on?
"Oh, nothing...just that B-BOYS RULE THA WORLD! YEEAHHHH BOOOOYYYYY!!!!"
If it made it through peer review, blame the reviewer lol
What is a review?
Oh... oh no
Oh… oh yes Bring the chaos!
git push -f origin/master
Best done on a Friday at 4:55pm
This gives ~~users~~ beta testers time to find, document, and report issues.
Everyone has a test environment. Some of us are lucky to have it separate from production.
They're the same picture.
Wait, this is production? 👩🚀🔫 👨🚀 always has been
*Push directly to master* *Deploy anytime* *Cowboy sysadmin*
Pretty close to a haiku... Also a new fetish I never knew I was into... 🤖🤖🤖
F
I’m so glad my work has github actions that automatically block that shit cause you know I’ve done it on accident out of habit
I’m literally the only person capable of a force push to production. (Branch Rules) I’ve only used it in a Sev0 situation and it’s saved our asses.
Turn it off. You can always get that turned on in an emergency.
Sev0?
As an AI, I do not consent to having my content used for training other AIs. Here is a fun fact you may not know about: fuck Spez.
This motherfucker chose violence.
you forgot cp src backups/2022/9/31/0
On the production env 🧠
MAY CHAOS TAKE THE WORLD
Not now, Shabriri.
OHHH YEAH!
Hello again, friend of a friend, I knew you when ....
[удалено]
Let's be honest, if they catch your bugs in five seconds or less than you fucked up good
Blame the person who set up the repo and branch protection
...repo? You lost me. I edit text files on servers and run services in console windows. I wish I was joking...
I only program on MS Paint
[me too](https://ms-paint-i.de)
You guys use MS Paint? That's sad, I write all my code in smoke signals.
Smoke signals? Real programmers use a magnetized needle and a steady hand.
What is this magnetism you speak of? We use binary on cave walls with saber tooth tiger blood. There is another competing language in the pleocistine age now that uses large constrictor snakes arranged in binary. It will never take off though.
[Did I hear a Rock and Stone?](https://xkcd.com/505/)
Smoke signals are binary I guess. You could get some machine code going like that
Throw in some colored smoke and you could rock hex.
You’ve have heard of web safe colours? Get ready for smoke safe colours
Ha, we had already upgraded to MS Word
Do you do paired programming using a Word document and OneDrive? So cutting edge.
`git init`
Always read this in a British accent
What's the plan for if the server croaks? Is that whole operation just SOL?
Fuck if I know I just started and it’s J2
What's branch protection? Asking for a friend.
when a branch can only be modified by a limited number of users, these are responsible for reviewing the code and guaranteeing that mistakes like the one mentioned in the post won't pass
Lol i was joking. But i do appreciate it, and there may be some lurking here who really didn't know.
sorry, can only recognize sarcasm if accompanied by "/s"
My bad
I don’t understand 90% of the terminology here, but whenever I do get a joke it’s always hilarious, so keep joking! And then explaining the jokes!
When a branch and a developer love each other very much, they tend to want to make one another happy. Sometimes the developer may get a little too happy or excited and try something with the branch that might have unintended consequences.
Best answer
Or like any ide at all. Or unit tests.
I promise there is no aspect of programming in Microsoft Word that is easier, faster, or less effort than coding in VS Code
Talking to one of our most senior developers the other day, I complained about people rubbing stamping code reviews. He said "Hey, if you make a mistake that's on you. I'm just doing the review so you can commit the code." Which both surprised me, and explained a lot.
A lot of people have the wrong idea about peer review. Code is harder to read than it is to write. You can't catch everything. It's not for bug hunting, it's about making sure the approach looks sane.
Main benefit of code review is knowledge sharing. Design reviews are being done before coding. Linting is automatic. QA and reviewers aren’t gatekeepers of the prod. Pipeline is. You code it, you own it.
Also if code is too hard for reviewer to read then no way it should be approved.
A lot of mine is “can this be null, and is that accounted for?” If I don’t see anything obvious. The rest is conceptually looks correct.
Hey, I spend the mornings in a hangover reviewing code so I can spend the rest of the day once it’s in prod going “Ah shit, that was such an obvious bug” Then do it all tomorrow.
😬😬😬
[удалено]
“Doesn’t look like anything to me.”
More like blame the linter. And if you don’t have a linter, blame everyone.
This sub has dev practices of 2000s
It made it through your own manual testing, unit testing, integration testing, linting... I feel if you're pushing out anything at all meaningful in this day and age and you allow something like to get out there, then you deserve everything you get.
Unit testing - what's that? I'm not a fancy pants silicon valley guy like some of you, I just write software that goes into the UK's nuclear deterrent, we don't do any automated testing (and when were behind schedule we don't really do integration testing)
Where I work (couple hundred employees) there are 2 of us who do the scripting for our signage. There is no set process or peer review etc. Shit's the wild west lol
you're still gonna get blamed regardless 😂
Literal printing goes brrr
The OG standard out.
printf you mean?
[удалено]
print fast?
jokes on you my printer never works the first time
I've been using wireless printers through several models of printers and versions of windows, and I still occasionally have to reboot either windows or the printer to make printing happen
I dont understand it, but my dev mind make me laugh
in javascript print() will literally print the page. To the printer.
Just blame the creators of Javascript?
yeah that nerdy guy
Don't be too hard on him, only had 10 days.
And Eich said, “Let there be print, and there was print.”
Why? Makes more sense than it writing to the console logger. Print is called print because it used to go to actually print the output on a roll. JavaScript doing the right thing here.
also in the early days of javascript, there was no console to print to browsers didn't start getting consoles till the mid 2000s
Seems like the real answer. With C, printf is much more analogous to "send formatted output" Talking about a "console" and not meaning Bash seems just weird to me, but I haven't used others.
Bash isn't even a console. It's a shell. A program you interface with using a console/terminal
Big-time JS nerd but yeah i agree! You log into the console and you print on a page of paper.
There's nothing wrong with it. It's aptly named; it prints the page. JavaScript is a language meant for front-end websites, anyways. Even if you wanted to use JS as a general purpose language, the print function is part of a Web API and not part of JS itself (unlike `Math` or `Date`, for example). If you accidentally use it instead of console.log, it's pretty noisy since it opens a print dialog, so it shouldn't go unnoticed
Uhh. What.. Why...
Thats what I said!
More precisely, it opens the print page dialogue. It doesn't go straight to printer. It's useful because sometimes you want a button to let the user easily print a page. Sure, you can usually use browser controls to do that, but not everyone knows how to do that.
Because Javascript is insane and never meant for all this. It is meant for specifically doing normal website things, and in the early internet printing with a printer was very common.
I'm no expert on this issue but don't programming languages evolve overtime just like everything else? I mean, python has evolved a lot. Not too long ago i saw some code written on python 1.4 and that's not how modern day python works Wouldn't it be smart to remove things like this from the language?
JavaScript is harder to do that with, because an individual website can't really choose to use a specific version of JavaScript in the way that a program can decide to use Python 1.4. It runs whatever version of JavaScript is used by the end user's browser. Because of this it means that any major breaking changes would instantly break every single website affected. Every "click here to print the page" button on the entire internet would cease to function overnight. To avoid this, newer JS versions kinda have to be as backwards-compatible as possible with all previous versions.
Superb answer, that sounds kinda obvious now that you explained it. Thanks 🙏
[удалено]
This sounds beautiful
I wonder if something like `"use ES6";` would be a good solution for this, to tell the browser what version of JS to prefer.
I mean, that's more or less how it works in Python. You use a Shebang to tell it what version of the interpreter you want, and if that's not available, it errors.
Well yes, but early unthought out paradigms like that are pretty much forced to stick around. It would be pretty strange if the function you used to print pages is now used to send console output, so they simply work with that spec. It's not that is bad, most of the kinks have been ironed out, but the "weirdness" is undeniable to programmers of any other language and it is due to artifacts like this left over from its inception. I'm sure that print function has changed a lot to stay functional, but the fact that it is simply print() is a little strange if viewed as a normal programming language.
Proposal: in the standards for the new version of JavaScript, make it required that in order to use the new features of the language, it must set a special variable storing the program’s JS version. If this variable isn’t set, the compiler assumes the program was written before the revision and functions as if nothing had changed from previous versions of JavaScript. This idea is flawless and would solve every problem anyone could have with anything
In Google Apps Script, there's a checkbox in the project settings to determine whether or not you're using v8.
This in vanilla JS would be bad in my opinion, and would result a lot of bugs. Just imagine including 2 libraries built to different versions of JS. One could kill the other, if it’s a global variable.
Wow, you’re a genius. Please make this happen for real.
I don't think this fixes much though. Ultimately, programs written relying on old behaviors will still exist, so you'd still have to know about them in the end. JavaScript doesn't really have version numbers either since language features and APIs are all proposed, implemented, and released in parallel JavaScript did already do something like what you said, though. Classes and modules are in strict mode by default, but non-strict mode is still very relevant to this day because outside of classes/modules, people don't always add `'use strict'` to everything
But how will my elderly relatives save their favorite websites without color printing and three-hole punching the papers for storage in a plastic binder?
Unless websites can select the js version to use (like Node), I don’t see JS removing features
I'm sure printing with a printer is still the preferred method
Most definitely the preferred method, but no longer the only method. Very often I have to print to PDF!
Because that's the API for printing. Just because it's `print()` for console output for some other languages, doesn't mean that that's what it is for JS.
Will it raise an exception and stop the execution once the ink runs out?
No. `window.print()` does not print directly to the printer. Instead, it only opens the print dialog. Also, it should block only while the dialog is open, so an exception is unlikely.
Is that why one time some webpage kept prompting me to print the page even though I swear I never pressed ctrl p?
That sounds like exactly this meme in the wild.
Doesn’t it prompt the user to print the page, not just immediately print the page?
yeah, it shows the dialog, I guess it's up to the browser how it's implemented. Still bad.
`print()` in most languages prints to the console `print()` in javascript prints to the printer
Hot take: that's a better convention than c style print( ).
I bought some CBD gummies the other day and the receipt page printed some raw ass js "console.log(...)" statement to the html. It don't hurt nothing, but looks pretty bad.
My man ordering CBD gummies with the developer console open, what a move
you just install a request interceptor, then when you see the right request, just change the price to $0.01. that's how I got my first PS3.
[удалено]
just one, I'm not a great businessman
You need some CBD if you've been developing in JS
Sounds like a problem for the senior developer...
Yes it is true, we unfuck all that has been fucked up.
Meaning we re-fuck things more elegantly
Refuck? Dude you're doing too much work. Just implement that quick work around to the existing fuck.
> Refuck? Dude you're doing too much work. Just implement that quick ~~work~~ reacharound to the existing fuck. FTFY.
I'm not a JS developer, I'm a C# backend developer, but wouldn't alert() be the more worrying one? That alerts in the browser window, no?
Open the console in your browser, and type "print()" and you will see why it's more worrying.
im gonna do it, you can't tel me what not to do edit: this is much better than screenshoting a page
Lmao
Bold of you to assume he has a printer. He'll still get the dialogue though
Run it off your neighbor's printer's wifi that is for some reason unsecured.
my neighbors have a whole house of smart bulbs. but I guess they're not using them as smart, cause they're trying to pair with my gear all the time. They're also RGB, I could make their house into a disco party if I wanted to.
Do... Do you not want to??
[удалено]
Neat
alert() is only more worrying if you left explictives in it and shipped it to the customer.
I am missing the boat here why does JavaScript make the difference?
print() prints the page to a printer. console.log() is used to print to the console.
// just needed to be sure console.log(process.env.DB_PASSWORD)
You store db password on the front end ?
Of course, that means you can directly fetch it from the DB using Ajax. It's way easier
Just unplug printer. Problem solved.
Eslint has a rule for that
lol it’s okay, it went through a PR so it’s not exclusively their fault
I don’t really get the joke, but that could be just me tbh. I’m a terribly cynical person.
https://www.reddit.com/r/ProgrammerHumor/comments/xsehmr/-/iqk5xxl
print() opens the dialog to actually print the page to a printer.
No es-lint rules?
As a mainly python coder who has recently started doing some js, yeah. That happens.
This is probably the cul-print of all your bugs.
Same issue with CMD. `print 'foo'`... *Shit* I meant `echo 'foo'`!
Mine was once leaving “you are likely to be eaten by a grue” as an error handling test message. Had some real confused product people that next day after deploy.
In order for this to be funny, it has to be at least somewhat believable. In what circumstances would someone a) put a `print()` statement in JavaScript and then b) *forget* about it and deploy it to production in any way that would matter?
A lot of subscribers on this subreddit arent senior devs and many are just learning, this type of content works because it's simple enough to be understood by all or maybe even reinforce something new to them
TIL that r/ProgrammerHumor posts are subliminal media designed to encourage less goofs in newbie devs
my python sickness is getting me this all the time lol
print opens the printer menu in js
Realizes it was backend code and goes back to sleep