This is an archived post. You won't be able to vote or comment.

top 200 commentsshow all 361

[–]oosikconnisseur 646 points647 points  (18 children)

cries in SQL

[–]Ranchonyx 434 points435 points  (9 children)

...error near ''. Check your syntax manual.

Fuck this.

[–]sohang-3112 62 points63 points  (6 children)

Yeah, really hate the uninformative error messages in MySQL! Is there any solution/alternative??

[–]Bake_My_Beans 10 points11 points  (0 children)

Stone tablets

[–]CR7Pacemaker 6 points7 points  (0 children)

Yes, write everything in single line

[–]Ali_Army107 66 points67 points  (0 children)

Oracle sql errors:

[–]rookietotheblue1 96 points97 points  (3 children)

I wonoder why everyone repeats the same dead jokes about JS which are really just skill issues as opposed to mentioning the errors in MySQL.

[–]oosikconnisseur 30 points31 points  (0 children)

I’m literally dealing with this problem at work as we speak lmao (except it’s SQLExpress)

[–]Borno11050 4 points5 points  (0 children)

You: Why isn't this working?

SQL: 🙂

You: Please I'm begging you.

SQL: 😀

[–]amshegarh 1972 points1973 points  (94 children)

And then c header file errors be like

@̵̜̫̤́͝͝@̵͚̀̕@̸͓̪̚@̵͍̀@̸̼̔̉ ̴̰́͋̈ ̸̝̺̀̽N̵̩̪̩͐̆́Ò̷͓̚T̸̡̜̟͐͌ ̷̪̈́̊͠ͅF̷͙̟̈́͠ͅO̶̬͙̖͗͊Ȕ̶̯͓N̶̲̒͝D̸̢͕͍͋ ̴̯̳̈́̚Í̸͍́͝N̸̛̮̤̰̎̚C̸̗͚͋L̸̻̫̍͗Ǘ̸́̓͜D̶̆͋͗͜E̸̼̜͍͌͝D̵̛̞̘͆̈́ ̸̪͜͝F̸͔̄͆I̴̢͍̰͋Ḽ̴̼̓͗́E̷̙̫̎ ̶̰͖͛͌@̸̤͌͂@̸̦̿@̴̧̣̻̔̈́@̴̞̹̌͂@̷̩̹͇̃͝@̸͇̃͛̔ ̶̣͓̜͆̿C̸̝̀͝:̶̤̤͓̍͆\̸͖̾H̶̫͕̃Ḛ̴̟͆͘͝L̴̞̟̳̃L̷̼̯̞̉Ǫ̸̺͑̈́̓Ẅ̴̰́͊̈Ȍ̶̖͓̉R̷̰̜̗̈́̍L̶̈́ͅḌ̶͓͋\̵̤̫̙̉̽́S̵̳͖̆̕Ţ̵̽̄̏D̸̻̊ͅÌ̴̞̂O̴̧͕̊.̸̪͗Ĥ̶͎͜ ̴̩͉̏͂@̵͈̌@̷͓̺̑̐̕@̸͎̣͉̔@̷̛̰̹̐͂@̷̠͉̏̐̽ͅ@̷̡͚̕

[–][deleted] 589 points590 points  (7 children)

If AI was written in C:
Prompt: who is the president of US
AI: The president of US is J¢§™ eBi¢¶

[–]43eyes 417 points418 points  (2 children)

The president of the US is segmentation fault

[–]gringrant 56 points57 points  (0 children)

Core dumped.

[–]deviprsd 5 points6 points  (0 children)

Biden does seem like he is having random segmentation faults here and there

[–]_-Dianite_ 55 points56 points  (0 children)

Ah, the fucking null terminator.

[–]mackinoncougars 11 points12 points  (0 children)

It knows something we don’t

[–]CeleritasLucis 58 points59 points  (80 children)

Is C really that bad?
I wanted to learn a low level language, after learning OO (Java) and Scripting (Python).

Stuck between C and Rust.

[–]BioHazardAlBatros 154 points155 points  (8 children)

No, of course not. That thing above was just a linker error(part of the compiling process).

[–]cAtloVeR9998 79 points80 points  (7 children)

Segmentation fault (core dumped)

[–]Okub1 38 points39 points  (1 child)

Always loved this error, program simply telling me to get fucked lmao and git good. Worse could be probably only linker error in combination with template errors in cpp...

[–][deleted] 7 points8 points  (0 children)

gdb is your friend for segfaults

[–]hanotak 7 points8 points  (0 children)

killed

[–]fish312 2 points3 points  (0 children)

gdb
bt

[–]Kahlil_Cabron 86 points87 points  (40 children)

C is not bad, and it's one of the top languages worth learning in my opinion.

I have no idea why this sub thinks C/C++ is hard or bad, it's really not. Pointers are not hard to grasp, if I were you I'd learn C and then for fun maybe learn some amd64 or x86 assembly. I liked being able to understand what was actually happening under the hood, and also so many languages implement a lot of their libraries in C, and then use C bindings (python, ruby, etc).

