# Trying to decide which programming language I want to learn

## Main Question or Discussion Point

Hi

I just want to learn a language, but I don't know which one is best for me. I did programming back in the 70s and early 80s, mainly in assembly language. I learned Fortran, Basic and Pascal before, but they are so old. I since changed my career to analog and RF electronic designs and had not tough programming since. This is mainly for mind excise, I rather this than crossword puzzles for retirement.

I am thinking about C# or C++ as this is used in firmware design. Another one is like Python because both my grandkids are into gaming, I bought a book of Python for Kids to my teenage grand daughter and she is learning it. So that is like playing with grand kids. One kind I don't want is language for business, I have no interest in business, mainly scientific or maybe gaming.

Any suggestion will be appreciated. Also how to get started when I decide on one language.

Thanks

Related Programming and Computer Science News on Phys.org
PeterDonis
Mentor
2019 Award
I think Python is a good choice, particularly if your grandkids are already learning it. The numpy and scipy libraries will give you lots of options for scientific programming, and there is PyGame as a general framework for game programming.

how to get started when I decide on one language
My best advice is to pick something to build and build it using the language. That way you will have a practical outcome to guide you.

You mentioned science and gaming, so I don't know if math (not particularly related to science but just math) is another interest of yours, but if it is, writing Python programs to solve Euler problems [1] could be a good exercise to learn Python.

[1] https://projecteuler.net/archives

Master1022, cobalt124, Dale and 4 others
FactChecker
Gold Member
Python will be much more fun and interesting. There are a lot of hobbyists and advisors on forums. Grandchildren who like gaming may learn languages like Scratch and Mindcraft. I have mixed feelings about that, but they seem to enjoy it. If you want to coach them, you should look into that. They will not learn basic programming in Scratch without some coaching. C and C++ would have advantages in a job search, but programming with them is more tedious.

Last edited:
bhobba
I guess for my interest, it's C# or C++. I designed a lot of micro controllers, Just when I was working, there were plenty of people that good in C++, I just design the hardware, they took over, everything worked and I never have to fix anything. Then I was happily going back to my analog world. If I learn C++ or C#, I can do hobby projects all by myself.

If I go this route, which one is better, C# or C++ or some newer language I don't know of?

You know how teenagers are, it's not cool to play with grandpa!!! What if I learn python and they don't even play with me?!!!

Klystron and DifferentialGalois
PeterDonis
Mentor
2019 Award
If I learn C++ or C#, I can do hobby projects all by myself.
You can do programming for microcontrollers in lots of languages. I have done it in Python. It really depends on what specific kind of microcontroller you want to program and what languages are easily available for it and have the libraries you need for whatever you want to do.

bhobba
FactChecker
Gold Member
There is a great deal of interest in robotics in the Python community. A lot of hobbyists are using single-board computers (SBCs) like the Raspberry Pi that are cheap, very easy to get information, tutorials, and help, and have a lot of interface capability to external hardware (including many GPIO connectors). Some SBCs even have processors that are specialized for neural networks. I suggest that you look into all this before you make a decision. It is a very exciting and fun new world.
One resource that I like to watch to keep up with these things is the youtube channel, ExplainingComputers.

Last edited:
bhobba and sysprog
I decided to go with C# as I googled and seems like C# is the prefer language. It even can do gaming. I bought 3 books a year and half ago and really never get into it. Now maybe I should start seriously this time. I bought these 3 books:

https://www.amazon.com/gp/product/1...title_o08_s00?ie=UTF8&psc=1&tag=pfamazon01-20

Shown is volume 1, I have vol 2 and 3. It's cheap.

Question is where can I get a compiler, where do I write the program? How do I get started? Any free software or do I have to buy it?

Thanks

I decided to go with C# as I googled and seems like C# is the prefer language. It even can do gaming. I bought 3 books a year and half ago and really never get into it. Now maybe I should start seriously this time. I bought these 3 books:

https://www.amazon.com/gp/product/1...title_o08_s00?ie=UTF8&psc=1&tag=pfamazon01-20

Shown is volume 1, I have vol 2 and 3. It's cheap.

Question is where can I get a compiler, where do I write the program? How do I get started? Any free software or do I have to buy it?

