this post was submitted on 17 Sep 2024
403 points (97.6% liked)

Programmer Humor

19821 readers
817 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 2 years ago
MODERATORS
 
top 37 comments
sorted by: hot top controversial new old
[–] sbv@sh.itjust.works 64 points 3 months ago (6 children)

I love shitting on Python, but I feel like all those problems are present in libraries for other languages as well. There's a tonne of that crap for JS/TS.

Similarly, I find a fair number of Rust crates (that I want to use) have virtually no doc or inline examples, and use weird metaprogramming that I can't wrap my head around.

[–] thebardingreen@lemmy.starlightkel.xyz 59 points 3 months ago (2 children)

Are we living in a world in which the JS/TS ecosystem is the yardstick by which we measure well written code? I mean... Wait a minute! I figured it out! This is the Bad Place!

[–] NegativeInf@lemmy.world 25 points 3 months ago

What took you so long?

[–] SkaveRat@discuss.tchncs.de 10 points 3 months ago

Every time I have a problem, I throw a regex on it, and BOOOOM, right away I have a different problem

[–] Ephera@lemmy.ml 24 points 3 months ago

I mean, if we're talking about all those problems, the no-type-annotations issue is rather specific for Python, JS/TS and Ruby.

But in general, I feel like there's somewhat of an old world vs. new world divide, which happened when package registries started accepting libraries from everyone and their cat.

In C, for example, most libraries you'll use will be quite well-documented, but you'll also never hear of the library that Greg's cat started writing for the niche thing that you're trying to do.

Unfortunately, Greg's cat got distracted by a ball of yarn rolling by and then that was more fun than writing documentation.
That's the tradeoff, you get access to more libraries, but you just can't expect all of them to be extremely high-quality...

[–] Pacmanlives@lemmy.world 10 points 3 months ago (1 children)

You should look at some old Perl or C code. I have even seen some shell code that makes me want to bash my head in till death with an IBM Model M Keyboard

[–] SkaveRat@discuss.tchncs.de 15 points 3 months ago

That's why they named the shell like that

[–] leisesprecher@feddit.org 4 points 3 months ago (1 children)

I feel like there's a very fine balance for the effort required to publish a package.

Too easy and you get npm.

Too hard and you get an empty repo.

I feel like Java is actually doing a relatively good job here. Most packages are at least documented a bit, though obviously many are outdated.

[–] expr@programming.dev 2 points 3 months ago

Uh, there are an absolute fuckload of Java libs out there with nothing more than auto-generated garbage Javadocs.

[–] aspensmonster@lemmygrad.ml 4 points 3 months ago (1 children)

Similarly, I find a fair number of Rust crates (that I want to use) have virtually no doc or inline examples, and use weird metaprogramming that I can’t wrap my head around.

Is it really a true rust crate if it doesn't contain at least one inscrutable macro?

[–] kjaeselrek@lemmy.ml 4 points 3 months ago (1 children)

It’s one of the macro_rules!

[–] kjaeselrek@lemmy.ml 1 points 3 months ago

Not even one full day after posting this and here I am debugging one of my own inscrutable macros for a version upgrade lmao.

[–] GBU_28@lemm.ee 2 points 3 months ago

Lol also the importing of lpad and iseven

[–] sus@programming.dev 41 points 3 months ago

bonus points if you're using a statically typed language but the library uses extensive metaprogramming seemingly for the sole purpose of hiding what types you actually need

[–] AlexWIWA@lemmy.ml 14 points 3 months ago (4 children)

It's still crazy to me that Django doesn't have type hints.

[–] misterbngo@awful.systems 5 points 3 months ago (1 children)
[–] salmoura@lemmy.eco.br 2 points 3 months ago (2 children)

Will you share the source?

[–] misterbngo@awful.systems 7 points 3 months ago (1 children)
[–] AlexWIWA@lemmy.ml 3 points 3 months ago (1 children)

I disagree with them, but I'm also not the one that would be spending days adding support, so fair enough.

[–] zalgotext@sh.itjust.works 5 points 3 months ago

That thread is from like 4 years ago, types in Python have come a long way since then. Maybe they'd reconsider if the community brought it back up

[–] zalgotext@sh.itjust.works 4 points 3 months ago

The django-stubs package is decent though

[–] wasabi@feddit.org 2 points 3 months ago (1 children)
[–] AlexWIWA@lemmy.ml 2 points 3 months ago (1 children)
[–] fossphi@lemm.ee 3 points 3 months ago

One more reason to add to my hate list for kubernetes

[–] Midnitte@beehaw.org 1 points 3 months ago (1 children)

Flask does - maybe a reason to switch? Lol

[–] AlexWIWA@lemmy.ml 1 points 3 months ago

I have been meaning to try it

[–] JackbyDev@programming.dev 12 points 3 months ago

This is probably my biggest complaint about trying to learn Python past the beginner level and into intermediate and beyond. This is also one of my strongest arguments in favor of static type systems over dynamic ones.

[–] dudinax@programming.dev 11 points 3 months ago (1 children)

Rust crates have the second and third problems.

Rust at least has type annotation.

The type has private fields. There's no constructor. There's no implementation of the From trait except on itself. You can't find a function anywhere that returns the type.

[–] KindaABigDyl@programming.dev 9 points 3 months ago

I find Rust crates generally have pretty good docs. Docs.rs is a major time saver

[–] Evil_Shrubbery@lemm.ee 9 points 3 months ago* (last edited 3 months ago)

Using cryptic parameter names is just nonsense when you can obviously use lewd cryptic parameter names instead.

[–] AVincentInSpace@pawb.social 8 points 3 months ago (1 children)

you should learn Rust. the type system is so comprehensive that half the time you can guess what a function does (or at the very least what you're supposed to pass to it) without a single line of human written documentation.

[–] kaffiene@lemmy.world 1 points 3 months ago

My problem with Rust is that I find refactoring really painful.

[–] umbrella@lemmy.ml 7 points 3 months ago

also how they are used as backdoors nowadays

[–] mvirts@lemmy.world 5 points 3 months ago

And now we have free threads so I can't say at least you don't have normal concurrency problems 🤣

[–] kaffiene@lemmy.world 3 points 3 months ago

I really like Python. The only thing I don't want to do with Python is support a large code base. Lack of strict typing makes refactoring awful

[–] Reptorian@programming.dev 1 points 3 months ago* (last edited 3 months ago)

I'm just glad I have other options than just Python. Am not afraid of writing my solutions either. I rarely use Python these day.