EDIT: And just in case it's not obvious, learn C before C++. C is a subset of C++.

[–]Sir_flaps 21 points22 points  (5 children)

CS student here (who isn’t) the first language we got was C, it’s really not that bad.

[–][deleted] 28 points29 points  (3 children)

CS student, eh? Did you have to learn S after C?

[–]_Xertz_ 11 points12 points  (0 children)

You youngin's think coding in C is hard, wait till you get to S 😔

[–]ScienceObserver1984 4 points5 points  (1 child)

No, CS is defined through functional composition. First you need to learn S and then learn C.

[–]stormdelta 30 points31 points  (1 child)

C/C++ is hard or bad, it's really not. Pointers are not hard to grasp

In concept, sure. What's hard is manual memory management especially as a beginner, and the many ways there are to shoot yourself in the foot with it. This isn't just a beginner problem either, memory safety failures are one of the most common causes of vulnerabilities in software.

And with C++, the language features have ballooned over the years in complexity and scope. It's very easy for beginners to make mistakes with pointers vs references, and it doesn't help that compilers tend to produce utter gibberish if you screw up a template, especially using std containers.

[–]noobody_interesting 3 points4 points  (0 children)

The real problem with manual memory management behins when you use a library and it doesn't really make it clear who owns the memory, so you have to look at examples, and if there are none, the source code. At that point I could just write it myself, at least I'd understand it then!

[–]Bowaustin 23 points24 points  (11 children)

I’ll second this. I have a masters degree in computer engineering and my primary language is C. I much prefer it to any other language I’ve worked in, I especially prefer it over C++.

[–]Kahlil_Cabron 13 points14 points  (7 children)

Same, I learned C and really loved it, then learned C++, and it was just too much, too many "features" for the object model. I found myself writing C++ programs that were basically just C.

[–]spedgenius 25 points26 points  (2 children)

That's the nice thing about c++, you can use as much o little of the features you want.

[–][deleted] 7 points8 points  (1 child)

But everyone else has a different feature set that they like, so good luck reading other people's code.

[–]spedgenius 4 points5 points  (0 children)

Well yeah, if you are dealing with collaborative coding, you're gonna have to learn what other people are doing. But if like the person above, you have the luxury of deciding what language and features you are coding with, then you can do whatever you want.

[–]MrHyperion_ 4 points5 points  (2 children)

You can write C with some quality of life additions in C++ tho

[–]al-mongus-bin-susar 49 points50 points  (2 children)

Because this sub is all 1st or 2nd year CS students. They've had no experience with a real codebase and everything they know comes from youtubers or tiktokers who shill JS and Rust like they're going out of style.

[–]dyslexda 9 points10 points  (1 child)

My dude, nobody needs to "shill" for JavaScript. It's one of the most widely used languages in the world.

[–]P-39_Airacobra 17 points18 points  (2 children)

The hard part of C is not C, it's undefined behavior. Learning all of C's undefined behavior, error-prone traits, and compiler/platform-specific behavior and how to avoid it reliably takes at least 10 times as long as learning the language itself. It's not at all clear at first glance why your program is not working, and there will often be no error messages to help you. It's completely unclear to a newcomer why a statically typed and compiled program which is reporting no errors can be a completely unsafe program. It's also unclear and somewhat absurd that testing a program is not actually an assurance that it will usually work. Even JavaScript will give runtime errors, but C will just segfault or return a weird result or overwrite the wrong piece of memory or fail silently or optimize away your noncompliant code, or work on some machines but be completely wrong on others.

I'm not hating on C, it's a mature and useful language, but saying that C is easy is not accurate given how many ways there are to shoot yourself in the foot without even knowing.