Thanks
https://docs.microsoft.com/en-us/visualstudio/get-started/csharp/?view=vs-2019

yungman
Thanks

So I just download Visual Studio and I can write the code and compile C#?

My grandson told me just now that C++ is better for writing game programs, is that true? I have no idea.

I went on google, it said C++ is more compact thereby run faster, C# needs a lot of library, it's slower and bigger. That C++ is superior for needing speed and much smaller. Maybe I should look into C++ instead.

Klystron
256bits
Gold Member
The numpy and scipy libraries
You just make that up.
It's funny, and sort of describes it too, IMO.

DifferentialGalois
FactChecker
Gold Member
You just make that up.
It's funny, and sort of describes it too, IMO.
That is what they are called. Numpy SciPy

DifferentialGalois, Janosh89 and 256bits
yungman said:
Thanks

So I just download Visual Studio and I can write the code and compile C#?
Here's a good tutorial that is designed for beginners: https://www.homeandlearn.co.uk/csharp/csharp.html
My grandson told me just now that C++ is better for writing game programs, is that true? I have no idea.

I went on google, it said C++ is more compact thereby run faster, C# needs a lot of library, it's slower and bigger. That C++ is superior for needing speed and much smaller. Maybe I should look into C++ instead.
C# is easier to get started with, largely because of the .NET framework, but I think that you will need to read up some more in order to acquire a sound basis for having a preference.

256bits
Gold Member
My grandson told me just now that C++ is better for writing game programs, is that true? I have no idea.
For serious graphic games on Windows?
You should then have to learn the criptic Windows Win32 API library.
( even so, for any graphics you will be using the Windows features to put something on the screen for other than a text console )
Not easy.
Also something like OpenGL, Blender, DirectX or other 2D, 3D graphics libraries, sound, etc for the nice scenery.

Here is an older book that de-mystifies some of it - games are 2D video arcade type.
https://www.oreilly.com/library/view/sams-teach-yourself/067232461X/
Perhaps you can pickup a copy and the code disk on the cheap.

EDIT - Kind of weird.
The book is from 2003, and amazon has it listed for 37.99$, should be about 5$.
https://www.amazon.com/Sams-Teach-Yourself-Programming-Hours/dp/067232461X&tag=pfamazon01-20

sysprog
256bits
Gold Member
That is what they are called. Numpy SciPy
Oh, OK, sorry for the off direction post from above.
Not like Ren and Stimpy cartoon, I thought it was a play on words.
https://en.wikipedia.org/wiki/The_Ren_&_Stimpy_Show
" the adventures of title characters Ren, an emotionally unstable Chihuahua, and Stimpy, a good-natured yet dimwitted cat. "
which was Python years ago.
Maturity has come with age though.
Ren and Stimpy were just cancelled.

FactChecker
Here's a good tutorial that is designed for beginners: https://www.homeandlearn.co.uk/csharp/csharp.html
C# is easier to get started with, largely because of the .NET framework, but I think that you will need to read up some more in order to acquire a sound basis for having a preference.
The moment I read about C# being slower and size is much bigger, it really turns me off already. I don't know what is the modern terms called, in my days long time ago, we called "calling subroutine" to perform certain task to speed up programming. That is people can write all different subroutine and you just import a whole bunch of subroutine and call them so it make programming simpler and can be written much faster. The problem is the more you call, the slower it gets particularly if you pull in a whole bunch of subroutines that you don't use that come in the whole package. that makes the program very large and get slower and slower to run.

