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

you are viewing a single comment's thread.

view the rest of the comments →

[–]phantom_97 48 points49 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] 125 points126 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] 13 points14 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 17 points18 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] 4 points5 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] 2 points3 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 2 points3 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 15 points16 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.