646
1 hour in Java (piefed.jeena.net)
top 50 comments
sorted by: hot top controversial new old
[-] lugal@sopuli.xyz 117 points 2 months ago

But one compiling error is Java is 7 run time errors in python.

There is a type error and you couldn't have known it beforehand? Thanks for nothing

[-] CanadaPlus@lemmy.sdf.org 47 points 2 months ago* (last edited 2 months ago)

I will confess that I get a sense of psychological comfort from strict typing, even though everyone agrees Python is faster for a quick hack. I usually go with Haskell for quick stuff.

[-] BlueKey@fedia.io 25 points 2 months ago

And then the quick hack gets a permanent solution and the next employee has to fight trough the spagetti.

[-] linkhidalgogato@lemmy.ml 5 points 2 months ago

sounds like not my problem

load more comments (2 replies)
[-] NeatNit@discuss.tchncs.de 3 points 2 months ago

This may be true, but it's equally true in any programming language, so not really relevant.

load more comments (8 replies)
load more comments (1 replies)
[-] Ephera@lemmy.ml 25 points 2 months ago

I find Python is quick for the first 30 minutes. If you need any kind of libraries, or assistance from an IDE, or a distribution build, or you're more familiar with another language, then it isn't quicker.

[-] zalgotext@sh.itjust.works 13 points 2 months ago

If you need any kind of libraries

PyPI has a huge selection of libraries

assistance from an IDE

PyCharm a super powerful IDE, VSCode has tons of Python extensions that L rival PyCharm's functionality, lots of other IDEs have decent python support

or a distribution build

Not sure exactly what you mean by this

or you're more familiar with another language

Yeah this can be said about any language. "You're quickest in the language you're most familiar with". That's basically a tautology.

[-] Ephera@lemmy.ml 18 points 2 months ago

Oh boy, you really wanna talk about it?

PyPI has a huge selection of libraries

It does, but the lack of static typing means it is more difficult to interact with foreign code (correctly).

When I pull in a library in a JVM language or Rust etc., I quickly glance at the documentation to get a rough idea of the entrypoint for the library.
Like, let's say I want to create a .tar file, then the short "Writing an archive" example tells me all I need to know to get started: https://crates.io/crates/tar

If I need to find out more, like how to add a directory, then having the tar Builder initialized is enough for me to just ask my code completion. It will tell me the other available functions + their documentation + what parameters they accept.
If I make a mistake, the compiler will immediately tell me.

In Python, my experience was completely different. Pulling in a library often meant genuinely reading through its documentation to figure out how to call it, because the auto-completion was always unreliable at best.
Some libraries' functions wouldn't even tell you what types you're allowed to feed into them, nor what type they return, and not even even diving into their code would help, because they just never had to actually specify it.

PyCharm a super powerful IDE, VSCode has tons of Python extensions that L rival PyCharm's functionality, lots of other IDEs have decent python support

Yes, PyCharm is a super powerful IDE when compared to Nodepad++. But it's a trashcan fire compared to IntelliJ or even the much younger RustRover.

Half the time it can't assist you, because no one knows what types your code even has at that point.
The other half of the time, it can't assist you, because, for whatever reason, the Python interpreter configured in it can't resolve the imports.
And the third half of the time, it can't assist you, because of what I already mentioned above, that the libraries you use just don't specify types.

These are problems I've encountered when working on a larger project with multiple sub-components. It cost us so much time and eventually seemed to just be impossible to fix, so I ended up coding in a plain text editor, because at least that wouldn't constantly color everything red despite there being no errors.

These problems are lessened for smaller projects, but in that case, you also don't need assistance from an IDE.

or a distribution build

Not sure exactly what you mean by this

What I mean by that is that Python tooling is terrible. There's five different ways to do everything, which you have to decide between, and in the end, they all have weird limitations (which is probably why four others exist).

or you're more familiar with another language

Yeah this can be said about any language. "You're quickest in the language you're most familiar with". That's basically a tautology.

Yes. That is all I wanted to say by that. People just often claim that Python is a great prototyping language, to the point where the guy I was responding to, felt they're doing the wrong thing by using the familiar tool instead. I'm telling them, they're not.

[-] tyler@programming.dev 5 points 2 months ago

What I mean by that is that Python tooling is terrible. There's five different ways to do everything, which you have to decide between, and in the end, they all have weird limitations (which is probably why four others exist).

There’s actually at least 15 different ways (the fifteenth one is called rye and it’s where I got that article from). And yes your entire post is super accurate. The pycharm thing is ridiculous too because RubyMine is excellent in comparison. You just pull in a library with Ruby’s excellent (singular) package manager, and then RubyMine is able to autocomplete it pretty much perfectly. PyCharm can’t even manage to figure out that you added a new dependency to whatever flavor of the week package manager you’re using this time.

[-] Ephera@lemmy.ml 4 points 2 months ago

Oh man, this isn't meant to shit talk Rye (from what I've heard of it, it actually is a decent effort), but it's literally this comic then:

load more comments (1 replies)
load more comments (2 replies)
load more comments (1 replies)
[-] lugal@sopuli.xyz 4 points 2 months ago

