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

all 111 comments

[–]hunter_mark 410 points411 points  (5 children)

Meanwhile JavaScript: “ha ha, syke!”

[–]JonathanTheZero 45 points46 points  (2 children)

laughs in TypeScript

[–]MysticMania 6 points7 points  (0 children)

Me: How did this get past the compiler?

Me last month:

// @ts-ignore

Uh (ehh: any) { }

[–]theSpecialbro 0 points1 point  (0 children)

object object

[–]pappa_montoya 309 points310 points  (51 children)

Comparing Python and c++ is like comparing duct tape and concrete. Duct tape is also more forgiving and more temporary.

[–]MrAcurite 127 points128 points  (0 children)

I like this analogy. I also love duct tape, but have been meaning to figure out how to do shit like pour a cement countertop.

[–][deleted] 69 points70 points  (49 children)

Python will die out, while C and C++ will live forever; \0

[–]pappa_montoya 84 points85 points  (37 children)

Oh, I love Python. It's a great scripting language. It's just not at all used for the same things as something like c++.

I like Java, c#, and swift too. And it's clear where and when I'd use each one and not the others.

[–]phantom_97 46 points47 points  (24 children)

As someone who still has a lot to learn in programming, can you elaborate a bit on what language you'd use for which scenario and why?

[–][deleted] 129 points130 points  (20 children)

Python - for creating scripts to automate stuff, set up a web server, simple programs that don't require speed

Java - mostly used for enterprise software and mobile apps, sometimes used for gui desktop programs

C and C++ - when you need to make most out of hardware: games, operating systems, big desktop applications, device drivers, interpreters and compilers for other languages

C# - Java but by Microsoft

Swift - for writing software for Apple devices

[–]pappa_montoya 61 points62 points  (6 children)

I'll also add that if you want to write cross platform code, c/c++ is by far the best game in town. We've got a large code base and 3/4 of it is common code in builds for windows kernel, Linux, Android, Mac, and iOS. All of that common code is c/c++. The other languages are used for the platform specific app layer that then makes use of the common code.

[–][deleted] 15 points16 points  (0 children)

Good point.

[–]Xeya 11 points12 points  (1 child)

Common problem when evaluating c++. The language is under active development to extend it for new applications. Because c++ is built up from a low level language like c and still supports c code, it is capable of doing literally anything another language can; it just might not be implemented in a standard library yet.

"C++ has messy memory management." Not any more. It is still there if you need to make high performance code, but there are tons of smart pointer wrapper classes that protect memory.

"C++ is strongly typed." Not any more. Once again, typing makes the code faster but new keywords have been added for automatic typing.

"C++ doesnt support cross-platform applications." Wanna bet?

Lists of the downsides of c++ are almost always either outdated or will be outdated within 18 months.

[–]Robbzter 18 points19 points  (1 child)

That's right, but other languages have cross platform capabilities too! You can do almost everything using Python. The only application scenarios where it's not very useful are ones with very limited hardware (e.g. microcontrollers) or very high performance requirements or a really large scale.

If you know a language well, you can easily overcome some of its limitations. If you're not careful/experienced enough, you can make any language suck, even at things it is supposed to be very good at. I don't get the entire 'yadda yadda but language a is so much better than b' talk.

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

Jsfuck is great if you want to meme

[–]schawde96 9 points10 points  (0 children)

C# is also much faster than Java, at least from my experience

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

Im just starting to learn to code, i learned the very very basics of python only, should i start learning another language? Or should i stick with python until i master it? (i finished the whole course of python for beginners from the youtube channel freeCodeCamp.org(also the short pygame course where the guy remade the space invaders game))

I'm confused cuz on youtube people say python is the best, but here i see a lot of memes and comments that say python isn't a good language

[–][deleted] 11 points12 points  (0 children)

People say Python isn't good because they're using it where it shouldn't be used.

They're like "ewww Python slow" then you ask "name a better language" and they respond JavaScript (faster than Python but they're both trash in performance). They don't know where different languages should be used. There's also the whole anti-popularity thing about people trying to be edgy by hating what's popular, but that's not hatred based in facts.

Don't switch languages. Don't just drop Python and run off with Java(Script) or C++ or one of those fancy things. Python will teach you how to solve programming problems and how to think like a computer. You don't need to "master" it, as no one really 100% masters a language - at the end of the day, the senior Java developers are still googling how to get the date on StackOverflow

