There have been multiple accounts created with the sole purpose of posting advertisement posts or replies containing unsolicited advertising.

Accounts which solely post advertisements, or persistently post them may be terminated.

programmer_humor

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

unreachable , in <br>
@unreachable@lemmy.world avatar

elements go <br>

AnomalousBit , in everywhere I go

JavaScript is so ass, typescript is just putting ketchup on a rotten banana. Better just to choke it down quickly if you have to eat it, IMO.

skulbuny ,
@skulbuny@sh.itjust.works avatar

I wouldn’t say JavaScript is horrible, it’s a fine little language to do general things in if you know JS well. I would say, though, that it is not a great language. Give me F# and I’m happy forever. I do not like typescript that much more than JS.

felbane ,

PHP is better than Javascript these days.

Fucking PHP.

The only thing JS really has going for it is ease of execution, since any browser can run your code… though the ubiquity of Python is closing that gap.

Feathercrown ,

I’ll bite. Why JS bad?

Zangoose ,

Short answer:

https://lemmy.world/pictrs/image/420455fa-3b0a-46eb-b4b6-ef8e6faa86f5.png

Long answer:

There are a lot of gatcha moments in JS with weird behavior that makes it really easy to shoot yourself in the foot. It does get better as you get more experience but a lot of the oddities probably shouldn’t have existed to begin with. For what it was originally intended for (adding light scripting to websites) it’s fine but it very quickly gets out of hand the more you try to scale it up to larger codebases. TypeScript helps a little bit but the existence (and common usage) of ‘any’ has the potential to completely ruin any type safety guarantees TypeScript is intended to provide.

Feathercrown ,

It’s always the type coersion. Just use === and 90% of the “footguns” people complain about go away.

Zangoose ,

That’s true but at the same time the fact that JavaScript equality is so broken that they needed a === operator is exactly the problem I’m talking about.

And those examples were low hanging fruit but there are a million other ways JavaScript just makes it easy to write buggy code that doesn’t scale because the JavaScript abstraction hides everything that’s actually going on.