I wrote my bachelor's thesis in Haskell and have never touched it again.

[-] SpaceNoodle@lemmy.world 3 points 2 months ago

When did baccalaureate theses become a thing?

[-] lugal@sopuli.xyz 7 points 2 months ago

I don't know if you're trying to be funny or your autocorrect is, but in Germany, when they switched from diploma to the bachelor/master system, both bachelor and master come with a theses. Many people leave with a bachelor, especially in computer science, so that might be why. Don't know about other countries

load more comments (2 replies)
[-] CanadaPlus@lemmy.sdf.org 3 points 2 months ago

A lot of people feel that way. If I need to generate a set of numbers or a certain string, though, it's pretty easy to punch out a one-liner in GHCi, and that's usually my use case.

[-] Kache@lemm.ee 10 points 2 months ago

I find it's possible to operate Python as a statically typed language if you wanted, though it takes some setup with external tooling. It wasn't hard, but had to set up pyright, editor integration, configuration to type check strictly and along with tests, and CI.

I even find the type system to be far more powerful than how I remembered Java's to be (though I'm not familiar with the newest Java versions).

load more comments (1 replies)
[-] scrion@lemmy.world 9 points 2 months ago

With type annotations, this problem is mostly alleviated in practice, while still keeping the productivity gains of duck typing.

[-] Ephera@lemmy.ml 12 points 2 months ago

In my experience, Python's type annotations are annoying as hell, because there's no inference.

[-] catastrophicblues@lemmy.ca 4 points 2 months ago

You can use mypy and/or Pydantic.

[-] Ephera@lemmy.ml 11 points 2 months ago

Neither of those provide type inference? Type inference is when you give the compiler only occasional type hints and it can still figure out what the types are behind the scenes.

For example:

name = "World"
greeting = "Hello " + name
compile_error = greeting / 42

In a type-inferred language, the compiler would automatically know that:

  1. the first line is of type String, because it's trivially initiated as one.
  2. the second line is of type String, because String + String results in a String.
  3. the third line is non-sense, because greeting is a String and cannot be divided by a number. It could tell this before you run the program.

Mypy on the other hand can only tell these things, if you give the first two lines an explicit type hint:

name: String = "World"
greeting: String = "Hello " + name

Having to do this on every line of code is extremely noisy and makes refactoring annoying. I can absolutely understand that Python folks think you get productivity gains from duck typing, if this is the version of static typing they're presented.

And we did excessively use mypy + type hints + pydantic on my most recent Python project. These are not the silver bullet you think they are...

load more comments (1 replies)
[-] Sibbo@sopuli.xyz 6 points 2 months ago

In Java you get a bunch of unexpected NullPointerExceptions instead...

load more comments (1 replies)
load more comments (3 replies)
[-] thenextguy@lemmy.world 91 points 2 months ago

This little hack is gonna cost us 51 CPU cycles.

[-] voracitude@lemmy.world 43 points 2 months ago

And

++++++++ [>++++++++++++>+++++++++++++<<-] >++++. -. >+++++++. <+. +.

in brainfuck

[-] HairyHarry@lemmy.world 35 points 2 months ago* (last edited 2 months ago)
[-] lord_ryvan@ttrpg.network 12 points 2 months ago

Thanks, I hate it

[-] abcd@feddit.org 5 points 2 months ago

Good old brainfuck 👌

[-] Carighan@lemmy.world 42 points 2 months ago

Yeah but due to the extra indentation in the second image, the python party doesn't work.

[-] unreliable@discuss.tchncs.de 5 points 2 months ago

Sorry, are we talking about spaces or tabs? I want to comment on same indentation to not break the thread

[-] GluWu@lemm.ee 20 points 2 months ago

Java feels like McDonald's and python feels like a grocery store.

Rust feels like a femboi hooters where they offer IVs you don't think they're qualified to administer.

[-] 0x0@lemmy.dbzer0.com 61 points 2 months ago

I don't understand any of these analogies at all

[-] Sas@beehaw.org 4 points 2 months ago

Me neither but now I'm interested in Femboi-Hooters 👀

[-] tabarnaski@sh.itjust.works 14 points 2 months ago

Oddly specific

[-] rambling_lunatic@sh.itjust.works 6 points 2 months ago

C is a makeshift kitchen deep in the Lacandon Jungle. If you burn your food, you start a forest fire and die.

[-] masterspace@lemmy.ca 7 points 2 months ago* (last edited 2 months ago)

Python, Java/TypeScript, C#, Swift, Go...

[-] dohpaz42@lemmy.world 44 points 2 months ago
[-] meliaesc@lemmy.world 15 points 2 months ago
load more comments (4 replies)
[-] marlowe221@lemmy.world 5 points 2 months ago

Ah, the list of required skills on the last job posting I looked at…

[-] auzy@lemmy.world 3 points 2 months ago

And about 20 in perl. But the return trip is 300 years

load more comments
view more: next ›
this post was submitted on 17 Aug 2024
646 points (95.5% liked)

Programmer Humor

32410 readers
325 users here now

Post funny things about programming here! (Or just rant about your favourite programming language.)

Rules:

founded 5 years ago
MODERATORS