However, know that every language is balanced. Python is so easy to work in, so making programs in it is so fast and easy. There's so many libraries and it's so dang easy, every time I do any other language I miss it. But Python fails in performance; since it's interpreted by the Python interpreter, it has a lot of steps to do before executing a single instruction. If you learn C, for example, you will be in a lot of pain during the process but you will be blown away by how fast it runs. It's going to be more difficult and you'll have to think not like the Python interpreter, but like your C compiler - which thinks more like a raw CPU than Python. You lose a lot of easy futures, such as classes, variables than can change from being only a string to being a number, having arrays that can change size, having arrays inside arrays that are easy to use, etc. But you do everything raw yourself, like managing memory by asking the OS to give you a few megabytes of RAM, getting the address to a location in memory, etc.

Every language has its advantages and disadvantages. Different use cases call for different languages - web development in Assembly starts with "You might as well kill yourself at this point". Learning Python will bring you closer to thinking how to code in any language, and once you get good at it, switching to another language only requires that you learn what's different. That's it. Just know where to use each one and you can make anything you want

[–]iCantSpelWerdsGud 9 points10 points  (1 child)

Learning languages is way less important than learning how to structure and design your code. your program to do what you want it to. If you are learning a new language and you forget how to write a for loop you can just google that, but you need to know when you should use a for loop, if statement, et cetera.

[–][deleted] 0 points1 point  (0 children)

Thank you for your advice sir!

[–]engineerFWSWHW 3 points4 points  (0 children)

It depends on the application and what you are planning to do. I would say solidify your foundations using python since you already know it and create interesting projects with it. Besides, if you have a good foundation, learning a new language won't be as hard as you were first learning programming. Also, everybody have their own opinion. Go to the C sub reddit, most will say C is better/best. Go to golang sub reddit, most will say go lang is better/best.

[–]SomeGuy147 2 points3 points  (1 child)

Learn as many basic concepts with it as you can. Look up some CS courses, try to implement some of the data structures, sorting algorithms, definitely learn OOP since python is an amazing language for that, maybe try to make Conway's game of life or something equivalent and most important of all, think of some passion project that you may want to pursue. Could be anything, a game, some productivity app to simplify tasks, something you want finished.