This is like when the computers get more advanced, the slower it run. True, it might have a lot more bells and whistles, but it just gets slower and slower compare to the older days when old computers running old programs.( emphasize running old programs that don't have all the bells and whistles......but do get the job done). I suspect calling a whole bunch of subroutine has something to do with the speed of running ( or the lack of).

The other example that really turns me off is like in the new cars, the response of the control is so so slow. You start the car, for the first 15 seconds, I cannot change the radio station, change the volume and all, it just has to wait for it do display " make sure you do this and do that"!!! Like I cannot control the fan speed, and other simple things. It's like it can only do one thing at a time and you have to wait for it to go through all the start up before you can gain control. My 2014 car is nothing like this. It's like the more advance the computers are, the slower it gets. Not to mention all the bugs!!! Like all of a sudden, the control lose all controls, I had to stop the car, put the transmission to neutral then everything start working again.

Sorry about the ranting. My 2018 car was in the shop for like 5 weeks in the first 9 months, all computer problems. Never really got fix, just got better with new software updates.

FactChecker
Gold Member
Comparing the speed of old computers with modern ones is comparing apples and oranges. The old computers are not in the same league as modern ones. Judging the speed of computer languages is tricky and often meaningless. One significant factor is the difference between interpreted code (essentially compiled as it runs) versus compiled code (compiled before it runs and then runs unimpeded.) But even interpreted code often can be compiled and run fast. IMO, for most use in a hobby, the speed difference between C# and C++ should not make a significant difference. But it is slower (see this)

pbuk
Gold Member
You can't use C# on a microcontroller, the only "advantage" C# (which is a Microsoft product) has over any other version of C is that it can create interfaces that look the same as any other Microsoft product.

You would be much better off with C++, and if you are already familiar with microcontrollers and electronics then this would be a great way to get into it: I recommend one of the Elegoo Arduino kits available on Amazon.

But Python would also be a good way to go and as has already been mentioned this can run on (more powerful) microcontrollers too - check out the Adafruit Feather M4 Express which ships with CircuitPython, and there is also the alternative MicroPython ecosystem.

However microcontroller programming has its own quirks, and is possibly not the best place to start. I'd start with Codecademy: you can get through the "Hello World" tutorials and more in both C++ and Python in an evening (and I'd throw in my current favourite JavaScript too) which will give you more of an idea where you want to go next.

Klystron, bhobba, yungman and 1 other person
You can't use C# on a microcontroller, the only "advantage" C# (which is a Microsoft product) has over any other version of C is that it can create interfaces that look the same as any other Microsoft product.

You would be much better off with C++, and if you are already familiar with microcontrollers and electronics then this would be a great way to get into it: I recommend one of the Elegoo Arduino kits available on Amazon.

But Python would also be a good way to go and as has already been mentioned this can run on (more powerful) microcontrollers too - check out the Adafruit Feather M4 Express which ships with CircuitPython, and there is also the alternative MicroPython ecosystem.

However microcontroller programming has its own quirks, and is possibly not the best place to start. I'd start with Codecademy: you can get through the "Hello World" tutorials and more in both C++ and Python in an evening (and I'd throw in my current favourite JavaScript too) which will give you more of an idea where you want to go next.
Thanks for the info. The fact I cannot use C# in microcontroller seal the deal. That's what I was to get into in the future as I am really a hardware/analog engineer at heart. Ultimately it's the whole project that matter to me. Electronics is my ultimate passion, I have been designing and built high end hi-fi amps for years and I pretty much hitting the ceiling already. That's the main reason I am looking for another hobby in electronics as my "crossword puzzle" to keep my mind from turning into jello!!!

Can you give me a suggestion to download the software to write and compile C++? Just like Visualstudio that Sysprog suggested.

Thanks

Alan

If you want optimal efficiency ##-## https://docs.microsoft.com/en-us/cpp/assembler/masm/masm-for-x64-ml64-exe?view=vs-2019
Thanks for the info. The fact I cannot use C# in microcontroller seal the deal. That's what I was to get into in the future as I am really a hardware/analog engineer at heart. Ultimately it's the whole project that matter to me. Electronics is my ultimate passion, I have been designing and built high end hi-fi amps for years and I pretty much hitting the ceiling already. That's the main reason I am looking for another hobby in electronics as my "crossword puzzle" to keep my mind from turning into jello!!!

Can you give me a suggestion to download the software to write and compile C++? Just like Visualstudio that Sysprog suggested.

Thanks

Alan
It's not quite accurate to say that you "can't" run C# on a microcontroller, e.g. https://en.wikipedia.org/wiki/Netduino, but C and C++ don't require .NET ##-## Visual Studio is well-adapted for C and C++ ##-## https://visualstudio.microsoft.com/vs/features/cplusplus/