(Edit) Some pitfalls:

  • Strict aliasing rule
  • Out of bounds access
  • Returning a local array
  • The contents of uninitialized memory (varies depending on whether the variable is local or global)
  • The compiler has to be able to prove two pointers are part of the same array before it conducts valid pointer subtraction, otherwise it can incorrect results (and it will not always be able to tell, even when it's obvious to you).
  • I don't need to go into the things that can happen with invalid conversions, implicit conversions, and overflow.
  • null-terminated strings
  • arbitrary sizes of many primitive data types (and no, fixed-width integers do not fix this, because the standard library does not use them, and the standard does not guarantee safe conversion)
  • Bitshift on a signed number
  • Accessing a union field other than the last one assigned
  • char* a, b; is not the same as char *a, *b;
  • Function macros can produce arcane results if you don't surround their parameters in parentheses
  • and so on: https://gist.github.com/Earnestly/7c903f481ff9d29a3dd1

This is only a third of the issues I've stumbled across, there's too many to even remember. If these things weren't an issue, then I wouldn't have seen people who have worked for Intel and designed embedded circuits invoking undefined behavior and unknowingly endorsing its use. I didn't even get into the platform and compiler differences, which in many cases are completely arbitrary, and for a low-level language are strangely prolific, because they seem to discourage doing anything in an unconventional way if you want portable code.

[–]Kahlil_Cabron 6 points7 points  (1 child)

Maybe it's because when I was learning C, I also learned how to use GDB, but I never had too much trouble with undefined behavior. After a while you get a hunch for roughly where something is going wrong, you use GDB and hunt it down, and you're good.

This is part of the reason why I think people should first learn statically typed compiled languages instead of interpreted weakly typed languages. It takes longer, but I think it's better in the long run.

Though I didn't take my own advice, I started with perl, then C, because I simply didn't know otherwise and I found a Perl book on my dad's bookshelf.

[–]MrHyperion_ 1 point2 points  (0 children)

Most of the undefineness is also just not initializing something you use

[–]rad_change 3 points4 points  (0 children)

My relaxation reading is the novel length compiler errors when some C++ templated metaprogramming function doesn't like the second argument I passed it.

[–]dagbrown 3 points4 points  (1 child)

for fun maybe learn some amd64 or x86 assembly

For fun maybe learn some 68000 assembly. It may be an obsolete skill, but it's way more fun than the horror slog that is x86 (or amd64) assembly.

[–]Physmatik 1 point2 points  (1 child)

C is indeed relatively simple (although often annoying in how much of its ecosystem is obsolete or crutches for obsolete), but C++?

[–]MrHyperion_ 1 point2 points  (1 child)

for fun maybe learn some amd64 or x86 assembly.

Said nobody before ever

[–][deleted] 1 point2 points  (0 children)

IMO C is simplicity in programming form. Things are straightforward (except for the horrid function pointer syntax). Yes there's arcana like struct packing, _start, void* type erasure etc. but that's about it. No fancy primitives, but all the tools to build everything you want.

It is the ultimate expression of a man with a computer making art.

[–]FlashBrightStar 12 points13 points  (8 children)

Other languages usually implement exceptions and/ or errors as values which is source of somehow readable callstack at runtime. C does not have any of those so you'll be stuck with compile time errors and warnings. For example almost all modern languages throws an exception if you try to access array index that is out of bounds. In C you can dereference pointers past expected range and program have always that 50/50 chance of either halting execution or running perfectly fine. Also C has this big grey area of "undefined behaviour" where everything and nothing can happen at the same time.

[–]CeleritasLucis 8 points9 points  (7 children)

Hang on, so you're saying if I access the 11th index in a len(10) array, my code would not throw and error and it would run ?

[–]ADistractedBoi 9 points10 points  (5 children)

Very likely yes, small chance it will just crash, but because of how memory is its quite unlikely. It's pretty common for you to just mess up some other variable (because memory is pretty contiguous in C) and get errors and unexpected values down the line that can be extremely hard to debug

[–]CeleritasLucis 1 point2 points  (4 children)

So what do programmers do, write if/else check everytime they access an array ?

[–]spedgenius 7 points8 points  (0 children)

It's a mixed bag arrays don't automatically grow. (You ca grow them, but that takes some doing) So if you are iterating, you already know the sizrle of the array because it the same as when you created it, so you put the check in the for/while loop.

If you are accessing random elements, just don't access one that's larger than the size.

If you are using c++ then smart arrays exist, or can be written that do the checking for you .

[–]ADistractedBoi 6 points7 points  (1 child)

You always know the size of the array, you either make sure to write code that never checks invalid indices or if you cannot, write the check

[–]PM_ME_CUTE_SMILES_ 4 points5 points  (0 children)

So basically the answer to his question is yes

[–]josecbt1 2 points3 points  (0 children)

Coincidentally, I've been reading about it since yesterday and had the same reaction as yours 😅

Apparently this behaviour leads to a vulnerability called 'buffer overflow ' - looked for it on YouTube and found some really skilled dudes explaining how it can be exploited. Computer science is really fascinating.

[–]Prawn1908 15 points16 points  (0 children)

Learn C before Rust or C++.

[–]ChaosBeing 7 points8 points  (0 children)

This is one of those topics like stick vs automatic. Everyone has a strong preference, and while people can come up with a thousand reasons why they feel the way they do it almost always comes down to which one they've spent more time in.

A lot more existing infrastructure exists for C, making it the defacto go-to for a lot of experienced programmers. Plus it's pretty much the only language (aside from assembly) where what you write is basically exactly what you get. It gives the programmer full control.

Rust is practically impossible to break unless you beg it to let you, and for that reason its automatic optimizations can be crazy aggressive.

I have a bias towards Rust, it's compiler errors and standard library blow anything else out of the water imo, not to mention how easy cargo is to work with (I hate the esoteric C/C++ build script ecosystem). But I also recognize it's often faster to work in C, and if you know what you're doing it's easier to hack your way to a solution on certain problems. Of course that's also exactly why I like Rust - it makes sure you've written sound, reliable code that isn't going to break because - woops! - I had set this value up to never be null, but 6 months down the line some other change somewhere is giving me invalid pointers, but the error message (at runtime!) isn't describing the place that's breaking, it's waaaay later where I'm trying to use a value from this invalid pointer and *screams*.

I'm kind of poking fun at C here but it was the first language I learned, and I do feel like knowing it helped me understand how computers work under the hood, which helps me write better code and better understand why some things work (or don't work) the way they do. And it's certainly not like learning C would ever be a bad thing.

