“Use a different language” is a common defense of javascript, but kind of a weird one.
- 0 Posts
- 12 Comments
jjjalljs@ttrpg.networkto Programmer Humor@programming.dev•They can see the policy working...10·24 days agoYeah. My last job, a PR with commented out code typically wouldn’t get approved. Either leave it in version history, or stick it on a branch
jjjalljs@ttrpg.networkto Programmer Humor@programming.dev•Python needs an actual default function8·1 month agoCall the function from the if block.
Now your tests can more easily call it.
I think at my last job we did argument parsing in the if block, and passed stuff into the main function.
Anyone entering through web development. If you’re self taught or did a “coding boot camp”, it might be the only language you’ve used. A lot of places use it for backend stuff now, too
I don’t know about “fine”. It has a lot of weird stuff baked in. Hoisting. Unexpected type coercion. Too many ways to loop over something and I always forget which one is which. “There’s more than one way to do it” is kind of a recurring problem, come to think of it. Several function declaration syntaxes. Dot notation AND bracket notation for objects.
Also it will forever bother me that object keys aren’t quoted.
const foo = "hello";
const bar = { foo: "world" }
That should be, in my mind,
{ "hello": "world" }
. It’s not. It’s{ "foo": "world" }
But if you want to do that, you need to do
const bar = { [foo]: world }
. Which looks like your key is an array with one entry, a string with a value of “foo”You also end up learning a whole framework, with its syntax and idioms, every couple years. Angular. React. Redux. Whatever.
There’s also a lot of people who have never used anything else, and want to use javascript for everything.
Javascript is basically D&D. Wildly popular. Full of legacy jank. People try to use it for anything even though there are better or more specialized tools.
Reminds me of my first big success at work. There was a weekly report that people wanted generated - it showed how much like each operator had done, how much each warehouse had shipped, how many orders we lost from stock issues, etc. it was a low tech company, so they had someone going through the limited UI, looking up each thing one at a time, copying it into excel, and making the report that way. It took hours, and was error prone from stuff like mis-pasting or accidentally skipping a user.
Took a look at it and was like you could definitely automate this. Used some very primitive scripting to pull all the info out of the system’s UI and dump it into a TSV. Took like a couple minutes to run it, import into excel, and add the colors. But it was super janky because it was manipulating the UI like a user instead of, like, directly querying whatever underlying data store it was running on.
Still, management was impressed. I later learned no one actually looked at the report most weeks, so that took some of the wind out of my sails.
This is an ancient joke but they replaced the original pigeon with a blue thing instead. :confused:
Maybe the design is bad, then.
Javascript could throw an error to alert you that the input is supposed to be a string, like most languages would do.
At one of my old jobs, we had a suite of browser tests that would run on PR. It’d stand up the application, open headless chrome, and click through stuff. This was the final end-to-end test suite to make sure that yes, you can still log in and everything plays nicely together.
Developers were constantly pinging slack about “why is this test broken??”. Most of the time, the error message would be like “Never found an element matching css selector #whatever” or “Element with css selector #loading-spinner never went away”. There’d be screenshots and logs, and usually when you’d look you’d see like the loading spinner was stuck, and the client had gotten a 400 back from the server because someone broke something.
We put a giant red box on the CI/CD page explaining what to do. Where to read the traces, reminding them there’s a screenshot, etc. Still got questions.
I put a giant ascii cat in the test output, right before the error trace, with instructions in a word bubble. People would ping me, “why is this test broken?”. I’d say “What did the cat say?” They’d say “What cat?” And I’d know they hadn’t even looked at the error message.
There’s a kind of learned helplessness with some developers and tests. It’s weird.
Is the backend Python and the frontend JavaScript? Because then that would happen and just be normal, because Boolean true is
True
in python.
You know how scam emails intentionally include mistakes because they want to filter out smart people? Same idea.
Reasonably smart people will see this and go “this is garbage”. The idiots will go deeper, and become loyal gop voters.