this post was submitted on 17 Aug 2024
393 points (100.0% liked)

Programmer Humor

854 readers
1 users here now

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

Rules:

founded 5 years ago
MODERATORS
 
you are viewing a single comment's thread
view the rest of the comments
[–] lugal@sopuli.xyz 68 points 3 months ago (4 children)

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 36 points 3 months ago* (last edited 3 months ago) (3 children)

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.

[–] Ephera@lemmy.ml 19 points 3 months ago (1 children)

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.

[–] CanadaPlus@lemmy.sdf.org 2 points 3 months ago

I won't feel bad about it then, lol. At least not until I'm collabing on something and they want to use Python.

[–] BlueKey@fedia.io 16 points 3 months ago (3 children)

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

[–] linkhidalgogato@lemmy.ml 5 points 3 months ago (1 children)
[–] Luvon 3 points 3 months ago (1 children)

You will find yourself being that next person when you haven’t touched the code for a week and come back to add something and are like wtf.

[–] embed_me@programming.dev 1 points 3 months ago

The circle of 1!f€

[–] NeatNit@discuss.tchncs.de 3 points 3 months ago (1 children)

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

[–] CanadaPlus@lemmy.sdf.org 1 points 3 months ago (1 children)

I'd guess it's less true for something statically typed, just because that reduces the ways it can be unintuitive.

[–] NeatNit@discuss.tchncs.de 1 points 3 months ago (1 children)

I firmly believe that every language has an equal proportion of spaghetti code to clean code. The only factor that might screw with this is how much a language is used in industry, which I'd expect raises the ratio. However, there's plenty of hobbyists writing spaghetti code too so I don't think even that factor has much effect.

[–] CanadaPlus@lemmy.sdf.org 1 points 3 months ago (1 children)

Really? Doesn't that imply non-spaghetti brainfuck or assembly?

[–] NeatNit@discuss.tchncs.de 1 points 3 months ago (1 children)

Okay, I'll grant you brainfuck... As for assembly, I don't think it's inherently spaghetti. You can split it up into functions just like you can with an actual programming language. It's not impossible to make structured code.

That said, I never coded assembly outside of a mandatory university course, so I don't feel super confident in saying that. But I don't think of it as a programming language anyway - it's a 1:1 translation to/from machine code, and machine code isn't meant to make programming easy or scalable.

[–] CanadaPlus@lemmy.sdf.org 2 points 3 months ago* (last edited 3 months ago) (2 children)

And TBF neither is brainfuck. It was a bit of a cheeky example, but I wanted to really emphasise the range of differences between languages, and language-like things.

I have trouble believing that every language is exactly as easy to organise code in. I'll give you that it's possible in every language (and assembly) to organise code, but that's far too low a bar for practical measurement. Technically you can dig a ditch with a rusty spoon, too...

If Roller Coaster Tycoon had well organised code, that was down to way more effort being expended to make it that way.

[–] NeatNit@discuss.tchncs.de 1 points 3 months ago

I think we're going to have to agree to disagree. If any project in any language has well-organized code, it's down to a ton of effort.

Assembly is harder to code in, period. It's even harder when your code is a total mess and you didn't plan ahead. For a large assembly project to survive at all, some structure is as necessary as oxygen. And not to mention, there are far fewer projects written in assembly anyway.

[–] NeatNit@discuss.tchncs.de 1 points 3 months ago (1 children)

Oh, and if you really want a tough language, try Malbolge. The ratio of structured code to spaghetti code in that one is 0:1 - there are 0 instances of non-spaghetti code, and 1 instance of spaghetti code. I refuse to believe there's any more code other than the Hello World example.

[–] CanadaPlus@lemmy.sdf.org 2 points 3 months ago

You know, it must have taken some balls to publicly release a compiler you can't even test yourself.

[–] CanadaPlus@lemmy.sdf.org 1 points 3 months ago
[–] lugal@sopuli.xyz 1 points 3 months ago (1 children)

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

[–] CanadaPlus@lemmy.sdf.org 2 points 3 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.

[–] zaphod@sopuli.xyz 7 points 3 months ago

Did everyone become stupid in the last 10 or so years? We used to write huge apps in Python without any type checkers or static analysis tools and never had any problems we wouldn't have had in statically typed languages.

[–] Sibbo@sopuli.xyz 6 points 3 months ago

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

[–] Kache@lemm.ee 5 points 3 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).