For example, all of the list abstractions (map, filter, reduce, etc.) will copy the array to a new list every time you chain them. Doing something like .filter(condition).map(to new value) will copy the list twice and iterate over each new list separately. In most other languages (Java, C#, Rust, Go, etc.) the list abstractions are done over some sort of iterator or stream before being converted back into a list so that the copy only has to be done once. This makes using list abstractions pretty slow in JavaScript, especially when you have to chain multiple of them.

Another simple but really annoying thing that I’ve seen cause a lot of bugs - Array.sort will convert everything into strings and then sort if you don’t give it a comparison function. Yes, even with a list of numbers. [ -2, -1, 1, 2, 10 ] will become [ -1, -2, 1, 10, 2 ] when you sort it unless you pass in a function. But if you’re looking over code you wrote to check it, seeing a list.sort() won’t necessarily stand out to most people as looking incorrect, but the behavior doesn’t match what most people would assume.

All this is also without even getting started on the million JS frameworks and libraries which make it really easy to have vendor lock-in and version lock-in at the same time because upgrading or switching packages frequently requires a lot of changes unless you’re specifically isolating libraries to be useful (see any UI package x, and then the additional version x-react or x-angular)

Tldr; Why can’t we have nice things JS?

madeindjs ,

For example, all of the list abstractions (map, filter, reduce, etc.) will copy the array to a new list every time you chain them.

This methods were added to generator recently. So you can avoid copying the array in memory.

All this is also without even getting started on the million JS frameworks and libraries which make it really easy to have vendor lock-in and version lock-in at the same time

In my opinion, it’s also what make JS good. There a package for almost everything.

Feathercrown ,

This is all true, although I don’t think it warrants saying that it’s worse than PHP.

Zangoose ,

That’s fair. I was mostly commenting on my own experiences with JS/TS, I’ve never used PHP so I can’t say if it’s better or worse but a few people I know have said that modern PHP is actually pretty good for personal projects. I’m guessing it would have its own set of nightmares if it was scaled to an enterprise level though.

souless ,

To its credit JavaScript has made quite a few improvements to the underlying structure since 2016. JS is one of the most used languages because it is fast to adapt to changing environments along with wide support.

It is not a safe language by any means, it can be easy to fall down holes of unwarranted expectations. Like any language once understanding limitations will open up its power and potential.

hswolf ,
@hswolf@lemmy.world avatar

that’s crazy, it’s almost like it was created to run on a browser, who would do such an evil thing?

xlash123 ,
@xlash123@sh.itjust.works avatar

Back when I was still doing JS stuff, switching to TS was so good for the developer experience. Yeah, there’s still JS jank, and types are not validated at runtime, which was a pain in the backend (pun intended), but still I much prefer it to vanilla JS

lemmyvore ,

You know, you can validate data structures at runtime… and write unit tests… TS is not a substitute for those things.

AlecSadler , in everywhere I go

In my defense, the backend contracts change so often in early development the any just made sense at first…

…and then the delivery date was moved up and we all just had to ship it…

…and then half of us got laid off so now there are no resources to go back and fix it…

…rinse, wash, repeat

count_dongulus ,

Use the unknown type so at least someone might have enough brain cells to validate before casting because squiggles

steuls ,

Its sad how relatable this is

marcos ,

I’d guess the lack of defined backend contracts is caused by the same issue that made you unable to fix those any later.

Anyway, the frontend / backend split is stupid and ridiculous. It’s even worse because both sides usually include tasks that do need to be split up.

bleistift2 ,

In my defense, the backend contracts change so often in early development the any just made sense at first…

Refactorings and changes are the prime reason to use TypeScript. You edit your data objects and get squigglies everywhere shit won’t work anymore. A godsend!

AlecSadler ,

110% agree. But…

One job I worked at wouldn’t let us do this because it created too large of a QA impact (lol). We were only allowed to modify code in the smallest section possible so that testing could be isolated and go faster.

At another job they mandated that TypeScript wasn’t allowed because it “slowed down development”. It was soooo laughable. The number of bugs introduced that could have been readily caught was absurd, but management never put the two pieces together.

lemmyvore ,

Typescript only prevents typing bugs… why did they have so many typing bugs?

AlecSadler ,

Typo’d property names when accessing was the biggest one. Assuming a property was one data type instead of another and not casting or handling it appropriately. Accidentally calling something like it’s a method when it isn’t.

I ran a bunch of plugins on my end to help with some of that, but many of the older or stubborn devs refused and would refuse anything but, like, vim with no add-ons.

bleistift2 ,

Elderly team mates with the flexibility of concrete, yay!

bleistift2 ,

I believe you don’t have to actually use (meaning “compile from”) typescript to profit from it. If you maul the compiler options hard enough, you might get it to analyze JavaScript and provide type checking.

AlecSadler ,

That’s what I did locally.

But a lot of this JavaScript wasn’t even transpiled/compiled for prod, just uploaded to a bucket and referenced directly. It was painful.

lemmyvore ,

Oof. I guess you can use typescript to make up for lack of IDE but it sounds like you had bigger problems anyway.

gravitas_deficiency ,

Sadly, this is the way.

hswolf ,
@hswolf@lemmy.world avatar

Record<string, unknown> ftw

PepperoniNipple , in Googling

Imagine the dude brings his homemade pizza with glue as lunch

hperrin , in everywhere I go

as unknown as any

Crackhappy , in Crowdstrike
@Crackhappy@lemmy.world avatar

This is entirely fake.

Coreidan ,

Like you

Crackhappy ,
@Crackhappy@lemmy.world avatar

Boom. Nice shot.

lseif ,

but op is verified

Crackhappy ,
@Crackhappy@lemmy.world avatar

Fuck me. I forgot to pay daddy musk to be verified.

SkunkWorkz ,
tweeks ,

What if it was a form of damage control, where they could claim in the future at lawsuits that they had total transparency at the time of the event.

Please, I’m kidding. But it would be interesting.

Kolanaki , in Googling
@Kolanaki@yiffit.net avatar

I make myself stand out by phrasing it as “my google-fu is strong.”

jaschen ,

If you apply for Microsoft, you gotta say bing-fu.

boredtortoise ,

I’ve had a person not get what is google-fu

ArmokGoB , in OneDrive deleted my files!

It took me two days to gut OneDrive out of my laptop when I bought it.

Kojichan , in Read only friday
@Kojichan@lemmy.world avatar

Ugh. Definite mood. I had to update a database of over 200k entries, live, during prime time…

Ah well. :Do Weekend!

skuzz , in OneDrive deleted my files!

OneDrive is the devil. It symlinks the file structure on Windows and then moves all your photos and such into their chosen directory. If you uninstall it, it makes a half-hearted attempt to move them back, maybe, but will just do a random subset and give up.

After removal, you have to edit registry keys (obscure ones) to break Windows’ connection to onedrive\pictures and such, or you end up with two pictures folders in your home dir.

So much more fail I can’t even remember right now.

xilliah ,

Another brick in the wall

Anticorp , in Googling

I moved a guy forward in an interview process once who had literally zero corporate experience at all. It was for a senior website engineer position, and the guy had somehow never had a job before in his life at like 45 years old. He played in a band for a while, and was a stay at home dad after that. I moved him forward because he was a really interesting guy, he seemed passionate about creating things, and his technical aptitude was passable and could be improved. He didn’t make it past the other stages of the interview process, but I was definitely ready to give him a chance.

quicksand ,

That sounds like good traits for a junior or internship role.

match , in Crowdstrike
@match@pawb.social avatar

boat stuck 2: bloatstuck

njm1314 , in Googling

I have so many weird things on my resume just because that’s what job descriptions ask for. Like 10 job descriptions I was applying to ask for number key skills, which doesn’t seem like a skill to me but if they want it on there I got to have it on my resume or I won’t get an interview

funkless_eck ,

I leave space in my resume template, and every job I run through chatgpt for a list of skills. Add them in, spin up a cover letter same process and send.

lseif , in OneDrive deleted my files!

i had the same thing a while back. i thought i disabled onedrive from running on my machine, went to delete some onedrive files because i was “running out of space”, and deleted all the user files on my system

Solemarc , in Malware As A Service

Maybe this is a case of hindsight being 20/20 but wouldn’t they have caught this if they tried pushing the file to a test machine first?

tabularasa ,

It’s not hindsight, it’s common sense. It’s gross negligence on CS’s part 100%

JackbyDev ,

Well, it is hindsight 20/20… But also, it’s a lesson many people have already learned. There’s a reason people use canary deployments lol. Learning from other people’s failures is important. So I agree, they should’ve seen the possibility.

Gsus4 ,
@Gsus4@programming.dev avatar

I saw one rumor where they uploaded a gibberish file for some reason. In another, there was a Windows update that shipped just before they uploaded their well-tested update. The first is easy to avoid with a checksum. The second…I’m not sure…maybe only allow the installation if the windows update versions match (checksum again) :D

dariusj18 ,

Windows has beta channels for their updates

undu ,

It’s a sequence of problems that lead to this:

  • The kernel driver should have parsed the update, or at a minimum it should have validated a signature, before trying to load it.
  • There should not have been a mechanism to bypass Microsoft’s certification.
  • Microsoft should never have certified and signed a kernel driver that loads code without any kind signature verification, probably not at all.

Many people say Microsoft are not at fault here, but I believe they share the blame, they are responsible when they actually certify the kernel drivers that get shipped to customers.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • [email protected]
  • random
  • lifeLocal
  • goranko
  • All magazines