- lugal ( @lugal@sopuli.xyz ) 67•1 month 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 ( @CanadaPlus@lemmy.sdf.org ) 36•1 month 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.
- Ephera ( @Ephera@lemmy.ml ) 19•1 month 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.
- CanadaPlus ( @CanadaPlus@lemmy.sdf.org ) 2•1 month 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 ( @BlueKey@fedia.io ) 16•1 month ago
And then the quick hack gets a permanent solution and the next employee has to fight trough the spagetti.
- linkhidalgogato ( @linkhidalgogato@lemmy.ml ) 5•1 month ago
sounds like not my problem
- Luvon ( @Luvon@beehaw.org ) 3•1 month ago
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 ( @embed_me@programming.dev ) 1•1 month ago
The circle of 1!f€
- NeatNit ( @NeatNit@discuss.tchncs.de ) 3•1 month ago
This may be true, but it’s equally true in any programming language, so not really relevant.
- CanadaPlus ( @CanadaPlus@lemmy.sdf.org ) 1•1 month ago
I’d guess it’s less true for something statically typed, just because that reduces the ways it can be unintuitive.
- NeatNit ( @NeatNit@discuss.tchncs.de ) 1•1 month ago
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 ( @CanadaPlus@lemmy.sdf.org ) 1•30 days ago
Really? Doesn’t that imply non-spaghetti brainfuck or assembly?
- NeatNit ( @NeatNit@discuss.tchncs.de ) 1•30 days ago
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 ( @CanadaPlus@lemmy.sdf.org ) 1•1 month ago
Such is life.
- lugal ( @lugal@sopuli.xyz ) 1•1 month ago
I wrote my bachelor’s thesis in Haskell and have never touched it again.
- CanadaPlus ( @CanadaPlus@lemmy.sdf.org ) 2•1 month 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 ( @zaphod@sopuli.xyz ) 7•30 days 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 ( @Sibbo@sopuli.xyz ) 6•30 days ago
In Java you get a bunch of unexpected NullPointerExceptions instead…
- Kache ( @Kache@lemm.ee ) 5•1 month 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).
- GluWu ( @GluWu@lemm.ee ) English23•1 month 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.
- Trailblazing Braille Taser ( @0x0@lemmy.dbzer0.com ) 38•1 month ago
I don’t understand any of these analogies at all
- Sas [she/her] ( @Sas@beehaw.org ) 5•1 month ago
Me neither but now I’m interested in Femboi-Hooters 👀
- masterspace ( @masterspace@lemmy.ca ) English8•1 month ago
Python, Java/TypeScript, C#, Swift, Go…
- GravitySpoiled ( @GravitySpoiled@lemmy.ml ) English4•1 month ago
And a second in julia
- C0MPL3X4 ( @C0MPL3X4@programming.dev ) 29•1 month ago
It’s about writing the code, not execution time. Otherwise Assembly wouldn’t take 7 years…
- jjjalljs ( @jjjalljs@ttrpg.network ) 5•1 month ago
Some languages are just worse to work with. like JavaScript. Console.log is like sure I’ll log your object but I’ll tell you what it is now, not what it was when you logged it.
- Skull giver ( @skullgiver@popplesburger.hilciferous.nl ) 5•1 month ago
Fwiw, Javascript’s object logging is a feature I often miss in other languages. If you just want to log the string, use formatted strings or just log obj+“” like you would need to do in every other language. Or even better, log a copy, like you probably wanted to do, with {…obj}.
I have many gripes with Javascript, but the logging API is pretty solid.
- Ephera ( @Ephera@lemmy.ml ) 2•1 month ago
I’d just like to highlight what you mention below: Logging it as an object allows you to inspect it in the browser console, presumably with some JSON tree representation, rather than just a dumb string.
It’s described in the “Outputting a single object” example here: https://developer.mozilla.org/en-US/docs/Web/API/console#examples
- jjjalljs ( @jjjalljs@ttrpg.network ) 2•1 month ago
I’ve never had a complaint about logging stuff in python. It generally does what I expect.
“Create a copy of your object and print that” is what I ended up doing, but I don’t think most people would say that’s intuitive. I expect if i print something at a particular time, I get what it is at that point in time.
- Skull giver ( @skullgiver@popplesburger.hilciferous.nl ) 1•1 month ago
Javascript passes objects by reference in most cases. Passing logging objects by copy would actually be an anomaly within the language. The only unexpected part is that the browser console doesn’t toString your objects instantly (for performance reasons mostly), but the same happens in other frameworks for other languages (though often with less latency, milliseconds most of the time).
As I’ve personally experienced, this can make debugging concurrency issues real fun! Pre-composing your log messages as a string (within the same critical section) will prevent quite a few weird edge cases.
The Python console doesn’t allow you to expand and dig deep into the object hirerachy of the thing you’re dumping. You either implement a string conversion handler or manually convert the object to a string as well, whereas Javascript doesn’t need the extra string pass and doesn’t flatten the log hierarchy. There are a few JSON logging frameworks you can combine with log aggregators that provide the same functionality, but that’s quite heavy and complicated to set up.
- BeigeAgenda ( @BeigeAgenda@lemmy.ca ) 2•1 month ago
And 42 seconds in jython.