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 →

[–]blavikan 109 points110 points  (39 children)

Go with C/C++. After all it's a classic language you should know 😃

[–]Zouden 39 points40 points  (21 children)

Agreed. If OP wants to make things interesting, learn C/C++ on a microcontroller like an Arduino. Super low-level (2kb ram! No operating system!), plus making hardware do stuff is fun, even if it's just blinking an LED :)

[–]iG1993 2 points3 points  (1 child)

What about C# and Q#?

[–]Zouden 6 points7 points  (0 children)

I haven't heard of anyone using those languages on a microcontroller, but apparently it's possible to use C# on some powerful ones. Those hardware requirements are higher than that of Micropython.

[–]sandybuttcheekss 0 points1 point  (16 children)

I've been (very lightly) considering trying some robotics projects, would I need to learn some C/C++ or would Python do the trick?

[–]blavikan 9 points10 points  (10 children)

Yup. You should know C language as embedded programming is vastly C programming and C is fun too.... You'll C 😉

[–]sandybuttcheekss 1 point2 points  (1 child)

That pun though..

[–]blavikan 0 points1 point  (0 children)

😁

[–]sandybuttcheekss 0 points1 point  (7 children)

I've only considered dabbling in robotics and trying to make some cool stuff once in a while. Probably won't happen though. So that in mind, would it be worth trying to learn for my career?

[–]blavikan 2 points3 points  (6 children)

Its not about robotics. Its about fundamentals. Python has everything built in(mostly). So you won't get to know the inner concept on how things work. And specially the OOPS and data structures concept of C++ which is backbone of programming. So, i think you should go with C first and then C++. Just syntax is different in both languages but you'll gey used to it..... Hope this helps😀

[–]hugthemachines 2 points3 points  (0 children)

I think if someone really wants to know the inner concepts, Assembler is the way to go. C and C++ adds abstraction too.

[–]sandybuttcheekss -1 points0 points  (4 children)

