this post was submitted on 03 Aug 2023
488 points (99.4% liked)

Programmer Humor

19512 readers
474 users here now

Welcome to Programmer Humor!

This is a place where you can post jokes, memes, humor, etc. related to programming!

For sharing awful code theres also Programming Horror.

Rules

founded 1 year ago
MODERATORS
 
all 46 comments
sorted by: hot top controversial new old
[–] Mikina@programming.dev 51 points 1 year ago* (last edited 1 year ago) (1 children)

My favorite story about docs is when I tried implementing multithreaded Raycast in Unity.

I needed it to hit multiple targets per ray. Should be pretty easy, after all - there is this parameter right in the constructor:

maxHits: The maximum number of Colliders the ray can hit.

And this is how you use it, straight from the docs:

The result for a command at index N in the command buffer will be stored at index N * maxHits in the results buffer.

If maxHits is larger than the actual number of results for the command the result buffer will contain some invalid results which did not hit anything. The first invalid result is identified by the collider being null. The second and later invalid results are not written to by the raycast command so their colliders are not guaranteed to be null. When iterating over the results the loop should stop when the first invalid result is found.

Well, no. It's not working like that. I was always getting just a single hit, but sometimes, I received two or more hits. After a few days of debugging, I have found a typo in bubblesort, which caused the multiple hits, and I was in fact getting only one hit every time.

Strange, must be a bug then. And then I found it. A bug report from 3 years ago. But it was closed as solved. And the resolution?

I have some news about the issue where RaycastCommand will only return a maximum of 1 hit regardless what you set maxHits to.

According to our developers, each individual raycast in a batch only does a Raycast single in PhysX which will only return the first hit, and not multiple hits if the ray passes through several objects which would require a different raycast function. The documentation simply doesn't explain this very well.

The docs above are from 2021. Three years after this. The fuck "doesn't simply explain it very well"? It literally explains it pretty damn well.

But looks like they've finally changed the docs for 2022+ at least, it did happen few years ago.

[–] Psaldorn@lemmy.world 9 points 1 year ago (1 children)

Ah, reminds me trying to implement multiplayer just as there was some churn regarding unet/llapi/hlapi and every update something would break.

I just gave up. Add it to the failed projects list.

[–] Mikina@programming.dev 3 points 1 year ago (1 children)

We've once received an investor offer from a major studio for our game we are making since college in our free time, but the catch was that they wanted us to implement online multiplayer into a coop-only top-down shooter we've been actively making in our free time for the past 4 years at that point.

We ultimately rejected the offer, even though we managed to get a prototype working. MP is such a pain to implement in the first place, and adding it into an almost finished game is near impossible. But, if you ever resume the project you've scratched due to unet being awfull, I highly recommend checking out Mirror. It's free, open-source and has an amazing Discord community - every time I had an issue or needed help with something, there was someone willing to help me there.

[–] Psaldorn@lemmy.world 1 points 1 year ago

Sweet thanks!

[–] Sheltac@lemmy.ml 27 points 1 year ago (3 children)

Because things keep changing and no one ever updates any docs or guides.

[–] BlueKey@kbin.social 17 points 1 year ago (2 children)

It would be nice to have a kind of central hub where all the lastest resources are listed.
I could be updated by the community.

Well... one can dream.

[–] narc0tic_bird@lemm.ee 14 points 1 year ago (2 children)

If it's updated by the community, it's probably also created by the community. Instead of dreaming, why not create it?

[–] Sheltac@lemmy.ml 8 points 1 year ago

Be the change you want to see in the world 🌈

[–] GammaGames@beehaw.org 3 points 1 year ago

Stack Overflow tried that with their documentation project

[–] NerdyPopRocks@programming.dev 2 points 1 year ago

Someone should build a system that scrapes all open source repositories and uses an LLM to generate up to date documentation, and puts it in one big searchable place

If using docstrings/docblocks to generate SDK documentation, adding something like an OPA policy to validate their existence and semantic structure could help with coverage. Then we have the issue of accuracy, and that needs humans or AI to weigh in. I have a feeling test-driven development would make this process smoother.

You could also add git hooks to facilitate accountability / run the policies.

[–] whatisallthis@lemm.ee 19 points 1 year ago (1 children)

Yeah I built a few react apps that made it to production about 7 years ago.

Now the react syntax I used back then is basically a dead language.

[–] NatoBoram@lemm.ee 3 points 1 year ago

Pretty typical in web frameworks tbh

[–] jrandiny@lemmy.world 16 points 1 year ago (2 children)

This is why having a dedicated person/team to maintain docs is very important

[–] Dharkstare@kbin.social 13 points 1 year ago

I've always felt that programmers need one day out of the week where they explain what their code does to someone dedicated to writing documentation. That way the code is being documented while you still understand what it does and the documentation is constantly being updated.

[–] Gecko@lemmy.world 7 points 1 year ago

Also why having doc comments and docs generated from code are super useful. When someone changes the code but not the comment above, it becomes really obvious that something was missed as opposed to having code and doc changes be two separate tasks.

[–] Dax87@forum.stellarcastle.net 11 points 1 year ago* (last edited 1 year ago) (2 children)

I also feel like agile methodology, which is becoming more common, works against documentation with the fail fast fail often philosophy. If your feedback loop with your stakeholder is rapid, then changes to the design plan are often and rapid as well, which requires more documentation change overhead, which makes documentation even less appealing.

