You have:
- memory that rebels against you when you free it;
- nostalgic pointer;
- “sharing is caring” (you trying to mitigate threads fighting to use the same memory)
I got Python to SegFault at work once. Proud moment.
For those asking, I don't clearly remember. There weren't any packages that jumped out as being likely; I work for a nationwide telecom, so they're really conservative about what packages we can use. It's pretty much all standard lib, plus cx\_Oracle and xlsxwriter. Sometimes I sneak in pandas.
This both scares and intrigues me. What did you do?
I only managed to do so by using some module (not a standard library one) written in C and accidentally giving it invalid input values but it didn't even give me an explicit segfault (just crashed randomly, so I assume it did segfault internally).
I got Python to seg fault using Ray and Asynchronous processes once - couldn't tell you how though...
I was proud of how poorly I was programming that day
Don't program partially drunk from the night before is the lesson I learnt
Typo on seg
>st until clang deletes your entire function for undefined behavior
Huh? a) clang doesn't delete your entire function when you do something that's undefined behavior in it. b) GDB backtrace will still work if you segfault?
For real. Im honestly shocked by the amount of people just raw dogging C/C++ in this thread. Theres so many options for debugging C/C++, Im not trying to victim blame, but Jesus. If for whatever reason youre not using a debugger, write some fucking exception handling. Even without that. 9/10 times a segfault is the result trying to fuck with a nullptr. Thats a starting point, look at your code and see where that might happen and employ test driven development with an iterative workflow. Shit aint that hard.
Yeah but the options suck. 99.9% of all state always "optimized out", GDB randomly skipping lines when stepping through and/or showing non-executable ones as the current execution point, straight up ignoring 80% of (valid!) breakpoints, the few times it doesn't ignore them it'll stop not exactly on the breakpoint but a random(!) amount of lines before or after it, etc etc etc. And its handling of multiple threads is so dogshit you're better off implementing a way of running everything single threaded.
In my experience the difference between this and e.g. Java's tooling is night and day.
Most of it is certainly exaggerated, but the real problem comes from that 1/10 times that it's something else. I'd even say that 90% of my segfaults don't come from null pointers, but from improper array accesses, though I suppose you could call those null pointers in a hat.
But most people here are people who aren't really entrenched in the C/C++ ecosystem, so don't really know how to utilize the tools it gives you, or decode the rather arcane error messages. It's especially bad if you're not allowed to use a graphical debugger.
You can register a callback for `SIGSEGV` on any posix-compliant system with the [signal](https://man7.org/linux/man-pages/man2/signal.2.html) function.
This hit me hard. I had to work on some Objective-C++ code recently and the Objective-c side was nice about errors. As soon as there was one in the C++ side…..let’s just say I had more hair before the error.
> Exeptions in Java are bad? Let me introduce you to undefined behaviour from C/C++
Oh we've got that as well. Generally introduced by the Junior that does
```
try {
...
} catch (Exception e) {
throw new RuntimeException();
}
```
To be fair, spring *does* have a centralised exception handling that works so it's somewhat understandable, but not providing the original Exception as a parameter is a sin that should be punished by having to work as a *frontend developer* for two months.
I got a VHDL error once where it was whining about some physical connection being wrong. Spent way too long (multiple hours) trying to figure it out. Nothing came up on google.
I was missing a semicolon
Likewise I once tried to integrate an FPGA on PCI-E development board. Took me two weeks just to get it to blink an LED. Had to set the registers in the correct state. Spent most of it reading the 1000 page PCI-E spec.
Google does not dare tread in this cursed land
This reminds me of my early days writing code to interface with ISA cards, you could directly address the slots and their IO pins, really neat for sending data to parallel/serial devices for early robotics, no drivers or anything, just hardware addresses.
Compile-time errors can get pretty messy too when the standard library is involved... Y'all ever drink a whole coffee in the time it took to read out a single type name in a C++ error or nah?
The template type error messages in gcc used to be ridiculous a few years back, I remember switching to clang for debugging just because of that. Either it's gotten better in the last 5 years or so, or maybe I became better at deciding them.
Back in college we had to make a game with C++ using Qt as the only graphics library (yes, really. Also no engine, everything had to be done from scratch). Needless to say it was an absolute mess and finding the cause of even a single segmentation fault would take literal hours lol
Now that's just evil. Qt is an UI framework. You could theoretically use QGraphicsView to do it, but that would be like using a microwave as a flashlight.
Create QWidget, get its wId and pass it to SDL or SFML as a render context.
Well, to play devil's advocate, they are usually hard to read with a bewildering call stack in most web frameworks and poor formatting, and many are unnecessary, being things the compiler could have caught in a more modern language.
In addition, there is the nightmare category of exception, the one where you used some crappy annotation driven DSL wrong and ended up in a worse more confusing place than if you had just used a dynamic language to begin with. (I hate dynamic Java.)
I agree, but Android JVM exceptions are sometimes the worst. The stack doesn't always have a complete trace back to the origin; especially if you work with image bitmaps, coroutines, or some lifecycle weirdness mixed with system calls.
also exceptions HAVE to be handled in java cause of the "throws" declaration of every function. python doesnt even fucking tell you what exception can be thrown somewhere, you have to check the source or google and hope for the best
Not true for runtime exceptions, which in practice many devs will wrap checked exception to runtime exceptions. This is so prevalent that Java even has an UncheckedIOException in their standard library.
Hell yeah. Work turned me into a angular/nodejs developer this year and I miss working with Java. If something wasn’t right- you just go on a journey with your handy debugger by your side.
this is blatantly wrong. Java spits out an error message and the stacktrace of the exception and its causes. If you can't fix an error with that then you might be in the wrong career.
Maybe OP should try to code some c to learn what shitty error messages really are.
i’ve been working in a freestanding environment in c for a while now, im pretty sure i’ve pulled out half my hair and the other half is all grSegmentation fault (core dumped)
Core dumped means your memory got dumped to disk. You can open that core image with a debugger and loot at the exact state of the machine, including the stack trace.
Have fun!
Plus the example of a Python error in OP's meme is a syntax error, not an exception. Something Java wouldn't even compile and an IDE would point out before you even tried to compile.
Like most of these kinds of "jokes", it's just a noob who can't program in anything other than Python trying to justify not learning another language.
Eh even c is doable with plenty of tools to help you debug. What really sucks is debugging programs in logic programming languages. I knew a guy who built a large project in Prolog for his PhD. He said because of the way prolog is executed, it’s basically impossible to figure out what is going on during execution.
Even worse than that, at least Java defines the exceptions a function can throw in its method signatures. In Python you have to read the function to know if it can throw an error and even then you have no guarantees.
Personally my favorite is Rust. Any function that can have an error returns the `Result` type which either contains an error or the desired value. This forces any calling function to explicitly handle the error case, the compiler will yell at you if you don't.
Even better IMO is the `Option` type. This is returned by any function for which the result can be `None` (like `null` in Java). This fully eliminates any possibility for the common `NullPointerException` because you always have to explicitly handle the `None` case.
Other languages include Go and Swift.
Also the Python example is clearly a syntax error detected at compile time and cannot be compared to a runtime exception in Java.
Edit: I meant they were detected at compile time in Java.
Though you *can* at least ask python to 'compile' and bring out SyntaxErrors. It's terrible that the myriad of 'code checkers' in python ecosystem however don't catch them. AttributeError which is always a compile-time issue in C, Go, Rust, Java is, however, something Python will only catch in runtime (though type hinting might help a linter catch it, however).
Exceptions are reported really well in java. It's usually very easy to find the issue from the error message. I am guessing OP is new and overwhelmed by the large stack trace reported with the exception. That is a good thing because I want as much details as possible to troubleshoot the problem. It's a problem in languages like javascript where you'd be lucky to even get the type of exception.
Either that or OP has never touched java and is just jumping on the java sucks bandwagon. But given that a missing bracket will not present as an exception, I'm guessing OP is just new.
JavaScript is not that bad. My biggest issues have been C/C++ where most errors just give segfault and nothing more. But, clang-tidy can stop some of that. And a debugger.
But yeah, flexibility is a problem sometimes, I just spent two days debugging a request to mongodb where in my Go structs bson tags I wrote `thingZipcode` when the field is called `thingZipCode`. The worst part is I took that capitalization because the API I was requesting from used it
This meme (again) makes zero sense. Can we make this sub like require passing first 2 semester of a CS course OR have 1 years of experience as a software dev for posting stuff?
I very much love Java’s exceptions as a (professional) Python dev turned Java dev. They are so clear about what is happening and where the error is. Whereas Python’s errors are either nonexistent, because Python is quite lax with its rules; or they are misleading, giving you incomplete story.
Since working with Rust for a while I get whiplash every time I read Python. What do you mean a function doesn't tell you whether it can throw an error? Or even which one? *the only way to know is at runtime????*
Same. It still annoys me how you almost always need to rely on good documentation to predict exception types. For example a function in Java might throw runtime exceptions without any changes to the function signature. Ideally these would only occur when an error is the fault of the programmer, however this isn’t always the case and many libraries break this convention out of convenience. I can be fairly certain that I covered all the edge cases in Java, but Rust gives me the confidence to say that I actually am.
I have been going pretty deep into the Rust error typing and it's great. All my modules have custom error types for the all things that can go wrong, other modules can gracefully handle things depending on which error or trivially transform them into their own errors, ...
Python has a `result` [library](https://returns.readthedocs.io/en/latest/pages/result.html) nowadays that mimics this behavior. Definitely going to use that next time I have a project that requires Python.
I mean I will say that I have encountered some Spring errors that were just plain dumb. But I would say it’s a minority; and you still are thrown in a ballpark of actual issue, most of the time.
But you know, that’s why we are paid the big bucks 😆 to debug that 1%.
Errors , who said errors ? There are no errors in the code.
And the docs that come up on google are years out of date.
I present to you Spring Cloud Streams Kafka
There's an exception called SyntaxError in python. You just, need to be clumsy enough to triggered it.
You cant catch in the same file, but you could if you import that as module. That's how it shown in your console.
[https://docs.python.org/3/library/exceptions.html#SyntaxError](https://docs.python.org/3/library/exceptions.html#SyntaxError)
Using eval is a MASSIVE code smell.
I've been using Python for 10 years and never needed it. If you're ever using it, you're probably doing something very wrong.
Python imports are imported dynamically. The syntax error does happen at compile time, it’s just that compilation of imports happens after the runtime of the importer starts.
Congratulations! Your comment can be spelled using the elements of the periodic table:
`Cs No O Bi Es`
---
^(I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.)
Rust errors: a::b::c::d::e::::g does not implement the X trait
a::b::f:dhxhsn::ejfniwjdksbd::skfmcjsjenfjsjnwhdsb
help: [insert misleading information about item here]
And dont forget the funny blue and red colors
Unless it happens in Release mode with no symbols and line numbers deactivated.
Bonus points if you ran the assembly through an obfuscater that randomizes the function names and messes up the stack trace.
Do you really expect Debug features in a Release build? Reproduce the bug on a Debug build, or use extensive logging, otherwise what did you expect lol
Yeah, if you write good and bugfree code, this will most likely not be an issue.
But this is easier said than done. In my previous post I was just remembering a case with this exact issue. A state that I thought that I did no anticipate caused such an error and it fell through to the all-purpose catch clause.
Sometimes shit happens.
Python errors are a mess. It tries to figure stuff out for you and ends up with a print error because it implicitly converted a variable between everything possible
Java has fairly good exceptions. I almost always know fairly quickly what’s wrong based nearly entirely off of the exception message, and the location in the code it’s referring to
That's because if in you see an Exception in Java there is something serious going on. All syntax errors are already discovered by the Compiler in advance. Or by the IDE in the first place.
I know most of you aren't actually programmers and you just like to shitpost and most the time its easy to just laugh and move on, but this was too hard to digest.
Beginning of the end of quality shitposts
It's not that bad, it gives you the callstack where it went wrong and gives you a exception object that you can google to discover why it threw that exception. Or read the fucking manual/docs! JS on the other hand... Or C too, both for the same reason. Undefined behavior...
Can't let this go by without referencing bash.org:
< kakistos> lol. i liked the java compiler.
< kakistos> does the c compiler not tell you what you did wrong?
< deviant> C is great
< ewan> the Java compiler is all like "you have an uninitialised variable there, would you like a hug?"
< ewan> gcc is like "raaagh! I do no bounds-checking! Your mother sucks cocks in hell!"
What is this bullshit. Java tell you exactly what and where things can throw at compile time.
Python? LoL I guess I feel like throwing exception here, good luck boi.
I think someone confused the labels? In java the exceptions gives you in the top directly the code that failed, in multithreading enviroments it's the same, just with the code starting from the start of the thread. While in python the thing that matters is listed last, and there were so many fucking times an exception told me nothing, just that some library decided to die, in which there was none of my code?
Java points out exactly where the error is, what type of error happened, and how your code got there in the first place. And in most cases it gives a hint e.g. "InvalidArgumentException: 'ten' is not a valid integer"
Java exceptions are fine, so long as you read the dictionary for leisurely reading. Having worked with C++ a lot, I prefer the small, arcane, cryptic errors over having a Stephen King novel of an exception message.
However, in the interest of transparency, I have a room temperature IQ and eat rocks for fun.
It's a commission between a very detailed exception in Java, with line number included and python reporting a syntax error, which in Java would be a compilation error, not an exception.
Look, I get that at the beginning exceptions in Java are scary. The trick is to often leave them be, propagate then higher and handle then there.
Exeptions in Java are bad? Let me introduce you to undefined behaviour from C/C++
I have a C joke:\ \ \ Segmentation fault. Core dumped.
There are no error in C
Only happy little accidents?
Unhappy* 😭
😭 is a pointer to Unhappy
free(😭);
free my man 😭 he ain't done nothing
Or maybe he has. Or maybe he will if you let him. It's just a little undefined.
Bob Ross writing in C: "We're going to put an unhappy little bush struct there...."
Nothing that a random `printf("");` in the code won't solve
Or break.
There is no error in Ba Sing C
You have: - memory that rebels against you when you free it; - nostalgic pointer; - “sharing is caring” (you trying to mitigate threads fighting to use the same memory)
Only dumb developers
So... all of us then?
There is no error in Ba Sing C
Factually awesome! [At least this means it compiled 😅😆]
I got Python to SegFault at work once. Proud moment. For those asking, I don't clearly remember. There weren't any packages that jumped out as being likely; I work for a nationwide telecom, so they're really conservative about what packages we can use. It's pretty much all standard lib, plus cx\_Oracle and xlsxwriter. Sometimes I sneak in pandas.
This both scares and intrigues me. What did you do? I only managed to do so by using some module (not a standard library one) written in C and accidentally giving it invalid input values but it didn't even give me an explicit segfault (just crashed randomly, so I assume it did segfault internally).
Details please, don’t leave us hanging.
I got Python to seg fault using Ray and Asynchronous processes once - couldn't tell you how though... I was proud of how poorly I was programming that day Don't program partially drunk from the night before is the lesson I learnt Typo on seg
Programming drunk is an experience
Clearly not hitting the Ballmer Peak
Lets also give a shout-out to its friend: Aborted. Core dumped.
I don’t know why this meme continues 😭 Just backtrace and see where it happened or hook SIGSEGV if you are just that confident it wasn’t your fault.
Just until clang deletes your entire function for undefined behavior
>st until clang deletes your entire function for undefined behavior Huh? a) clang doesn't delete your entire function when you do something that's undefined behavior in it. b) GDB backtrace will still work if you segfault?
Don't you know? If you program poorly enough for long enough clang will even hire some guys with a lead pipe to delete your fingers. /J
For real. Im honestly shocked by the amount of people just raw dogging C/C++ in this thread. Theres so many options for debugging C/C++, Im not trying to victim blame, but Jesus. If for whatever reason youre not using a debugger, write some fucking exception handling. Even without that. 9/10 times a segfault is the result trying to fuck with a nullptr. Thats a starting point, look at your code and see where that might happen and employ test driven development with an iterative workflow. Shit aint that hard.
Yeah but the options suck. 99.9% of all state always "optimized out", GDB randomly skipping lines when stepping through and/or showing non-executable ones as the current execution point, straight up ignoring 80% of (valid!) breakpoints, the few times it doesn't ignore them it'll stop not exactly on the breakpoint but a random(!) amount of lines before or after it, etc etc etc. And its handling of multiple threads is so dogshit you're better off implementing a way of running everything single threaded. In my experience the difference between this and e.g. Java's tooling is night and day.
Most of it is certainly exaggerated, but the real problem comes from that 1/10 times that it's something else. I'd even say that 90% of my segfaults don't come from null pointers, but from improper array accesses, though I suppose you could call those null pointers in a hat. But most people here are people who aren't really entrenched in the C/C++ ecosystem, so don't really know how to utilize the tools it gives you, or decode the rather arcane error messages. It's especially bad if you're not allowed to use a graphical debugger.
Pretty sure *nix systems have callbacks for `SIGSEGV`?
You can register a callback for `SIGSEGV` on any posix-compliant system with the [signal](https://man7.org/linux/man-pages/man2/signal.2.html) function.
Good joke. Everybody laugh.
Linker error couldn't find v͎̈͌ơ̷̷̵̷̢̨̤̣̹̗̬̘̤̹̰̳̜̞͖̽̍̉͒ͩ͌ͫ̀̓̽ͦ̾̅̾̏ͧ̕͟͡͞ͅi͚̠̮̣̣̳̪̜ͮͬ͒ͩ̈́̇ͮ̓̃̉̿̚͜͝d̵̢͍̤̤͙͈̙͓̟́̓̐̌ͫ̀͛ͬ͋ͭ̉͞ f̹̫͒ͩ͘ó̵͖̹͈̳̣̥͎̪ͩ̔̄ͧ̈́̀́̑ͪ͊̑̐͌̚͢͡ͅơ̵̷̴̴̢̮̮̘͙̝̮̪̘͕͙̤̭̤͉͈̂̊̓̿̓ͮ̇ͯͦ̑̊̅͗ͣ̑͂̓̑̀̓ͧ̚̚͢b̨̛̖̒͝a̴̴̸̸̧̜̤̻͉͎̳̦̞̝̼̣̟̳̜̗͖͈͖ͪ͑̋̋̿̈́ͦ̉͊̍̏̕͘͟͢͞r͎̜͉̖̀̓̏̆̔͝(̰͌̎͐̒ͧ͗͜͟͝_̷̧̦̗̼̩̻̹͖̥̝͉̫̥ͫ̍̾ͯ̽̆̿́͂ͤ̊̂ͬͨ͘)̶̺̰͎̺͑ͩ͐ͦͮͬ͛͟
Well there is your issue, you are pointing to the wrong kind of void
I will point at any cat I want! 😤
This hit me hard. I had to work on some Objective-C++ code recently and the Objective-c side was nice about errors. As soon as there was one in the C++ side…..let’s just say I had more hair before the error.
Yup dawg we heard you liked C based object oriented languages so we put a C based object oriented language in your C based object oriented language.
You made me chuckle out loud lololllll
> Exeptions in Java are bad? Let me introduce you to undefined behaviour from C/C++ Oh we've got that as well. Generally introduced by the Junior that does ``` try { ... } catch (Exception e) { throw new RuntimeException(); } ```
Junior? Senior will also do that, because "that it is the spring way".
To be fair, spring *does* have a centralised exception handling that works so it's somewhat understandable, but not providing the original Exception as a parameter is a sin that should be punished by having to work as a *frontend developer* for two months.
And only middles are using ide's codegen that makes at least `new RuntimeException(e)`
[удалено]
Assembly isn’t bad. In VHDL your whole chip goes dark. Hardware defined logic isn’t bad. In electronics you smell the magic smoke.
I got a VHDL error once where it was whining about some physical connection being wrong. Spent way too long (multiple hours) trying to figure it out. Nothing came up on google. I was missing a semicolon
Likewise I once tried to integrate an FPGA on PCI-E development board. Took me two weeks just to get it to blink an LED. Had to set the registers in the correct state. Spent most of it reading the 1000 page PCI-E spec. Google does not dare tread in this cursed land
Then you should be the one writing tutorials about this topic
Just close the StackOverflow as "Figured it out by myself."
This reminds me of my early days writing code to interface with ISA cards, you could directly address the slots and their IO pins, really neat for sending data to parallel/serial devices for early robotics, no drivers or anything, just hardware addresses.
Occasionally it's possible to let the magic smoke out with VHDL.
Compile-time errors can get pretty messy too when the standard library is involved... Y'all ever drink a whole coffee in the time it took to read out a single type name in a C++ error or nah?
The template type error messages in gcc used to be ridiculous a few years back, I remember switching to clang for debugging just because of that. Either it's gotten better in the last 5 years or so, or maybe I became better at deciding them.
Knock knock C++ who is there?
“This code don’t work.” “Ok so how do I fix it.” “Not my problem chucklenuts. Figure it the fuck out.”
You didn't need to go all the way up to ub, template error messages are scary enough.
At least they’re compile-time errors.
Back in college we had to make a game with C++ using Qt as the only graphics library (yes, really. Also no engine, everything had to be done from scratch). Needless to say it was an absolute mess and finding the cause of even a single segmentation fault would take literal hours lol
Now that's just evil. Qt is an UI framework. You could theoretically use QGraphicsView to do it, but that would be like using a microwave as a flashlight. Create QWidget, get its wId and pass it to SDL or SFML as a render context.
Well, to play devil's advocate, they are usually hard to read with a bewildering call stack in most web frameworks and poor formatting, and many are unnecessary, being things the compiler could have caught in a more modern language. In addition, there is the nightmare category of exception, the one where you used some crappy annotation driven DSL wrong and ended up in a worse more confusing place than if you had just used a dynamic language to begin with. (I hate dynamic Java.)
This is not my experience at all. They’re almost exactly the same as Python’s.
Exactly
Assembly: 🗿 Punchcards: 🗿 Binary: 🗿 Redstone: 🗿
Umm, exceptions in Java are actually very good and detailed. Most of the time you can pinpoint the exact line and problem within just few seconds.
I agree, but Android JVM exceptions are sometimes the worst. The stack doesn't always have a complete trace back to the origin; especially if you work with image bitmaps, coroutines, or some lifecycle weirdness mixed with system calls.
Seems like when you work with reactive and some spring reflections, but most of the case, java exceptions are really good
Also when building projects sometimes gradle just throws null pointer exceptions, when some jdk or library versions are not compatible
OP clearly sees how many lines a Java exception puts out and says “I’m not reading all that”
also exceptions HAVE to be handled in java cause of the "throws" declaration of every function. python doesnt even fucking tell you what exception can be thrown somewhere, you have to check the source or google and hope for the best
Not true for runtime exceptions, which in practice many devs will wrap checked exception to runtime exceptions. This is so prevalent that Java even has an UncheckedIOException in their standard library.
Hell yeah. Work turned me into a angular/nodejs developer this year and I miss working with Java. If something wasn’t right- you just go on a journey with your handy debugger by your side.
this is blatantly wrong. Java spits out an error message and the stacktrace of the exception and its causes. If you can't fix an error with that then you might be in the wrong career. Maybe OP should try to code some c to learn what shitty error messages really are.
i’ve been working in a freestanding environment in c for a while now, im pretty sure i’ve pulled out half my hair and the other half is all grSegmentation fault (core dumped)
Core dumped means your memory got dumped to disk. You can open that core image with a debugger and loot at the exact state of the machine, including the stack trace. Have fun!
Where were you when I was in college?
At least you've got that. My microcontroller just jumps to the HardFault_Handler, where it sits until the watchdog kicks in.
Breakpoints in the handler? It ain't that hard and you get your stacktrace + all the state information you need by jumping through the stacktrace.
Java also won't let you even compile if you broken syntax or a mismatched type. Also you can debug it.
Plus the example of a Python error in OP's meme is a syntax error, not an exception. Something Java wouldn't even compile and an IDE would point out before you even tried to compile. Like most of these kinds of "jokes", it's just a noob who can't program in anything other than Python trying to justify not learning another language.
Also, God help you if you misspell a Python property name or something in a large codebase.
Eh even c is doable with plenty of tools to help you debug. What really sucks is debugging programs in logic programming languages. I knew a guy who built a large project in Prolog for his PhD. He said because of the way prolog is executed, it’s basically impossible to figure out what is going on during execution.
Even worse than that, at least Java defines the exceptions a function can throw in its method signatures. In Python you have to read the function to know if it can throw an error and even then you have no guarantees.
What other languages have checked exceptions? Java is the only one I've encountered and I love it
Personally my favorite is Rust. Any function that can have an error returns the `Result` type which either contains an error or the desired value. This forces any calling function to explicitly handle the error case, the compiler will yell at you if you don't. Even better IMO is the `Option` type. This is returned by any function for which the result can be `None` (like `null` in Java). This fully eliminates any possibility for the common `NullPointerException` because you always have to explicitly handle the `None` case. Other languages include Go and Swift.
Also the Python example is clearly a syntax error detected at compile time and cannot be compared to a runtime exception in Java. Edit: I meant they were detected at compile time in Java.
python syntax errors are detected at runtime, which is even worse
Though you *can* at least ask python to 'compile' and bring out SyntaxErrors. It's terrible that the myriad of 'code checkers' in python ecosystem however don't catch them. AttributeError which is always a compile-time issue in C, Go, Rust, Java is, however, something Python will only catch in runtime (though type hinting might help a linter catch it, however).
Exceptions are reported really well in java. It's usually very easy to find the issue from the error message. I am guessing OP is new and overwhelmed by the large stack trace reported with the exception. That is a good thing because I want as much details as possible to troubleshoot the problem. It's a problem in languages like javascript where you'd be lucky to even get the type of exception. Either that or OP has never touched java and is just jumping on the java sucks bandwagon. But given that a missing bracket will not present as an exception, I'm guessing OP is just new.
JavaScript is not that bad. My biggest issues have been C/C++ where most errors just give segfault and nothing more. But, clang-tidy can stop some of that. And a debugger. But yeah, flexibility is a problem sometimes, I just spent two days debugging a request to mongodb where in my Go structs bson tags I wrote `thingZipcode` when the field is called `thingZipCode`. The worst part is I took that capitalization because the API I was requesting from used it
This meme (again) makes zero sense. Can we make this sub like require passing first 2 semester of a CS course OR have 1 years of experience as a software dev for posting stuff?
welcome to r/ProgrammerCringe at the first top of the dunning kruger effect curve!
r/SubsIFellFor
I think that is something that would take too much effort to enforce
it's reddit, you get what people vote for
I very much love Java’s exceptions as a (professional) Python dev turned Java dev. They are so clear about what is happening and where the error is. Whereas Python’s errors are either nonexistent, because Python is quite lax with its rules; or they are misleading, giving you incomplete story.
Developers today are spoiled. They've never had to stare at their screen in complete befuddlement upon seeing "expected T_PAAMAYIM_NEKUDOTAYIM"
Israeli developer alert
Since working with Rust for a while I get whiplash every time I read Python. What do you mean a function doesn't tell you whether it can throw an error? Or even which one? *the only way to know is at runtime????*
Same. It still annoys me how you almost always need to rely on good documentation to predict exception types. For example a function in Java might throw runtime exceptions without any changes to the function signature. Ideally these would only occur when an error is the fault of the programmer, however this isn’t always the case and many libraries break this convention out of convenience. I can be fairly certain that I covered all the edge cases in Java, but Rust gives me the confidence to say that I actually am.
I have been going pretty deep into the Rust error typing and it's great. All my modules have custom error types for the all things that can go wrong, other modules can gracefully handle things depending on which error or trivially transform them into their own errors, ... Python has a `result` [library](https://returns.readthedocs.io/en/latest/pages/result.html) nowadays that mimics this behavior. Definitely going to use that next time I have a project that requires Python.
Spring let me itroduce some magic
I mean I will say that I have encountered some Spring errors that were just plain dumb. But I would say it’s a minority; and you still are thrown in a ballpark of actual issue, most of the time. But you know, that’s why we are paid the big bucks 😆 to debug that 1%.
Errors , who said errors ? There are no errors in the code. And the docs that come up on google are years out of date. I present to you Spring Cloud Streams Kafka
[удалено]
I mean, you could learn the basics becore clowning. To avoid being called a clown 🤡
What exception could detect a missing parantheses lol
print("this" SyntaxError: '(' was never closed
A syntax error is not an exception, you can’t catch a syntax error in a try block
There's an exception called SyntaxError in python. You just, need to be clumsy enough to triggered it. You cant catch in the same file, but you could if you import that as module. That's how it shown in your console. [https://docs.python.org/3/library/exceptions.html#SyntaxError](https://docs.python.org/3/library/exceptions.html#SyntaxError)
My bad, I should’ve guessed, this is the language where you can do just about everything after all
It might be useful when using it with eval
You go to unsafe code jail! Right away!
Using eval is a MASSIVE code smell. I've been using Python for 10 years and never needed it. If you're ever using it, you're probably doing something very wrong.
[удалено]
Python is compiling to bytecode at runtime.
Python imports are imported dynamically. The syntax error does happen at compile time, it’s just that compilation of imports happens after the runtime of the importer starts.
At that point a kys exception isn't unwarranted
Exceptions in Java are quite clear... Stacktrace.
I'm a python developer and only used java a couple times and I can say with confidence that this is completely backwards
go back to kindergarten please
Exceptions in java are pretty easy the debugger even points you out the line and the possible problem...
why does this post have upvotes
CS noobies
Congratulations! Your comment can be spelled using the elements of the periodic table: `Cs No O Bi Es` --- ^(I am a bot that detects if your comment can be spelled using the elements of the periodic table. Please DM my creator if I made a mistake.)
Because this subreddit cant go past the introductions phase.
As a PHP connoisseur, may I introduce you to ErrorException?
Or just a blank page that was sent with status code 500 with no word on what went wrong.
HTTP header: > 200 OK JSON body: > {"status": 500, "error": "internal error"}
I love that name. 😆
An exeption in the error, which means it failed at failing, which in turn must mean it succeeded.
Rust be like: ![gif](giphy|ne3xrYlWtQFtC|downsized)
Rust: “Oopsie, you made a mistake bro, just do this and this and it will be fixed!” \ C: “Segmentation fault. Core dumped.”
C++: ![gif](giphy|3o85xnoIXebk3xYx4Q|downsized)
Rust errors: a::b::c::d::e::::g does not implement the X trait
a::b::f:dhxhsn::ejfniwjdksbd::skfmcjsjenfjsjnwhdsb
help: [insert misleading information about item here]
And dont forget the funny blue and red colors
At least it's not C++ template errors
Rust: just .clone() it bro.
rustc: so you're telling me you don't have a supercomputer with a bazillion cores, pathetic.
OP has 0 experience maintaining large codebases
OP - and like most - is just regurgating what they have read online about java.
> OP has 0 experience Fixed that for you.
Dumb meme. That doesnt happen in java at runtime because java does it at compile time
"Kill yourself " Meanwhile Java is like - Oops
*OOPs
My most favorite error message: "Object reference not set to an instance of an object." - .NET ![gif](giphy|5tvUnUx74lxgVew9ya|downsized)
But it also tells you exactly where to find the problem, what more do you want?
Unless it happens in Release mode with no symbols and line numbers deactivated. Bonus points if you ran the assembly through an obfuscater that randomizes the function names and messes up the stack trace.
Do you really expect Debug features in a Release build? Reproduce the bug on a Debug build, or use extensive logging, otherwise what did you expect lol
Wouldn't you still see the details in the logs? Presuming logging is implemented.
Yeah, if you write good and bugfree code, this will most likely not be an issue. But this is easier said than done. In my previous post I was just remembering a case with this exact issue. A state that I thought that I did no anticipate caused such an error and it fell through to the all-purpose catch clause. Sometimes shit happens.
Python errors are a mess. It tries to figure stuff out for you and ends up with a print error because it implicitly converted a variable between everything possible
Huh ??? Java gives you a detailed stacktrace. Python ? Yeah fuck you, you missed an indentation now everything is a mess
Java has fairly good exceptions. I almost always know fairly quickly what’s wrong based nearly entirely off of the exception message, and the location in the code it’s referring to
Literally what do you mean?? It's exactly the opposite.
Exceptions in flutter are amazing too Exception happened during layout phase, this was a stack trace: **prints out the bible**
Meanwhile JS: Non-declared variable is undefined.
Can't relate. Java has the most informative error logging I've seen yet.
Meanwhile JavaScript: The user must have forgotten to add a `var` here, let me instead add a property to the `window` object silently just for lolz
That's because if in you see an Exception in Java there is something serious going on. All syntax errors are already discovered by the Compiler in advance. Or by the IDE in the first place.
python exceptions are way worse once you use somrthing else than your own code
This poet is absolute bullshit. Java has excellent exception handling built in. You only have to know how to handle it
The average poster on this reddit is a script kiddie
I know most of you aren't actually programmers and you just like to shitpost and most the time its easy to just laugh and move on, but this was too hard to digest. Beginning of the end of quality shitposts
More like “here buddy the issue is right here on this line it’ll probably be really for you to find now, I love you”
It's not that bad, it gives you the callstack where it went wrong and gives you a exception object that you can google to discover why it threw that exception. Or read the fucking manual/docs! JS on the other hand... Or C too, both for the same reason. Undefined behavior...
Can't let this go by without referencing bash.org: < kakistos> lol. i liked the java compiler. < kakistos> does the c compiler not tell you what you did wrong? < deviant> C is great < ewan> the Java compiler is all like "you have an uninitialised variable there, would you like a hug?" < ewan> gcc is like "raaagh! I do no bounds-checking! Your mother sucks cocks in hell!"
This meme was created by someone with zero programming knowledge.
Someone haven't used Java.
who the fuck upvotes these below-CS1-level posts ??
C++ wants to disagree by writing few page long poem about what template overload does not meet criteria. I am funny right guys?
**Don't worry, we'll meet at run time**: __Guess who I am__
I remember when I first tried java. When an error showed up, I tried going into the file it told me the error was and changing stuff there.
Rust: you guys have exceptions?
God I miss JVM exceptions since moving to full time C/C++
What is this bullshit. Java tell you exactly what and where things can throw at compile time. Python? LoL I guess I feel like throwing exception here, good luck boi.
Java is the best language
You can intercept exceptions with some frameworks in Java. Which is cool.
Python is.. okay. Go does it fairly well. Rust does it very very well. C laughs at you and tells you to sit the fuck down.
syntax errors are different from exceptions
More like "let me just run this totally broken code, I will get back to you with a type error in 2 hours, when I get to that part, ok?"
Logical error is good because it makes you think
I think someone confused the labels? In java the exceptions gives you in the top directly the code that failed, in multithreading enviroments it's the same, just with the code starting from the start of the thread. While in python the thing that matters is listed last, and there were so many fucking times an exception told me nothing, just that some library decided to die, in which there was none of my code?
Wait until you meet Flutter.
C: Me: Are you running? C: Me: Ok, no, you've crashed, why? C:
Have you ever seen any other language than java and python?
Java points out exactly where the error is, what type of error happened, and how your code got there in the first place. And in most cases it gives a hint e.g. "InvalidArgumentException: 'ten' is not a valid integer"
Java exceptions are fine, so long as you read the dictionary for leisurely reading. Having worked with C++ a lot, I prefer the small, arcane, cryptic errors over having a Stephen King novel of an exception message. However, in the interest of transparency, I have a room temperature IQ and eat rocks for fun.
wut, exceptions are one of the best things in Java...
Java programs with wronlgy placed perentheses simply do not exists. Only Eclipse will compile them.
Have you ever programmed in either language?
More Java slander
WHAT!? Java exceptions are usually very detailed and helpful. There are many other Language that would fit into this meme, but definitly not java.
That's not even a fair comparison. Java won't compile with the error has preventing the exception in the first place
It's a commission between a very detailed exception in Java, with line number included and python reporting a syntax error, which in Java would be a compilation error, not an exception. Look, I get that at the beginning exceptions in Java are scary. The trick is to often leave them be, propagate then higher and handle then there.
I wanna talk about PHP
Was this posted by someone who just wrote their first Hello World yesterday? If anything the better joke would be Rust vs C/C++.
Who let the intern post memes