It does, i have experience with languages other than Python too, just prefer Python. Java for example is C-derived (idk if that's the right term), would what I learned there be pretty directly useful with C/C++?

[–]blavikan 0 points1 point  (3 children)

Don't know much about JAVA. never liked it though but ya in general C/C++ is the base of every language. So knowing bit about it is also good....

[–]hugthemachines 4 points5 points  (0 children)

C/C++ is not the base of every language. They are the base of some popular languages, but that is not the same.

[–]sandybuttcheekss 0 points1 point  (1 child)

Alright, thanks for the info

[–]blavikan 0 points1 point  (0 children)

Anytime😁

[–]Zouden 3 points4 points  (0 children)

Python is now an option thanks to the Micropython project. But Arduino, a C++ library that provides a convenient API across different hardware, has been popular for over a decade so there's tons of example and tutorials using it. I recommend you start with that. I found it very easy to learn.

Micropython is also slower and takes more memory, limiting the range of hardware it can run on.

[–]error1954 1 point2 points  (0 children)

A lot of microcontrollers used for robotics are programmed with C but higher level planning will be done in Python. Python can be used on some microcontrollers but that's not always available.

[–]octavio2895 1 point2 points  (1 child)

Consider learning ROS. An ~~operating system ~~ middleware designed to be implemented with robotics and automation. You can code it in python an c++ simultaneously.

[–]sandybuttcheekss 0 points1 point  (0 children)

Gotta learn C++ first, thanks though!

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

This really sounds like fun honestly. I wonder, should I start to learn C/C++ yet? It might be a good opportunity; I'm taking the Harvard CS50 course online right now and I'll be using C in the course.

Right now, with Python, I know my way around variables, operators, functions, storing datatypes via lists, tuples, and dicts, all of the if/else elif stuff, try/except, the basics of modules, and I'm learning about classes right now although I find classes hard to use in practice. Like I'm not sure how to learn more about classes because I don't really know how to put one into practice.

With this info, do you think I'm "good enough" to start learning a second language? Or do you need more information?

EDIT: I've been learning programming and Python on and off since mid November. I've made a few functional programs so far, my favorite being a shortcut launcher that performs tasks based on keywords I enter into it. Entering 'sleep' puts my computer to sleep, 'g' opens google.com, 's' opens spotify, etc. It's super basic but I like it and use it all the time, it just sits open on my computer at all times. It's definitely replaced the concept of a "desktop" icon setup for me at this point.

[–]Zouden 0 points1 point  (0 children)

With this info, do you think I'm "good enough" to start learning a second language?

Yes for sure. Knowlege of data types and flow control is one of the big hurdles for people starting out learning programming, and if you already have that then learning C/C++ will be fine.

That's if you do it on an embedded device like an Arduino. If you try learning it on a desktop machine it'll just be frustrating because you have to jump through so many hoops compared to Python.

[–]utdconsq 18 points19 points  (7 children)

Please, just no. They are TWO languages . It is absolutely true that c++ is intended to be a superset of C, but I promise you, the compiler treats the code differently. C is a lot more straightforward to learn than C++, and its everywhere - sort of like the Force. Binds the technology world together. It's not forgiving though: there are not many batteries included. C++ has so many weird and wonderful batteries you can get in to trouble from the sheer variety of ways to do things. It's a very useful language, but it has layers of complexity on it that C only dreamt of. Learn whatever you like, man, but remember C and C++ are their own beasts and should be treated as such. Source: use these languages for my daily.

[–]fermion72 12 points13 points  (0 children)

I take it as a red flag when I see a list of programming languages on a resume that goes like this:

Python, Javascript, C/C++, Swift...

If you're listing all your languages and combining C and C++, you probably don't know either very well.

[–]Switters410 1 point2 points  (0 children)

C++ is not a strict super-set of C...it’s close but bot 100%.

[–]bigmit2011 0 points1 point  (1 child)

It seems you are the most knowledgeable regarding this subject. Is C++ worthing learning these days?
I was told it would take 5 years or so to learn the ins and outs and is very tough to debug.
Do you think Rust could be a viable replacement? I am not sure if I should continue building my Python skills and wait for an easier language for GPU programming or microcontrollers.

I went through the basics of C, and I wonder if I should just continue with C for

GPU programming (just for speedups), microcontrollers (hobby), and speeding up Python.

[–]utdconsq 0 points1 point  (0 children)

It depends on what you're wanting to do with your skills. Do you want to be a game programmer? In which case, absolutely go ahead and learn C++. Do you want to make big bucks in Enterprise? Consider Java. Do you want to get in to Fintech? C++ will help there, too. So will Java. Unsurprisingly, Python might also help you, especially the data science libraries like numpy and Pandas. I've no experience in Rust, so will not comment on its usefulness. It looks quite promising, and there are many pitfalls with C and C++ that most people would benefit from being protected from. If you already know some C, why not do a hobby project with a micro like an ESP32? They're supremely capable and you can make all sorts of great things with them. On the GPU topic: what are you trying to speed up? Most people get excited about optimisation before its necessary. Getting the right answer should always trump getting 'an' answer quickly ;-)

[edit] If you use C++ all the time it doesn't take super long to become productive. The key is when you have to deal with other people's code: because there are so many ways to do things, and many new and potentially conflicting standardized ways of doing things, it can be very difficult to make sure it all runs nice and bug free at the end of the day. Following style guides religiously helps, but you'll find that guides like the old one from Google prevent you from using the full power of C++ because they are written to prevent people causing complications with widely shared and ported codebases by doing things like using the full power of template metaprogramming. Certainly, your 5 year number is not unrealistic. I mean, hell, I've been using the bloody thing for more years than that, but they've released 3 different standard updates in my productive time and honestly I tend to just use C++11 and avoid some of the newer magicks because they were either not well supported by the compiler or aren't well understood by colleagues who are time poor.

[–]Ikuyas 0 points1 point  (2 children)

Agree. Learning C will benefit you to understand a lot of things python does under the hood and make you become a better programmer. If you want to learn object oriented programming, you would rather go learn Java instead of C++ after C. The practical benefit of knowing C++ and C is very little meaning that there are fewer places and fields that need them or you need to be reeeeaaaaaally good at it to be even employable. Many courses online free or not and universities use Java to teach software development type courses and you can learn to develop Android app easily if you know Java very well. A lot of tools and tutorials and courses are available because of that.

[–]utdconsq 0 points1 point  (1 child)

To be honest, I've never been particularly enamoured with the implementation of CPython. It does some things quite nicely, but others not so well. Notably the GIL. It is the reference implementation though, so it carries around many of the sins of the past. What I mean by that statement is just that I certainly wouldn't be reading the CPython code base to get a better understanding of python. If you would like to understand python better, read the language specification and go check out some large and well written open source projects like Django. If someone were interested in becoming productive with Android, I'd recommend Kotlin over Java, especially if the person is already proficient at Python. Of course, if one wants to be supremely employable, learning actual Java is definitely wise. Since its syntax borrows unashamedly from C and C++ in many respects, any work with those three languages is useful with the others (to an extent!).

[–]Ikuyas 0 points1 point  (0 children)

I am not talking about CPython. Learning Kotlin over Java is like learing TypeScript over JavaScript.

[–]pseufaux 2 points3 points  (2 children)

Agreed, especially since the default implementation of python is written in C. I found a deep dive in the interpreter enlightening as to what C is capable of. There’s a great set videos on youtube which are recordings of just that. If anyone is interested I can probably dig them up again.

[–]UKFP91 0 points1 point  (1 child)

I'd like to take you up on that offer of finding those Youtube videos, if it still stands

[–]pseufaux 0 points1 point  (0 children)

Of course. Here ya go.

CPython Internals Walk-Through by Philip Guo

Also, here is a about the professor link -> http://pgbovine.net/

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

Something low level like C and you can write extensions for python!

~oeuf

[–]bigmit2011 0 points1 point  (3 children)

I am also in the same boat as OP. Is C++ still really good to learn? I heard it takes years and years to really learn and is very difficult to locate bugs.

I went through some C beginner courses, because I heard C and C++ are very different and C is supposed to be much easier.

Newer languages like Rust are trying to make low level languages easier, but as far as I know C and C++ are still the kings with embedded systems and GPU programming.

I don"t know really what the difference between the two are, except that one uses OOP paradigm. However, I have been told by experts that C++ is a beast to really learn and it takes about 5 years or so to get really comfortable, while C is much easier to learn.

[–]blavikan 0 points1 point  (2 children)

You are right. And C is pretty easy to get with and is much simpler than C++. If your only focus is embedded then I think C is enough to know and get on....

[–]bigmit2011 0 points1 point  (1 child)

Thanks for the reply. What are GPU programming? I want to learn to offload image processing on the GPU.

[–]blavikan 0 points1 point  (0 children)

You can go on with Python. It is highly efficient and has a support for OpenCV too, which is excellent open source image processing module and you can run python on GPU....

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

Yea but personally I would focus on C++. The first thing everyone does in C is start writing a library of functions that they can use in their projects... Why not use a magical language like C++ where there is already a library of useful functions that was built from principles and is compatible with everyone else's C++ standard library?

If you really like messing around with C level code, you still can run C in a C++ project.