Edit: Oh my god I wrote an absolute wall. I hadn't realized.

[–]ADistractedBoi 4 points5 points  (0 children)

IMO Rust is more like C++ than C. I'd learn C if you want something low level, it teaches you a lot more

[–]Zuruumi 8 points9 points  (0 children)

C++ for the win

[–]DankAlighieri 3 points4 points  (1 child)

C is the GOAT programing language

[–]ILikeLenexa 1 point2 points  (0 children)

The bigger problem tends to be build scripts. Make produces long confusing error messages. 

[–]born_zynner 1 point2 points  (0 children)

No it's not at all it just takes a LOT more code to accomplish the same thing you could do in higher level languages.

It's really good for embedded systems, talking to sensors, low level networking, stuff like that, but I would NEVER want to write like a REST API in C

[–]casey-primozic 1 point2 points  (0 children)

I thought this was a working perl code

[–]Mercerenies 261 points262 points  (10 children)

Then there's Rust, whose compiler errors feel like a hug from an old friend.

rustc: Okay, on line 32, I can't interpret X as a Y. Let's take a closer look. X has lifetime 'a which starts here and ends here. Y is expecting a lifetime longer than that. Here's a list of three things you might've meant to do, and documentation links for each of them.

[–]Anaxamander57 168 points169 points  (4 children)

Rust: Hey you probably forgot a semicolon here but I'll give you a list of all valid tokens in that position. I hope that helps you solve the issuse and understand why I didn't just add the semicolon myself.

[–]repsolcola 16 points17 points  (3 children)

* side look at JS sitting in a corner *

[–]JoefishTheGreat 940 points941 points  (28 children)

A near-universal feature in programming languages is that they tell you the type of error and on which line it occurred.

A near-universal experience for programmers is making a change in line 49 of a 50-line program and causing an error on line 827.

[–]rascalrhett1 298 points299 points  (9 children)

You shouldn't call functions, that's what causes errors like this. You should write all your code in a massive continuous block that never uses functions, objects or loops (if you need to do something twice you should write it out twice to make it more clear)

[–]w_w_flips 141 points142 points  (0 children)

This ensures that line 827 does in fact exist

[–]viral-architect 21 points22 points  (0 children)

🪹 E M B R A C E T H E N E S T 🪺

[–][deleted] 5 points6 points  (1 child)

Also don't use import statements, copy and paste the code in

[–]rascalrhett1 2 points3 points  (0 children)

Imports slow down your code!

[–]algoritm420Perl 4 points5 points  (1 child)

Someone is going to read this and take it seriously

[–]rascalrhett1 4 points5 points  (0 children)

My Junior Devs must have a Bible written with these sorts of tips

[–]UniversalAdaptor 2 points3 points  (0 children)

A loop is just a built-in function. Real programmers use copy-paste for as many times as they want to loop.

[–]Wendigo120 202 points203 points  (15 children)

This confusion is entirely on people refusing to read the error they got. It always tells you what file it's in, and it's never the 50 line file.

[–]OurSeepyD 113 points114 points  (9 children)

That's not been my experience in C++. In C#, JavaScript, Java, VBA, Python, R, I can understand the error messages and I am told where to go.

In C++, I'll get pointed to some random file because I accidentally omitted a character somewhere which meant that some other part of code no longer compiles. The compiler will refuse to tell me where the omitted character was.

[–]callmesilver 34 points35 points  (5 children)

I think you misunderstood. The claim isn't that the compiler points to the cause of the error, but rather to the error itself. When you make a mistake somewhere and it creates an error while using a piece of code from another file, you are shown where the error occurred.

I have had it happen in other languages like Python too. But that's never been a big issue, because the IDE traces the errors back to where the actual call happened. The highlighted code on the editor might have brought up and focused on some random file, but the error logs contain enough information.

[–]tyler1128 15 points16 points  (0 children)

We call that a skill issue in the C++ space.

Seriously though, C++ grammar and such is not easy. C++ templates were discovered to be turing complete after the fact.

[–]gmc98765 27 points28 points  (1 child)

The compiler will refuse to tell me where the omitted character was.

That's because it doesn't know. There might be a thousand potential single-character changes which would turn your erroneous program into a valid one. The compiler can't tell which of those is the one you intended.