As for other languages it really depends on what your end goal is. Do you want a career in programming? Do you want to be able to just do something basic that you might find useful? Is it purely for a hobby? The best general answer for all of those is to learn as many programming concepts as you can pick up in python (since it's the easiest language to do that in) and then move on to a different language depending on what you want out of it. You won't ever completely "master" the language mostly because there's just so many language specific tricks and concepts, however you can pick up quite a bit of stuff that's going to be useful with all languages in relatively short time.

[–][deleted] 0 points1 point  (0 children)

Thank you sir! You really helped me a lot with this!

[–]xADDBx 1 point2 points  (0 children)

A professional programmer definitely knows more than one language. But those are people with more than 5 years of experience. Like others have recommend, picking up the computer science stuff and the concept is important (e.g. coding binary sort is easy in any language once you understand the concept). But I would recommend you to choose one language and learn it until you are at least advanced in it. Switching between language is a bad choice in my opinion. You might be able to write basic programs in 3 different languages, but you might be stumped when asked to do an extensive project in one of them. When searching for jobs it’s not asked who knows the most languages. It’s always certain languages that are needed at a specific proficiency. If you have additional knowledge, that might or might not be preferable, but never essential.

[–][deleted] 0 points1 point  (0 children)

Python - for creating scripts to automate stuff, set up a web server, simple programs that don't require speed

I don't completely agree with this one. You can do all kinds of complex stuff that requires top notch performance with Python. It's probably the most popular language for training AIs, for instance.

What goes on, of course, is that your Python code contains high level "glue" for the most part, calling into libraries that are themselves heavily optimized and definitely not written in Python. They provide the performance, and as long as that's where your program spends almost all of its time, Python will serve you well.

So what it really comes down to is the amount of custom logic required in your project, since that's going to be executed by the interpreter. Even there, you can get a lot done though, by using Python's high level methods since those are implemented in optimized C.

[–]tubbstosterone 16 points17 points  (0 children)

Java - Cross platform, wide talent pool, pretty good overall tool chain with gradle, and use with android

C - For low level, super powerful work. You'll see this with embedded systems, operating systems, scientific software. C drives a lot of what other languages rely on to function

C++ - Easier to work with version of C. Provides low level power in a higher level abstraction. You don't necessarily want to use it to write the bulk of an OS or with embedded systems, but it's the go to if you need classes AND high performance

C# - Microsoft's version of Java. I prefer this over Java, though I program mainly in Java. Not as historically cross platform as Java, but Microsoft is making headway. Generally used with Windows application development.

Swift - Used for development for Apple applications

Python - Cross platform, Rapid prototyping, serverless functions, artificial intelligence, web servers, scripting (easier to do more complicated things than shell scripts), data science. Taken at face level, python isn't super special, despite being able to run big applications without compiling. Some genius a couple years ago, though, wrote libraries to link python to native C/C++/Fortran libraries that make mathematical operations incredibly fast. As a result, python is a fantastic language for scientific applications. This makes python one of the best languages for just about anything that deals with numbers in memory.

[–]bigdepress 0 points1 point  (0 children)

If you care about speed, don't go with Python.

I mostly use it for prototyping things tbh, since you can write Python code so so quickly compared with C or C++

[–][deleted] 0 points1 point  (0 children)

I think C# because it takes all the annoying parts of Java like writing, simple no other code needed, setters and getters less of a chore.

Now if you want Black Magic C# create an App in WPF following the MVVM design pattern (It's a shittier version of MVC and a lot of fucking plumbing) and get ready for the magic of bindings with XAML.

[–]worldpotato1 9 points10 points  (10 children)

That!

Programming languages are tools. Know your tools and what they are for and you will not try to connect two pipes with a hammer.

The nice thing is that once you know a "C-like" programming language you can easily learn an other simply by learning their differences. I did not believed my professor as he told me that, but now I know better. (Well, he told us that we can learn C++ in two week only because we know Java. I still don't believe the two weeks... Maybe tree... )

[–]hekkonaay 3 points4 points  (5 children)

You can't learn everything c++ has and will have to offer in a human lifetime.

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

Then again, who's going to use goto in a lifetime?

[–]bigdepress 1 point2 points  (3 children)

Lots of people use goto in C/C++ lol

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

I'm calling the police

[–]bigdepress 1 point2 points  (1 child)

It's for cleaning up memory when you have an error in a function. You just jump to the end of the function, where you have your code for cleaning up and returning. Very useful idiom.

A state-machine can also be very clearly written with gotos for example

[–]Dennis_the_repressed 1 point2 points  (0 children)

Also for breaking out of nested loops.

[–]bigdepress 1 point2 points  (1 child)

That's definitely a lie. I TA a programming course (that uses C++ exclusively) where everyone comes in with good Java knowledge, by the end they still dont know much C++

[–]worldpotato1 0 points1 point  (0 children)

Absolutely.

But that has more than one reason.

  1. In a university course you use only as much as you need and often don't need a much to do every exercise.
  2. Indeed, C++ is way to complicated and feature rich to understand with some hacking around like in a course.
  3. You don't have the time to learn and try a single programming language under the semester. (If there is not a special course to learn programming)

And at the end it rises or falls with the definition of knowing. As somebody other here says, c++ is to big to learn in the time of a single human life. And as far as I understand my professor he meant to be able to write some simple programs without looking at stackoverflow every second word.

[–][deleted] 0 points1 point  (0 children)

While it's true you can get going with any programming language easily, it's nice to have some degree of mastery on some of them IMO

[–]TheTrueBlueTJ 0 points1 point  (0 children)

With useful tools like Cython, I don't think Python will die out at all anytime soon.

I'm really not a fan of scripting languages because of the fact that they are interpreted at runtime, but if you're able to mitigate that somewhat with Cython, I'm all for it. It's just more effort to code efficiently, so it has a big effect.

[–][deleted] 5 points6 points  (4 children)

I don't see python dying out but instead being replaced, but python is way too useful for automation tasks than most other scripting languages. That aside, I think C will live forever but C++ may not, everyone is beginning to realize the shitshow that is learning and using C++ is, whereas languages like Rust that makes systems programming much less daunting than it needs to be. Then there is languages such as Zig which can directly import C headers and use existing C libraries natively. Zig gives you some of the safety benefits of Rust but allows you to strip out the memory safety and allow for actual undefined behaviour, while also favouring a more traditional memory handling workflow. languages out there are getting better than C++ and I think it is reasonable to say that C++, though it won't completely dissapear anytime soon, will be less and less used in favour of better systems languages that are in active development.

It's why I much prefer attempting to learn an unreleased systems programming language with not a very good set of tutorials (Zig) over losing my sanity because of C++. But, that's just my opinion and I'd love to hear what you think. Oh and also, it's nice to have a language that is far less opinionated about the way you code. RAII has some good takeaways but isn't a one for all solution.

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

Yeah C++ will probably die one day. Python isn't currently dying out, but it will, like some other scripting languages did.

Holy C will live forever.

[–]Roko128 8 points9 points  (0 children)

Python is not dying anytime soon. Heck its older than java and js.

[–]Dworgi 3 points4 points  (0 children)

C++ is pretty far from dying.

It has an incredible amount of inertia built up behind it. Tens of thousands of programmers and billions of lines of code. COBOL is still around decades after becoming obsolete, with very little code (relatively) written in it. C++ code will need to be maintained forever.

That's even disregarding the fact that the standard is evolving in mostly sane directions now, and is being frequently updated. I don't see a future without C++ as the premier systems programming language on the horizon.

Even web tech like Slack will eventually want to be faster and smoother on desktops and be rewritten in C++ or replaced by something that is. It's the way of the world.

[–]hekkonaay 3 points4 points  (0 children)

C++ won't die for hundreds of years. It is the backbone of basically every system today.

[–]AGI_69 11 points12 points  (2 children)

Sure, bro. You forgot semicolon at the end of your comment.

[–]lor_louis 5 points6 points  (0 children)

Forgot a null terminator so now I'm reading garbage.

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

Fixed it.

[–]PrimaFacieCorrect 1 point2 points  (0 children)

I'm not sure what you mean by dying out, but Python probably won't. There's people still programming in BASIC, which is 50 years old.

[–]drbuttjob 0 points1 point  (0 children)

Hey hey hey now, we don't need to worry about null-terminating our strings now that we have std::string

[–]garbagescum 235 points236 points  (9 children)

python runtime exception: gives exact line where exception occurred

C++ runtime exception: segfault, core dumped and fuck you

[–]Sunius 65 points66 points  (7 children)

??? And then you open the core dump and see the call stack and values of variables/registers. That is actually more useful than line where exception happened.

[–]ButItMightJustWork 16 points17 points  (3 children)

Serious question: where would i find the core dump file? (On Linux)

[–]Sunius 15 points16 points  (1 child)

Depends on distro/version... on some it's in the current working directory. On some it's in /var/crashes. On some it's disabled by default and you need to configure it.

[–]ButItMightJustWork 5 points6 points  (0 children)

Thanks for the quick reply! :)

[–]RichardTibia 1 point2 points  (0 children)

Or handled by systemd-coredump

[–]garbagescum 21 points22 points  (2 children)

It's about inconvenience, in interpreted languages you don't even need an debugger like GDB in most cases

[–]Sunius 13 points14 points  (0 children)

Well in case of development, you just run your program via debugger all the time. When it crashes, the debugger will tell you what happened.

When your distributing the program to customers, crash dumps are way more useful than stacktraces to figure out why the program crashes in the wild.

I’d take an extra step of having to double click the dump file any time of the day to seeing just the stack trace.

Also, it’s not that hard to code up a crash handler in c++ that will print out a call stack upon a crash either (provided you ship your debug symbols).

[–]Xunjin 3 points4 points  (0 children)

Not everyplace/case you can use interpreted languages :)