yungman and pbuk
pbuk
Gold Member
I'd get started in codecademy because you don't need to set anything up, it all just works online. Where you go from there depends on whether you go the microcontroller route or desktop programming.

If its the latter (i.e. desktop), and you are on windows then Visual Studio is still a good way to go if you want a modern development environment. If you are happier on the command line, then whilst you can do this in Windows I'd recommend Linux which is going to take you down a whole other route. I'd leave this until you find that VS is not doing what you want.

For the microcontroller you will start off in the Arduino IDE which does all the compiling and linking and transferring for you - just follow the tutorial provided by whoever supplies the kit (I have suggested Elegoo).

yungman and sysprog
pbuk
Gold Member
It's not quite accurate to say that you "can't" run C# on a microcontroller, e.g. https://en.wikipedia.org/wiki/Netduino
Well, who knew. Doesn't make sense to me - the key point of using C++ on a microcontroller is that I am always in control of what the hardware is doing without a complier runtime getting in the way with garbage collection etc. If I don't need to worry about my IoT device hanging in GC for a couple of microseconds I may as well use a HLL like CircuitPython or Espruino. I do think the look of the Wilderness Labs kits though - much sexier than Elegoo (but 3x the price).

yungman and sysprog
nsaspook
If you use C++ be sure you are also a good C programmer. Many typical microcontroller task are just a simple
while(true) loop with lots of interrupt driven I/O. You don't really need to use a full OOP abstraction with simple 'bare metal' register level sequential tasks. Less abstraction at the source code level simplifies chip-level hardware (breakpoint style) debugging.

Klystron and sysprog
Well, who knew. Doesn't make sense to me - the key point of using C++ on a microcontroller is that I am always in control of what the hardware is doing without a complier runtime getting in the way with garbage collection etc. If I don't need to worry about my IoT device hanging in GC for a couple of microseconds I may as well use a HLL like CircuitPython or Espruino. I do think the look of the Wilderness Labs kits though - much sexier than Elegoo (but 3x the price).

I understand what you are say, it's not like you cannot use C#. You can make any language do anything, it's the matter of how convenient to use, if you have to go through more trouble to use C#, then it's not a good choice. It's like I am sure the Pascal in my days can do everything today, it's just do you want to use it? Do you have the support to use it, anyone writing subroutine that you can pull in to use it? these are all important to consider for choosing a language.

Ha ha, I am an old fart, I came from days of writing assembly language. I can have full control, it's fast also. I remember we did time slicing so we service everything very fast. Why is it like in my car, the first 15 seconds after starting, I have no control of the center console of the car on radio, sound and everything. Even the sales person during the test drive said you have to be patience with the car.

Some times, seems like laptops are like that too, it's just so slow if there's something running in the background. I swear, it's like every new laptop I buy, it just gets slower and slower with the new programs. ( Of cause I know it's the newer programs that cause the problem. If you run new programs in old computer, it's much worst. That's a given).

Coming from the language side alone think my recommendation would be C++. The language stretches a long history from C programming to newer concepts that keep getting added. And you can mix all of these programming types seamlessly depending on your preferences. C-style C++ is very similar to Pascal, for example. So starting from there and subsequently adding newer features as you like could work well. Many modern c++ programmers would look down on approaching the language from C for good reasons, and I would not recommend it for beginners. But I think it fits for someone who already knows C-style programming. Disclaimer: I don't know much about C#. I always considered it as Java for Windows users. Real Java may be a strong contender to C# (I guess "real Java" it kind of a tell about my opinion on this :). But I believe the more low-levelable c++ is the better fit for you.

I started writing long parts about other relevant features, but I don't think that yet-another random voice on the Internet really adds much. So in brief: I already mentioned why C++ is a good fit as a language. Its main weakness for you may be that other languages' ecosystems have better 3rd party libraries available. Much of modern software development (say, a web application to show the current number of Corona cases in different countries) is essentially gluing together libraries of other people (web interface, plotting), and not so much actual programming. Java and Python are probably the kings of "stick parts together"-programming (and Javascript/Typescript, if you also like having LSD for breakfast), while c++ is rather average in this aspect. And finally: Performance in the context of programming languages it is overrated and mostly irrelevant.