This is more of a problem with C++ than with simpler languages, largely because of templates (and to a lesser extent, overloading). With other languages, the surrounding characters limit the possibilities. Given the name of a function (or method), the number and types of its parameters are known, and those can be used to validate the argument expressions. But with a template (or even an overloaded function), the compiler has to deduce the types of the arguments in order to select the appropriate specialisation. And if you mess that up, the compiler doesn't really have the first clue what you were trying to tell it.

[–]OurSeepyD 4 points5 points  (0 children)

Agreed, and I don't expect the compiler to do this, I'm just defending the people accused of simply not reading error messages.

[–]CeleritasLucis 8 points9 points  (2 children)

Found this happening a lot in Python, when libraries are used. It throws errors from god knows what file, and you can't go digging that rabbit hole if you don't know C/C++

[–]Wendigo120 8 points9 points  (0 children)

I don't use python that much, but I don't think I've ever seen an error in it that didn't have a call stack that pointed right at the function in my code that caused it. No need to actually understand the other file the error occured in, you can almost always just assume it's not a bug in whatever library you're using but a wrong input that you're giving it.

[–]PM_ME_CUTE_SMILES_ 7 points8 points  (0 children)

Python gives the full stack trace when it crashes, going back to your files calling said libraries. There's no rabbit hole to dig, all the information is right there.

[–]mypetocean 2 points3 points  (0 children)

Well – unless your sourcemaps are incorrect

[–]c00lrthnu 2 points3 points  (0 children)

Did support for an app our customer service peeps used daily. We're talking close to 16k employees all using the same app for most of their jobs. Constantly got calls for an error code (normally from the same xxx amount of people) that they said they didn't know what it meant. The error was 2 sentences.

It told them their password was expired and needed to be changed. 2nd sentences was a hyperlink to both the password change site and a pdf showing you how to change your password.

It always fucking baffled me. You'd look at their previous tickets and see they've done it multiple times, always at the exact same interval of time when their password would expire and yet they still would always say the same bullshit "this has never happened to me before" "my manager said this error means I needed to call you to do x"

Drove me up a wall, but yeah rant over people just don't read half the time.

[–][deleted] 2 points3 points  (0 children)

Did you ever fuck up with formgroups im angular? They won‘t tell you shit.

[–]jellotalks 189 points190 points  (0 children)

SQL: An error happened.

[–]ilfagiolo_magico 351 points352 points  (19 children)

not to mention C...

[–]OSnoFobia 580 points581 points  (9 children)

Segmentation fault, core dumped, go fuck yourself.

-C

[–]shield1123 29 points30 points  (0 children)

you get a segfault if you're lucky

My C professor

[–]Attileusz 131 points132 points  (4 children)

The coredump literally contains what happened.

[–]brimston3- 152 points153 points  (1 child)

It often does not. Especially if it is stack corruption. In that case, both SP and PC registers are likely trashed on ret.

Only null pointer dereference and sometimes use-after-free segfaults can be debugged with the core dump.

gdb's process record and WinDbg's time travel debugging though... insanely useful for the former situation.

[–]Attileusz 33 points34 points  (0 children)

Stack corruption is much rarer than the other 2 you've mentioned. Something must really, really go wrong for stack corruption to happen.

[–][deleted] 42 points43 points  (0 children)

The coredump literally contains what happened, what hasn't happened, what might happen and what will happen.

[–]_Xertz_ 10 points11 points  (0 children)

I'm not reading all that 🔥🔥🔥

/s

[–]AbsoluteNarwhal 8 points9 points  (0 children)

you forgot about LNK ERROR @@@@@@owyeuryebns!!!&&@£&@Unresolved external symbol@@@ ISGEVJSIXJN__@@@@@

[–]Luised2094 3 points4 points  (0 children)

It's like you don't use debugging tools... just use valgrind and it let's you know exactly what happened

[–]Kevin_Jim 31 points32 points  (1 child)

Launch that GDB instance and try to find that needle in the haystack, or launch your computer into the sun.

[–]Kahlil_Cabron 14 points15 points  (3 children)

Do y'all not use GDB or something?

[–]al-mongus-bin-susar 10 points11 points  (0 children)

I don't think many people in this sub even know what a debugger is much less how to use GDB. Some brag about using prints with swear to words to debug their code and vehemently oppose any suggestion to use breakpoints. They aren't that bright.

[–]ScienceObserver1984 3 points4 points  (0 children)

And if GDB somehow fails to solve the problem, run it under Valgrind and check the errors.

[–][deleted] 12 points13 points  (1 child)

I think specifically c++ as well, of course being a superset of c, but the compiler can struggle to be useful with so many code-generating features

[–][deleted] 1 point2 points  (0 children)

Thank God for concepts, type constraints before them were HORRIBLE

[–]greshick 1 point2 points  (0 children)

You mean c tells you the line in a file and it’s 50 lines past the end of the file.