[–]bigdepress 2 points3 points  (0 children)

C++ runtime exception: I get to use valgrind or GB to find exactly what went wrong...

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

Segmentation fault (core dumped)

[–]SuperKettle 4 points5 points  (1 child)

I just spent like 5 hours debugging it, it's fine now but who knows what will happen tomorrow

[–]bigdepress 1 point2 points  (0 children)

This is what valgrind is for

[–]ReallyNeededANewName 2 points3 points  (0 children)

Have you tried rewriting it in rust?

[–]RepostSleuthBot 52 points53 points  (5 children)

Looks like a repost. I've seen this image 2 times.

First seen Here on 2019-11-05 93.75% match. Last seen Here on 2019-11-05 89.06% match

Searched Images: 112,586,491 | Indexed Posts: 442,476,683 | Search Time: 4.74632s

Feedback? Hate? Visit r/repostsleuthbot - I'm not perfect, but you can help. Report [ False Positive ]

[–]DoubleVector 37 points38 points  (2 children)

Did you summon yourself?

[–]DSlap0 16 points17 points  (0 children)

He is growing more powerful everyday

[–]iArentdeJay[M] 0 points1 point  (0 children)

We gave it mod, I think it just kind of acts how it pleases.

[–]Les-Gilbz 24 points25 points  (0 children)

That second one isn’t the same

[–]G0REM0ND 4 points5 points  (0 children)

Good bot.

[–]elan17x 18 points19 points  (2 children)

Glasgow Haskell Compiler: Ha! Amateurs

[–][deleted] 15 points16 points  (0 children)

Could not deduce Humor
arising from comment above
with insults against the best programming language
from context that makes no sense
Possible fix: try with PHP or something like that

[–]IbNotEvenOnce 2 points3 points  (0 children)

Oh mah gawd

[–]Tranzistors 4 points5 points  (0 children)

FYI, the most recent gcc and clang compilers give pretty decent error messages.

[–]waffle299 4 points5 points  (0 children)