In fact SAFe Agile emphasizes working software over comprehensive documentation.

[–] blackstrat@lemmy.fwgx.uk 5 points 1 year ago

SAFe Agile can go fuck itself. It's the worst of everything, isn't actually agile and is a disease infesting corporations who don't know any better.

All these methodologies and philosophies are all invented so a few people can sell books, training and lectures.

[–] eluvatar@programming.dev 2 points 1 year ago

I feel like agile is better for Apps (which requires very little documentation usually, no one wants to read a help guide for an app), compared to Libraries which are literally unusable without documentation.

[–] atyaz@reddthat.com 10 points 1 year ago (1 children)

I know some people don't have the choice but if you do, please choose something better. That garbage does not deserve your effort.

[–] BlueBockser@programming.dev 4 points 1 year ago (1 children)

It's not garbage, it just has some flaws - as does everything. The Spring and Java/JVM ecosystem can be a huge advantage if you know how to use it - which sometimes means diving into library code when docs aren't sufficient.

[–] atyaz@reddthat.com 12 points 1 year ago

As someone who uses Django every day, I can tell you that the code is almost secondary to the amazing documentation. The documentation is such a core part of a framework that I don't see how it can be usable without really good and up to date documentation.

The fact that spring boot's documentation is so bad that it's impossible to even find a reference for a class you're using is, I'm sorry to say, garbage.

[–] pjhenry1216@kbin.social 9 points 1 year ago

I'm all for progress in technology but sometimes there's a disconnect between planning/budgeting and how it progresses way so fast like when it has a large corporation supporting it's development but folks are writing apps with like two person teams and sustaining these projects for years and need to decide "is today the day I rewrite the whole project to bring it up to date or do I fix that one bug and implement that feature the customer wants?". I swear just keeping code up to date is at least one or two FTEs but it's never included in a budget.

[–] bjornp_@lemm.ee 7 points 1 year ago (2 children)

Spring Boot is the worst for this. It seems like every minor update deprecates some security classes which yields a few hours of effort to implement the same damn thing every week

I've worked in both android and spring boot and rewriting your security to use a filter chain is nothing* compared to the shenanigans google likes to pull. Keeping up with the deprecations and imaginary "best practices" is half the job. It's like someone combined the worst parts of react with the worst Java timeline and forced people to write inscutable spaghetti that's completely impractical/impossible to test.

*there are valid criticisms of spring security, but I think this particular change improved things, even if it felt pointless

[–] eluvatar@programming.dev 2 points 1 year ago

Man, early dotnet core was like that, but thankfully it's been stable since 3 or 5.

[–] theGimpboy@lemmy.world 6 points 1 year ago

There's a lot of things you can criticize Microsoft for but their documentation is 🧑‍🍳

[–] GeraldEstaban@exploding-heads.com 6 points 1 year ago (1 children)

Because developers have a problem of getting bored with things that already work and want to fix what isn't broken or invent new things.

[–] nintendiator@feddit.cl 4 points 1 year ago (1 children)
[–] GeraldEstaban@exploding-heads.com 3 points 1 year ago (1 children)

Very interesting, I guess it does make sense. Writing code is much more fun and exciting than debugging it and testing it.

Though the people who follow this model kind of give me the impression that they don't take it seriously like they should, it's not really work to them, they just see it as screwing around since they're taking the "fun" and "interesting" path over the practical and efficient path.

[–] nintendiator@feddit.cl 1 points 1 year ago

Though the people who follow this model kind of give me the impression that they don’t take it seriously like they should, it’s not really work to them, they just see it as screwing around since they’re taking the “fun” and “interesting” path over the practical and efficient path.

To be fair: No one is under any obligation to take coding "seriously like they should" unless they are under contract with at least a living wage. There is such thing as coding as a hobby, or coding to relax, and ofc coding to scratch your own itch; that freedom to code regardless of the resulting product is half of the entire point of free software.

[–] cabbagee@sopuli.xyz 5 points 1 year ago

I'm sticking around to see if someone has a good spring tutorial.

[–] Hupf@feddit.de 5 points 1 year ago (2 children)
[–] 9point6@lemmy.world 6 points 1 year ago

Someone's trying to be productive in Java

They should have used Quarkus /s

[–] redcalcium@lemmy.institute 5 points 1 year ago

Welcome to the churn where everything got replaced every 5 years and old stuff re-appear again as the hot new stuff every 15 years.

[–] tetrahedron@programming.dev 4 points 1 year ago

Unreal docs entered the chat

[–] lazyslacker@sh.itjust.works 4 points 1 year ago

Because developers don't bother with documentation. They either assert it's self documenting or they assert whatever it is was always intended to be temporary so it's not worth documenting.

[–] dartos@reddthat.com 1 points 1 year ago

After 10+ years doing go, js, and ruby, my company is moving me to a Java spring team.

I’ve been looking at baeldung tutorials to get up to speed with spring and reactor and it’s been a pretty good resource.

[–] nobody5050@midwest.social 1 points 1 year ago (1 children)
[–] buffet@lemmy.world 0 points 1 year ago (1 children)
[–] nobody5050@midwest.social 1 points 1 year ago (1 children)
[–] buffet@lemmy.world 1 points 1 year ago (1 children)
[–] nobody5050@midwest.social 1 points 1 year ago

Not much not much

[–] lorkano@lemmy.world 1 points 1 year ago

If you eventually get to the class that can replace it's not that bad. The worst case is when there is no replacement class at all