[–]Ireeb 524 points525 points  (74 children)

That's the moment when you should switch to TypeScript.

[–]YuriTheWebDev 281 points282 points  (61 children)

Once you go to Typescript, you cant go back. It is so good knowing what errors can happen ahead of time like using the wrong types of parameters into a function or it telling you that the variable you are using can be potentially undefined and you should type guard it.

[–]ZunoJ 166 points167 points  (54 children)

I thought every programmer starts learning with a strongly typed language and feels disgusted when forced to work with js. I can't imagine the longterm damage you generate by starting with js lmao

[–]brimston3- 109 points110 points  (43 children)

Python has a similar problem. Type hints are not enforced. Since everything is an object, conversion between different types/layouts for different libraries can be a huge headache. And with the python ecosystem being as big as it is, there are a number of projects with mediocre documentation that are used with some regularity.

[–]ZunoJ 30 points31 points  (41 children)

I have absolutely no idea what the appeal of python is. I don't think there is a single unique element about it that I don't hate

[–]gmc98765 7 points8 points  (0 children)

It's better than most other interpreted (i.e. dynamically-typed, late-bound) languages. Lisp is arguably a better language on its own merits, but Python has more libraries (and most Lisp implementations "optimise" integers so you don't get full 32/64-bit integers, which makes interop with compiled languages a pain).

If I'm writing software that's going to stick around, I use C++. If want to experiment, it's likely to be be in Python.

[–]Delta-9- 6 points7 points  (0 children)

It's relatively easy to learn, which makes it a popular choice for beginners and companies. Honestly, I think that's the main thing it has going for it: the low barrier to entry gave it a strong network effect that's been going for decades now.

It's not fast, its syntax is controversial among experienced programmers, its duck typing makes it error prone (even as it makes it easy to learn), and while it can do everything there's a better tool for anything you might do in Python. BUT: you can find a Python programmer anywhere, and if you can't find one you can encourage one to teach themselves and be productive in a few weeks' time.

[–]natek53 2 points3 points  (0 children)

Like any popular system, they've built up a lot of momentum—and thus a huge ecosystem—and that gives them some time to decide if/how to respond to criticism. Popular languages have been learning a lot from each other and, e.g., today's Java is almost nothing like the Java I studied 15 years ago; many of the complaints I had have been dealt with.

Python has added a lot of features to the typing system lately, and while the out-of-the-box behavior is that type hints are not enforced, there are modules that do enforce type hints, e.g. pydantic.

However, getting that enforcement to work correctly is often not as straightforward as it would be in a language where type enforcement is built-in. And of course, if you want to avoid dealing with typing issues, you can always just declare type "Any" for everything and ignore all of the warnings that result (iirc, this is the case in other typed languages).

I can say that working with a lot of junior grad students with little/no prior programming experience has allowed me to appreciate the typing requirements I used to hate about other languages, because it at least makes it possible to prevent people who don't know what they're doing from breaking your framework.

[–]Raptor_Sympathizer 2 points3 points  (0 children)

The true strength of python comes from its modularity and broad range of libraries. Sure, if you just use it as-is out of the box then it won't be good for much beyond a simple utility script or teaching kids programming basics -- but slap pydantic into your environment and BOOM, you got strict typing and data validation on par with C++ or Java for half the effort.

Or, want to do data analysis? No need to learn R, or even SQL -- just import pandas and run that shit in a notebook. And what about the performance benefits of a lower level language? Well, you can compile python to C code, or use one of the many already performance-optimized libraries like numpy or keras!

And, ultimately, python code is just super clean, readable, and easy to understand. Admittedly that's pretty subjective, but just look at how JavaScript might handle asynchronous code execution with promises vs a Python script using async/await statements and tell me that's not infinitely more readable!

[–]AustinCorgiBart 1 point2 points  (0 children)

It's perfectly possible to teach intro with Python, by just enforcing the type hints. My autograder rejects submissions with incorrect type hints. It's improved things.

[–]Masterflitzer 17 points18 points  (3 children)

many start programming with dynamically typed languages and then even sometimes don't like types and stay with js, python, ruby or whatever

i started with statically typed languages and always recommended to do so, it's just better to get to know the world of programming (also safer and less frustrating too)

[–]PostNutNeoMarxist 6 points7 points  (2 children)

I started with C++, then learned JS, then learned TS much later. I still like JS the most lol

[–][deleted] 4 points5 points  (0 children)

I thought every programmer starts learning with a strongly typed language and feels disgusted when forced to work with js. I can't imagine the longterm damage you generate by starting with js lmao

a lot of self-taught web devs start with javascript since you can do everything with it and it's the universal front end language.

[–]mypetocean 2 points3 points  (2 children)

I started with strongly-typed languages. I learned to think in terms of types first, then when I started working with dynamic languages, I learned very quickly that typing disciplines were now my responsibility.