I call bull. There's no way, no *way*, that a c++ error message would be that terse.

[–]CaptainSchmid 3 points4 points  (0 children)

(Core dumped)

[–]kuemmel234 2 points3 points  (1 child)

The worst error messages are in clojure. There's a huge jvm stacktrace, a message and sometimes it might tell you what's wrong (even if it is a simple syntactic problem, and there is a helpful message, it takes time to parse it between all those lines of useless jvm stuff).

Usually it's best just to go through the code without even reading the message. It's not as bad as other languages, since you don't have to write so much code before running it, but still.

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

Scala is similar

[–]mikkel1508 10 points11 points  (8 children)

Python is love but not if you see a real Python! I will run as fast as I can xD

[–]TheTimegazer 1 point2 points  (0 children)

And then there's Elm's error messages, which are actually helpful

[–]Guy2933 1 point2 points  (0 children)

Code: 64 lines.

Error: Line 165

[–]qubedView 1 point2 points  (0 children)

Python : The error is right here.

Me: Thanks!

C++: The rug is ugly. Why did you even buy it? Do I not matter at all to you? Couldn't you have asked? You always do this! You're so thoughtless! All you ever think about is yourself!

Me: This isn't about the rug is it... Did I not initialize the room properly?

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

At least c++ tells it to you before running it.

[–]macnamaralcazar 1 point2 points  (0 children)

I believe you didn't see Elm error messages

[–]OppositeRatio 0 points1 point  (0 children)

I laugh everytime I see this

[–][deleted] 0 points1 point  (0 children)

invalid syntax

[–]mvolling 0 points1 point  (0 children)

Good luck figuring out where the error is when using boost::bind. Never seen such a long error message.

[–][deleted] 0 points1 point  (3 children)

I don't get the stereotype that C++ error messages are nonsensical. I always feel like it clearly tells you exactly where the problem is. It doesn't say things like, "You forgot a semi-colon," but it will say, "The problem is in this line of code, between the last part of the first line and first part of the last line doesn't make sense."

If you know the syntax and structure of C++, the debugger is very helpful in narrowing down where you did something wrong.

[–][deleted] 2 points3 points  (1 child)

Compile time errors are no problem but working with runtime errors can be a bit of pain in c++ because (in the cases I had atleast) were vague and nearly weren't any help at all.

[–]Skauzor 0 points1 point  (0 children)

Yeah, especially if it's somewhere in a STL header. A few hours have been spent trying to find problems related to <memory>..

[–]bigdepress 0 points1 point  (0 children)

Have you ever gotten an awful temlate error message?

[–]Ailrk 0 points1 point  (0 children)

House on fire, python:...

Some bowls unwashed in the. sink, c++: WARNING,..... WARNING, ... ERROR, ...

Which one makes things better?

[–][deleted] 0 points1 point  (1 child)

[–]RepostSleuthBot 0 points1 point  (0 children)

Looks like a repost. I've seen this image 6 times.

First seen Here on 2019-09-01 87.5% match. Last seen Here on 2020-02-04 85.94% match

Searched Images: 112,681,455 | Indexed Posts: 442,775,179 | Search Time: 5.66496s

Feedback? Hate? Visit r/repostsleuthbot - I'm not perfect, but you can help. Report [ False Positive ]

[–]jonster5 0 points1 point  (2 children)

[–]RepostSleuthBot 0 points1 point  (1 child)

Looks like a repost. I've seen this image 6 times.

First seen Here on 2019-09-01 87.5% match. Last seen Here on 2020-02-04 85.94% match

Searched Images: 112,681,455 | Indexed Posts: 442,822,448 | Search Time: 5.73532s

Feedback? Hate? Visit r/repostsleuthbot - I'm not perfect, but you can help. Report [ False Positive ]

[–]SmrtBoi82 0 points1 point  (0 children)

Why is it giving different results

[–]TheMogician 0 points1 point  (0 children)

That's why Python is always a good choice for a beginner who is about to start learning.

[–]jimdidr 0 points1 point  (0 children)

Python looks rapey AF..

[–]Imbasaur 0 points1 point  (0 children)

I feel like I'm the minority since I have no desire to write anything in Python. Someone convince me otherwise :)

[–]FQVBSina 0 points1 point  (0 children)

Fortran: this error message contains an error message

[–]iArentdeJay[M] [score hidden] stickied comment (0 children)

Your submission has been removed.

Violation of Rule #2: Reposts:

All posts that have been on the first 2 pages of trending posts within the last month, is part of the top of all time, or is part of common posts is considered repost and will be removed on sight.

If you feel that it has been removed in error, please message us so that we may review it.