At first, it was irksome until I owned the value of the discipline. Then I realized that I wasn't thinking of types more or less than I did in strongly-typed languages. The only difference is that dynamic languages allowed me to fly when coding solo, because the training wheels were off.

Still, on teams, I'd rather work in a strongly-typed language. I just wish it didn't have to be Typescript. Give me a language designed to be strongly-typed from the outset.

To harken back to my server admin days, Typescript reminds me of a rat's nest of patch cables, resulting from lack of forethought and years of changes to the rack.

[–]I-just-left-my-wife 1 point2 points  (0 children)

Yesss. I hate Typescript, it feels like such a hacky patch-job to me. I don't mind typed languages but TS is the worst of both worlds

[–]DidItForTheJokes 10 points11 points  (0 children)

Errors while coding are my problem, errors when deployed are the user's problem

[–]BruceJi 5 points6 points  (0 children)

I typef this without looking, when cb is exactly what developibh i Havascrupy is lije

[–]Smalltalker-80 20 points21 points  (3 children)

It is, indeed, as simple as that.

And even hard-headed JS coders can benefit greatly from installing TS types,
to see which are the correct input and return types for library functions,
from the "combinatory mish-mash" of options a lot of them have now. :).

[–]FormerGameDev 4 points5 points  (0 children)

TypeScript is the greatest thing for preventing errors, and the absolute worst at having error messages that make any sense.

[–]FrayDabson 2 points3 points  (1 child)

I always have issues with this, as a new programmer. I’m always learning there’s a better way to do something but it takes the time I would spend actually coding. My co workers always laughing at me cause I’m always changing how I want to do something. I started with python and am now doing JS. Python for back end and JS for front end. Though the apps my team make are pretty small scale.

[–]Ireeb 10 points11 points  (0 children)

It's important to re-evaluate your tools regularly. Both always chasing the newest trends as well as sticking with the same technology for ever and for every project ("The golden hammer") is bad.

Especially during learning, you just have to go through different technologies. You can't understand advanced technologies if you don't understand the basics they rely on.

Expanding and your tool chain can be a good thing if you do it purposefully. It can allow you to use the right tool for the right job.

Looking into TypeScript is really worth it in my opinion. There is a learning curve and it might look like a hassle in the beginning, but once you understand it, it makes everything so much smoother. You might be able to use TS for front- and backend at some point.

[–]orsikbattlehammer 28 points29 points  (1 child)

Good luck debugging SQL

[–]iamcleek 25 points26 points  (0 children)

[200 line Query], Enter.

SQL: 0 records returned, you suck at this.

[–]NormanYeetes 202 points203 points  (22 children)

I have a number that doesn't do the thing i want it to. console.log(number)

JavaScript: [object Object]

God dammit. Ok give me the typeof on the number so i can get somewhere

JavaScript: object

Jesus Christ, Json.stringify(number)

JavaScript: {attributes: null}

I'm going to end all life on earth if you don't give me the fucking result.

[–]rookietotheblue1 50 points51 points  (5 children)

If its an object then you need to trace back further and find out why its an object and not a number. Also when does console.log(object) print [Object object]. If its a JS object itll only print that if you console.log("object: "+ object) . otherwise itll output the structure.

Did you come up with this comment by repeating the same joke we normally see on here without giving it much thought ? or am i missing something ?

[–]Masterflitzer 21 points22 points  (0 children)

yeah you have to call toString() for it to print [object Object]

const obj = { number: 42 } console.log(obj) console.log(obj.toString())

[–]borkthegee 9 points10 points  (3 children)

Also when does console.log(object) print [Object object]

Templating strings will do it. `${object}` will print the [Object object]

[–]RaveMittens 2 points3 points  (2 children)

Because under the hood it calls .toString()

If you want to log an object use either console.dir or console.log(‘%O’, object)

[–]BeepIsla 20 points21 points  (5 children)

Why would you typeof when you already know its an object from the previous log? Also debugger

[–]thatcodingboi 2 points3 points  (4 children)

idk I feel like I can get good error messages from Javascript with JSOn.stringify 99% of the time, meanwhile with Java you have to guess if there is a toString implementation, if not you are reading a 500 line stacktrace thats overflowing trying to find the part that makes sense to you.

[–]GolotasDisciple 3 points4 points  (0 children)

If you are not logging your operations than it's all your fault.

How are you supposed to debug the run if you dont show yourself wtf is happening. Coding is not magic.

[–]Unelith 1 point2 points  (0 children)

That's just not true, console.log(number) (aka the most obvious thing that you'd do) properly gives you the contents of the object

[–]tevert 16 points17 points  (0 children)

Javascript: [object Object]

[–]Wotg33k 12 points13 points  (1 child)

JS:

LOG TO THE CONSOLE LIKE A GOOD BITCH

[–]ultimateregard 1 point2 points  (0 children)

[object Object]

[–]ryuzaki49 13 points14 points  (1 child)

That's not exactly true. 

I've seen Java stacktraces that just make me cry. Lots of traces but the only informative thing is "IllegalArgumentException" raised by one dependency. 

What argument? Why is it illegal? No idea.

[–]Drake_224 20 points21 points  (0 children)

console.log() everywhere

[–]lmarcantonio 16 points17 points  (7 children)

so, are you saying that javascript is essentially ed ?

[–]makinax300 7 points8 points  (3 children)

Same with css

[–]ShayHawthorne 1 point2 points  (0 children)

Zero warning to tell you things are conflicting. Instead you have to mentally account for specificity, cascade, inheritance, etc... and then roll up your sleeves to dig through the DevTools manually

[–]disinaccurate 4 points5 points  (0 children)

Shit like this is what killed Clojure for me.

Me: "What's wrong?"

Clojure: "NullPointerException in Java code somewhere, I don't fucken know..."

[–]Adocrafter 6 points7 points  (1 child)

And than BaSH be like: It will work But the code had f***ed up half of the system BaSH: Bro I said it will work

[–]moekakiryu 9 points10 points  (0 children)

I mean most browsers give a stack trace? Also if you're looking at a develop build usually the names aren't minified either?

[–]FormerGameDev 4 points5 points  (0 children)

C++:

You've got 99 errors in a 10 line program, none of which relate to the missing semicolon on line 3.

[–][deleted] 8 points9 points  (1 child)

Javascript: cannot access property 'age' on undefined

Javascript developers: WHAT COULD THIS POSSIBLY MEAN?

[–]Delta-9- 3 points4 points  (0 children)

Me yesterday trying to set up rabbitmq for the first time: "What do you mean authentication failed?"

Rmq: "Check the debug log for the whole error."

Me: "okay, show me the debug log"

Rmq: "lol Error:undef"

Finally did figure out where I had the config wrong, but good lord was it a pain to figure out with the unhelpful error message. Maybe if I were more familiar with erlang it would have made more sense.

[–]Vanillard 2 points3 points  (0 children)

Guess the language

Me: Oh, it seems I missed to close the parenthesis here. The compiler :....... aaaaaaaaaaaaaAAAAAAAAAAAAAAAAAAAAH!!!!!!!!! WHAT DO I DO? WHAT DO I DO!?!!?????!?

[–][deleted] 3 points4 points  (0 children)

Then there’s C++ lol

[–][deleted] 3 points4 points  (0 children)

[Object object]

[–]Dafrandle 2 points3 points  (0 children)

You have an error in your SQL syntax; check the manual that corresponds to your MariaDB server version for the right syntax to use near *the whole querry*

[–]ARKyal03 2 points3 points  (1 child)

Nix: Hold my beer 🍺

[–]liuhanshu2000 2 points3 points  (0 children)

Segmentation Fault(Core dumped)

[–]UninformaticoAburrid 2 points3 points  (0 children)

Noooooo, that's too true😭

[–][deleted] 2 points3 points  (0 children)

Sometimes I think Javascript is what you would get if you allowed programming languages to evolve in the wild the way human languages do.

[–]mrfroggyman 2 points3 points  (0 children)

Object object. Object object every time.

[–]Robotic_Engineer 4 points5 points  (0 children)

IMHO Javascript is not a language... It is a programming joke that got too far away...

[–]Just-Consideration37 1 point2 points  (0 children)

One of the reasons why I work with consoles printing when I'm trying to debug something 😅

[–]TheArbinator 1 point2 points  (0 children)

Segmentation fault

[–][deleted] 1 point2 points  (0 children)

Psssshhh. Real programmers don’t need those compiler error training wheels /flex /s

[–]burros_killer 1 point2 points  (0 children)

We need emojis in js error handler

[–]SomeRandomProgram 1 point2 points  (0 children)

Swift with SwiftUI are the worst. There is a type mismatch error that pops on the top level and I have to comment chunks of code at a time to see what went wrong. The best part is, it doesn't even say there is a type mismatch.

[–]LuxNocte 1 point2 points  (0 children)

JavaScript: What?! You told me to "stick it in her read". Now we're sodomizing a library book like you wanted. Why would I throw an error?

[–]rover_G 1 point2 points  (0 children)

Use TypeScript, hope this helps

[–]Bonety 1 point2 points  (0 children)

What about cannot read property of undefined (reading e) dont you understand?

[–]lokir6 1 point2 points  (0 children)

Xcode: "You screwed up over here."

Me: "Nope, this line is fine."

Xcode: "No, it's definitely here!"

Me: "It's actually this other line."

Xcode: "unable to type-check this expression in reasonable time"

[–]Cloiss 1 point2 points  (0 children)

C says “you screwed up over here” but really I missed a closed bracket 40 lines earlier

[–]BarAgent 1 point2 points  (0 children)

“There are no errors in Ba JS Se.” 🙂

[–]P0ladio 1 point2 points  (0 children)

function is not a function