Trying to decide which programming language I want to learn

AI Thread Summary
Choosing a programming language to learn can be challenging, especially for someone with a background in older languages like assembly, Fortran, and Pascal. C# and C++ are considered for firmware design, while Python is favored for its ease of use and relevance to gaming, particularly with grandchildren. C++ is noted for its speed and compactness, making it suitable for game programming, but it may require more effort to learn compared to C#. Resources like Visual Studio for C# and various online tutorials can help beginners get started, while microcontroller programming can be explored through platforms like Arduino and Raspberry Pi. Ultimately, the choice should align with personal interests in scientific or gaming applications.
yungman
Messages
5,741
Reaction score
294
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
 
Technology news on Phys.org
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.

yungman said:
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
 
  • Like
Likes Master1022, cobalt124, Dale and 4 others
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:
  • Like
Likes 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?!
 
  • Like
Likes Klystron and DifferentialGalois
yungman said:
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.
 
  • Like
Likes bhobba
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:
  • Like
Likes 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/1975745086/?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
 
yungman said:
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/1975745086/?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
 
  • Like
Likes yungman
  • #10
sysprog said:
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.
 
  • Like
Likes Klystron
  • #11
PeterDonis said:
The numpy and scipy libraries
You just make that up. :biggrin:
It's funny, and sort of describes it too, IMO.
 
  • Haha
Likes DifferentialGalois
  • #12
256bits said:
You just make that up. :biggrin:
It's funny, and sort of describes it too, IMO.
That is what they are called. Numpy SciPy
 
  • Like
Likes DifferentialGalois, Janosh89 and 256bits
  • #13
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.
 
  • #14
yungman said:
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/dp/067232461X/?tag=pfamazon01-20
 
  • Like
Likes sysprog
  • #15
FactChecker said:
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.
 
  • Haha
Likes FactChecker
  • #16
sysprog said:
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.
 
  • #17
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)
 
  • #18
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.
 
  • Like
  • Informative
Likes Klystron, bhobba, yungman and 1 other person
  • #19
pbuk said:
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
 
  • #20
If you want optimal efficiency ##-## https://docs.microsoft.com/en-us/cpp/assembler/masm/masm-for-x64-ml64-exe?view=vs-2019
yungman said:
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/
 
  • Like
Likes yungman and pbuk
  • #21
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).
 
  • Like
Likes yungman and sysprog
  • #22
sysprog said:
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).
 
  • Like
Likes yungman and sysprog
  • #23
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.
 
  • Like
Likes Klystron and sysprog
  • #24
pbuk said:
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).
Thanks for your link.

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 into 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).
 
  • #25
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.
 
  • #26
nsaspook said:
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.
I have not been doing any programming for almost 40 years. The last language I learned was Pascal. It wasn't hard, took me like 2 weeks to learn and play with it. I don't know C at all, I can't comment, Is C much harder to learn?

Seems to me, in computer language, you learn one, learning the second one is very easy. The hardest is to learn how computer "think". I learn fortran first in college, the second language is assemble, I found it very easy already because of the Fortran. Then Basic is just common sense. Then Pascal is just straighter and needs to be more specific in defining everything. Other than than, it's mainly learning the syntax.

Later on, I did some FPGA AHDL programming, again, the idea is still the same, it's more difficult in the sense that there can be multiply signal running at one time instead of software going one line at a time. You need to worry about timing, race condition that software don't have to worry. That's where a lot of software engineer run into problem trying to program FPGA, they think it's all the same and run into timing problem and race condition that make the system unreliable.

Please let me know if I miss something in learning C++ that I need to watch out and learn.
 
  • #27
C# has a lot of goals that are related to running on web sites. If that is not of interest to you, it may not be a language that you should learn first. C++ can always be written a lot like C. You can have good control of what it is doing when you want that. If you want to have a lot of control over what is happening and want a lot of free programming tools, you might consider using a Linux-based operating system on your work computer instead of a Microsoft Windows system.
 
  • Like
Likes bhobba and sysprog
  • #28
FactChecker said:
C# has a lot of goals that are related to running on web sites. If that is not of interest to you, it may not be a language that you should learn first. C++ can always be written a lot like C. You can have good control of what it is doing when you want that. If you want to have a lot of control over what is happening and want a lot of free programming tools, you might consider using a Linux-based operating system on your work computer instead of a Microsoft Windows system.
Honestly, I don't know what I want, I am just guessing. Got to start somewhere and learn the first modern language first. I am sure after the initial learning, learning another one later should not be that hard. I'll worry about it later. Like I said, this is my crossword puzzle, not as if I am going back to work and need something that fit the best. Time I have.

Thanks
 
  • #29
yungman said:
I have not been doing any programming for almost 40 years. The last language I learned was Pascal. It wasn't hard, took me like 2 weeks to learn and play with it. I don't know C at all, I can't comment, Is C much harder to learn?

Seems to me, in computer language, you learn one, learning the second one is very easy. The hardest is to learn how computer "think". I learn fortran first in college, the second language is assemble, I found it very easy already because of the Fortran. Then Basic is just common sense. Then Pascal is just straighter and needs to be more specific in defining everything. Other than than, it's mainly learning the syntax.

Later on, I did some FPGA AHDL programming, again, the idea is still the same, it's more difficult in the sense that there can be multiply signal running at one time instead of software going one line at a time. You need to worry about timing, race condition that software don't have to worry. That's where a lot of software engineer run into problem trying to program FPGA, they think it's all the same and run into timing problem and race condition that make the system unreliable.

Please let me know if I miss something in learning C++ that I need to watch out and learn.

Your FPGA example makes an important point. Most programming languages are designed by and used by programmers solving algorithmic problems on hardware. A large part of embedded/hardware software engineering is solving hardware state problems in software (firmware) so the mindset needed to be good at that level is usually filled with hardware engineers taught to directly program low-level hardware as a requirement for building hardware systems. C was designed for this sort of task while the types of problems C++ solves doesn't really help at the hardware bootstrap stage.
 
  • Like
Likes sysprog
  • #30
  • #31
pbuk said:
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.
Although C# isn't suitable for writing microcontroller code, you can mix C# and C++ together in the same program.

@yungman, if the last language you learned was Pascal, you'll have a bit of a learning curve with C or C++. Since C is more-or-less a subset of C++, you'll probably have an easier time learning C than C++.
 
  • Like
Likes FactChecker
  • #32
Mark44 said:
Although C# isn't suitable for writing microcontroller code, you can mix C# and C++ together in the same program.

@yungman, if the last language you learned was Pascal, you'll have a bit of a learning curve with C or C++. Since C is more-or-less a subset of C++, you'll probably have an easier time learning C than C++.
Thanks, this is the first time I use Visual Studio, that's a learning curve already. I have no interest in Visual Studio, I am going to see how little I have to learn to do C++.
 
  • #33
Since everyone else has gone through all the boring stuff:

You mentioned pascal - you may want to check out Lazarus -I like it for windoze general programming. (its a RAD IDE system based on FPC) You can do impressive things very quickly with it.

and the opposite for smallest and fastest...

To excercise your brain in a microcontroler way (I'm suprised you didnt mention it) : read
https://www.forth.com/starting-forth/
the PDF download seems to be free now. There are many "free" Forths and a couple of commercials ones.
(which may have free variants)

PS I don't think you can really say there are any "new" languages - they mostly seem
to be the same just with different syntaxes to make them appear different. There are probably
no more than about four different types of languages I'd guess but Forth is about as different to those
you mention as you will probably get.
 
  • #34
jack2020 said:
Since everyone else has gone through all the boring stuff:

You mentioned pascal - you may want to check out Lazarus -I like it for windoze general programming. (its a RAD IDE system based on FPC) You can do impressive things very quickly with it.

and the opposite for smallest and fastest...

To excercise your brain in a microcontroler way (I'm suprised you didnt mention it) : read
https://www.forth.com/starting-forth/
the PDF download seems to be free now. There are many "free" Forths and a couple of commercials ones.
(which may have free variants)

PS I don't think you can really say there are any "new" languages - they mostly seem
to be the same just with different syntaxes to make them appear different. There are probably
no more than about four different types of languages I'd guess but Forth is about as different to those
you mention as you will probably get.
I don't dare to say anything about the new language as I have been out of the loop for so long. But yes, that's how I felt when I learned even Assembly, Pascal after I learn Fortran. They are pretty much the same, they work the same way. Didn't take much time to learn the new language even Assembly. It's learning the way computer think...that it is dumb, no common sense, you have to specify everything...BUT, it has infinite patience to repeat the process over and over and over...! Hope I can pick up C++ reasonable fast, I am sure my brain is nothing like when I was in my 20s. Those days, I could pick up new things just like that. Now is like going in one side and leak out from the other side.

I don't get what you mean by "exercise brain in a microcontroler way. You mean designing the hardware? That's very easy, I designed enough CPU boards and microcontroler boards already.
 
  • #35
One of the main selling points of C# is the built in support for GUI development on Windows and other systems stuff. Another selling point is that the popular game development engine (unity) is done using C#. That and compared to C++, it is a little higher level, like it manages memory for you in the background, whereas in C++ you have flexibility to use manual memory management, although modern C++ supports some level of automatic memory management. You need to install the .NET framework, and maybe need specific versions of the .NET framework to be installed along with your program. I never actually used C# before, because I don't care about automatic memory management and don't like the proprietary nature of it, and need to have .NET. There is a thing called Mono, which is an open source cross platform version though.

People complain that C++ is too large and complex, and takes a ton of time to learn the whole thing. There are many details you need to worry about and opportunities to make mistakes. You can do cross platform GUI development pretty easily in C++ using QT. And you can get away with never touching windows API's (which I never, ever want to do) if you use third party libraries. I generally only use cross platform libraries and mainly use linux. You can use glwf to just make windows and do graphics rendering directly, or use a library like SDL. Or you can use the state of the art game engine like Unreal engine. That all said, C++ will require a lot of learning the complexities of the language. It might be a little bit of a drag if you want to do it for fun.

For making games on a Mac, there might be some special considerations, because they keep getting rid of support for stuff and forcing people to use their proprietary API's for certain things.

I agree Python is a good choice, because of the wide array of packages available for things like mathematics, statistics, science, and machine learning. The syntax and overall language is simple and easy to use. It is a really convenient language compared to C++ or C#. It's become one of the preferred language for mathematics researchers, scientists, data scientists, etc. It's slow in the sense that the code you write in Python will not be as fast, but functions can be coded in C or C++ and cuda, and then be used in Python to get all the performance bennefits of the faster compiled language and parallelism. And a lot of the libraries you use have already done that.

Actually, I would suggest considering javascript and then you can use three.js to do graphics/games. The reason is that three.js makes it really easy to do GPU accelerated 3D graphics compared to others, and you can even do VR this way.
https://threejs.org/

You can always learn multiple languages.

For fun, and mental stimulation, a functional language could be worthwhile. They force you to think in a different and pretty neat way.
 
Last edited:
  • Like
Likes atyy and yungman
  • #36
I can see there is a big learning curve already, I have no idea what are QT, glwf , SDL, Unreal engine etal.! I just google these terms, they are about open platform and cross-platform software. What is this? Is it like someone write a big library of subroutine to do things that you can use? For example, someone wrote a subroutine to read from keyboard and another routine to display on the screen. So you just call the subroutine to read keyboard, then do something, and call the subroutine to display on the screen?

I am still trying to learn a little bit more what is Visual Studio. I am an analog, RF and hardware guy. I can only think as far as designing micro controller pcb and program some simple stuff at this point. For this, I don't think I have to call a lot of subroutine from those cross platform stuffs.

Tell me am I right, I am trying to learn the new lingo!
 
  • #37
yungman said:
I am still trying to learn a little bit more what is Visual Studio. I am an analog, RF and hardware guy.
Visual Studio is, IMO, pretty straightforward. Basically it is a development environment with an editor, debugger, and some other tools all combined. With it, you can write code in C, C++, C#, x86 assembly, as well as some other languages.

With your background experience in assembly and Fortran and Pascal, it shouldn't be too hard for you to get started with C++ or C# or C. You might do a web search for tutorials in whichever language you decide to use. Or you mentioned a book you have -- that's a good place to start as well.
yungman said:
I am an analog, RF and hardware guy. I can only think as far as designing micro controller pcb and program some simple stuff at this point. For this, I don't think I have to call a lot of subroutine from those cross platform stuffs.
Cross-platform programming is where you write code in a particular environment that is intended to run on a different architecture and/or operating system. If you're just starting out, I wouldn't advise trying to do anything like that.

I would advise learning about writing functions, though, as monolithic programs are a lot harder to debug. Both C++ and C# extend the C struct concept (called a record in Pascal) to the class concept, a data structure that can contain data members (properties) and function members (methods).
 
  • #38
I am surprised nobody has mentioned it, but Cython seems well suited to what you want. You can even write straight C in Cython if you want. As an old time programmer whose first languages learned were Fortran and Pascal, but spending 20 years of my programming life writing in a language called Natural, when going back to do a bit of programming Python was a breeze. Cython converts your Python to C, which is why you can write your Cython code as C code if you want, but except for speed in critical parts why bother. Personally I do not do that, I use NUKITA (another Python to C compiler, but does not allow inline C) and Luajit - but it's not as compatible with C (it requires the Luajit interpreter) - although interestingly is nearly as fast as C thanks to the highly optimised just in time compiler built into the Luajit interpreter.

See:
https://honnibal.wordpress.com/2014/10/21/writing-c-in-cython/

Thanks
Bill
 
  • #39
yungman said:
I can see there is a big learning curve already, I have no idea what are QT, glwf , SDL, Unreal engine etal.! I just google these terms, they are about open platform and cross-platform software. What is this? Is it like someone write a big library of subroutine to do things that you can use? For example, someone wrote a subroutine to read from keyboard and another routine to display on the screen. So you just call the subroutine to read keyboard, then do something, and call the subroutine to display on the screen?

I am still trying to learn a little bit more what is Visual Studio. I am an analog, RF and hardware guy. I can only think as far as designing micro controller pcb and program some simple stuff at this point. For this, I don't think I have to call a lot of subroutine from those cross platform stuffs.

Tell me am I right, I am trying to learn the new lingo!

You're right.

Code that depends on the operating system tend to be a pain, and need to be maintained to keep working with new OS versions. Regular C++ code is cross platform (meaning it will compile and work on a mac, or windows, or linux, or whatever) but GUI stuff (graphical windows, mouse input etc.) requires low level system dependent stuff. To make your life easier, you can just use a library (just some code developed by others and packaged to be reused), that does that complex and tedious stuff and automatically does it correctly for whatever system you're on.

QT, glfw, SDL, etc. are just examples of some code that some companies or people have written to do some of those types of things. You don't need to know those things unless you want to use them and there are a bunch of choices. So I would just forget about it for now. If you decide one day you want to make a video game with graphics, just start googling to see what is available to make your life easier, or ask for advice on a forum.

To start with, you'll probably just be making console programs and won't require anything extra.

Hallo
I am really having a hard time navigate the Visual Studio. I have been going through the example of "Hallow World" and run Ctrl F5 to look at in command mode and all. I even copy the syntax and all another line "How are you" and display in the command mode. I saved in the desktop folder. I closed the program, I tried to open it and I can't even open it back. I went through the help tab, it is absolutely of no help.

I went on Youtube, there is only one or two on C++ for Visual Studio 2019. They have for older version, but it's not the same. I am going around and around.

All I need is to have explanation how to open an existing file and edit and save and I can't even do that so far.

Any book or site you can suggest? There is only two books for 2019 I can find on Amazon, both are rated very low, I don't want to waste money buying them.

Please Help.

Thanks

I feel for you. I started with Visual Studio as well and hated it. It's like having a control room to run a city when you just want to turn the lights off and on in your house.

Maybe you could just try the command line. Get some text editor like sublime text or notepad++. Then just compile your file directly. Once you want to do a large project, or use a debugger, or profiler, then consider using an IDE?

https://www.sublimetext.com/
https://notepad-plus-plus.org/

You can try from the command line.
$ cl /EHsc yourfile.cpp

Or follow these instructions.
https://docs.microsoft.com/en-us/cp...-cpp-program-on-the-command-line?view=vs-2019

You can also use an online tool just to try running a simple program https://ideone.com/ (you can select from a bunch of languages here as well).

Otherwise, if you want to use Visual Studio as an IDE, have you tried creating a new project? I think it will create a directory for you somewhere and manage all your files for you and everything. I haven't used it in years, so I can't give specific advice.
 
Last edited:
  • Like
Likes yungman
  • #40
Jarvis323 said:
You're right.

Code that depends on the operating system tend to be a pain, and need to be maintained to keep working with new OS versions. Regular C++ code is cross platform (meaning it will compile and work on a mac, or windows, or linux, or whatever) but GUI stuff (graphical windows, mouse input etc.) requires low level system dependent stuff. To make your life easier, you can just use a library (just some code developed by others and packaged to be reused), that does that complex and tedious stuff and automatically does it correctly for whatever system you're on.

QT, glfw, SDL, etc. are just examples of some code that some companies or people have written to do some of those types of things. You don't need to know those things unless you want to use them and there are a bunch of choices. So I would just forget about it for now. If you decide one day you want to make a video game with graphics, just start googling to see what is available to make your life easier, or ask for advice on a forum.

To start with, you'll probably just be making console programs and won't require anything extra.
I feel for you. I started with Visual Studio as well and hated it. It's like having a control room to run a city when you just want to turn the lights off and on in your house.

Maybe you could just try the command line. Get some text editor like sublime text or notepad++. Then just compile your file directly. Once you want to do a large project, or use a debugger, or profiler, then consider using an IDE?

https://www.sublimetext.com/
https://notepad-plus-plus.org/

You can try from the command line.
$ cl /EHsc yourfile.cpp

Or follow these instructions.
https://docs.microsoft.com/en-us/cp...-cpp-program-on-the-command-line?view=vs-2019

You can also use an online tool just to try running a simple program https://ideone.com/ (you can select from a bunch of languages here as well).

Otherwise, if you want to use Visual Studio as an IDE, have you tried creating a new project? I think it will create a directory for you somewhere and manage all your files for you and everything. I haven't used it in years, so I can't give specific advice.
Thanks for clarifying this.

About Visual Studio, it's not about taking time to learn a lot of things, it's their documentation is not right. I read their "Hallo World", it is all over the place. I even type in exactly the added line according to the picture showed and did Ctrl F5. It said 3 errors. I check and I check, I typed it in correctly. There is no explanation on anything, and when the example is totally wrong, it make it very hard to learn.

I decided to go with Visual Studio because it also support C# and Python and other languages. This means even if it is painful to learn, I don't have to learn the second time when I learn another language ( If I want to learn another language!).

Any suggestion on links or books that explain Visual Studio 2019? Seems like it's so new that not many people publish stuffs. I saw a pretty good youtube on 2015, but the it is quite different and I stop watching after about 15 minutes as I cannot follow what he was doing in 2019. The two youtube on 2019 was not good, not only the content are no good, it really doesn't help if both people are foreigners with heavy accent. I am a foreigner, last thing I need is to try to understand someone speaking with heavy accent! No offense!

Thanks
 
  • #41
Books are not very popular in the context of programming, anymore. I think for Visual Studio you can just Google for particular questions. For example, your 3 errors with no explanation sounds like you are looking at the last line of the build report. Visual Studio has an explicit error tab where you get a list of all errors and warnings and can also click on them to jump to the offending code location. Trying to find a picture of it for you I googled "visual studio errors" and quickly came here: https://docs.microsoft.com/en-us/visualstudio/ide/find-and-fix-code-errors?view=vs-2019 .
 
  • #42
yungman said:
I am really having a hard time navigate the Visual Studio. I have been going through the example of "Hallow World" and run Ctrl F5 to look at in command mode and all. I even copy the syntax and all another line "How are you" and display in the command mode. I saved in the desktop folder. I closed the program, I tried to open it and I can't even open it back. I went through the help tab, it is absolutely of no help.
The Help link is very useful, but you have to know what to look for.
CTRL F5 opens a command prompt window and starts the program.
You can't type your program into the command prompt window -- that's just where the output from your program goes.
When you open Visual Studio, your first step is to create a new project. I usually create either a Console App or an Empty Project. There's a default name (Project1 for the first one you create), but I prefer to enter a more explanatory name. After you click OK, the top line in theSolution Explorer pane will have "Solution 'Project1'" or whatever name you've chosen for your project. Immediately below it will show the name of your project in bold. Under that there are several folder icons, among which are Header Files and Source Files. The only one that you need to use at your stage is Source Files.
Right-click the Source Files icon, and Add a New Item. This is where you create your C++ (or C) source file. The default name is Source.cpp, but you should give it a more descriptive name.
After you do this, type in or copy-paste in the source code for your program. Once you've done that, select Build from the menu, and click Build Solution. If your program builds (compiles and links) with no errors, you can then run it by pressing F5 (run in debugger) of CTRL F5 (run in command prompt window).
yungman said:
I went on Youtube, there is only one or two on C++ for Visual Studio 2019. They have for older version, but it's not the same. I am going around and around.
Don't search for examples in Visual Studio 2019. Just search for more general C++ tutorials. For what you're doing, I doubt that there's all that much difference between examples in VS 2019 or those in older versions.
yungman said:
All I need is to have explanation how to open an existing file and edit and save and I can't even do that so far.
After you have created your project and the source code file, look in the Solution Explorer pane, and select the top item there. In the properties for the solution, it will show the directory path where everything is saved. Inside that directory, there's a file named <project name>.sln. If you double-click that file, it will open Visual Studio, showing the file that you typed in.
 
  • Like
Likes yungman
  • #43
Thanks for the new information.

I have been playing around and I am going somewhere ( a little bit). This is like chicken and egg, if I spend time reading the C++ book without actually typing into VS, it's hard to sink in. But if I play with VS to get a feel of the program and how to edit it, then I don't know what the hell am I typing!

I just follow "Halloworld!" and experiment with some of the information here. I found a few interesting things I don't quite understand. This is the program I modified ( just by copying the line by guessing)

#include <iostream>

int main()
{
std::cout << "Hello World!";
std::cout <<" How are you!" << std::endl;
return 0;
}

I managed to run and display "Hallo World! How are you!" and in cmd mode ask me to press any key to go back. My error last night was "endl" I typed end1 as the picture from the VS help file is end1. I read it, even with magnifying glasses!

My question is

1) There is a #include <iostream>. This is obviously a group of subroutine to perform the display. My program is NOT stored in repos, I saved in my own folder on the desktop. How can VS know where to get the <iostream>?

2) Is VS a compiler or interpreter(like Basic)?

3) I made sure the repos folder is empty. Then I create a new file in "Console App" in C++. I put the project name "Holloworld" in repos, then I UNCHECKED "place solution and project in the same directory.", The whole Halloworld.cpp displayed without me typing anything. I did say creating new file, why the whole .cpp comes out as if it is already written?

4) Why is it if I CHECK "place solution and project in the same directory.", nothing comes out?

Sorry to ask stupid question like these, as I said, it's chicken and egg, I guess I choose eggs, blind playing with the VS to get a feel how to input .cpp, create .cpp and all first before reading the C++ book to learn the command. I don't think I can learn if I read the book without actually typing it in and try.

thanks
 
  • #44
It seems that you are making some progress.
yungman said:
1) There is a #include <iostream>. This is obviously a group of subroutine to perform the display. My program is NOT stored in repos, I saved in my own folder on the desktop. How can VS know where to get the <iostream>?
When you installed Visual Studio, it "knows" where the header files are. The usual place is in C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\include. Your installation might have Microsoft Visual Studio 15.0. I'm running VS 2017, which is one version older.

The header files don't contain the subroutines for the most part -- just the declarations or prototypes for the functions and types that you use. When you build a program, the linker adds in the code for whatever functions you're using.
yungman said:
2) Is VS a compiler or interpreter(like Basic)?
VS is an integrated development environment (IDE). It contains a compiler (called VC) and a linker and some other tools.
yungman said:
3) I made sure the repos folder is empty. Then I create a new file in "Console App" in C++. I put the project name "Holloworld" in repos, then I UNCHECKED "place solution and project in the same directory.", The whole Halloworld.cpp displayed without me typing anything. I did say creating new file, why the whole .cpp comes out as if it is already written?
It depends on what sort of application you have chosen. I usually select Empty Project, so it doesn't create a source file for me. If you choose Console Application, VS will prepopulate a source code file for you to help you get started.
Here's what I get:
C:
// ConsoleApplication1.cpp : This file contains the 'main' function. Program execution begins and ends there.
//
#include <iostream>
int main()
{
    std::cout << "Hello World!\n";
}
I didn't copy the whole thing -- there is a block of comments with tips on getting started. VS 2019 might be slightly different.
yungman said:
4) Why is it if I CHECK "place solution and project in the same directory.", nothing comes out?
I don't know what you mean "nothing comes out."
When I created the application I showed above, VS created a direction in my repos folder. Here's the file hierarchy.
Code:
repos
...ConsoleApplication1
...ConsoleApplication1.cpp  <--- this is your source code file
... plus 3 other files that VS uses
...ConsoleApplication1.sln
When you build your program, VS will create a bunch of other files.
 
  • Like
Likes yungman
  • #45
Thanks Mark44
I just want to acknowledge you first. It will take me some time to digest these.
 
  • #46
I have been looking for the location of the subroutines. I found it. It's different from yours. I think it's because mine is 2019. That's the reason there is a good youtube on VS2017, but I couldn't follow as it looked very different.
Include file for VS.jpg


Now I know I can click the "External dependency" to view what subroutine it has and can click each to see the code inside to understand more ( not that I understand any line at this point, but it's a start).

My question is whether I can redirect the program to look for subroutine somewhere else where I can write my own subroutines? Or do I have to add my subroutines into the location where VS store the rest of the files? That won't be very convenient.

I still have to try create and dummy .cpp file using Empty Project command so I know how to start my own .cpp. I think I am going somewhere, I am stoked.

I decided to go with VS even though it's hard to learn, but it support C#, Python etc. I hope if I ever learn another program, this extra effort learning how to navigate VS will pay off.

Thanks
 
  • #47
yungman said:
My question is whether I can redirect the program to look for subroutine somewhere else where I can write my own subroutines? Or do I have to add my subroutines into the location where VS store the rest of the files? That won't be very convenient.
Actually, the header files don't contain the subroutines (which BTW isn't terminology that is used in C, C++, C#, etc.). Most of what's in the header files, such as iostream, are the declarations or prototypes of the functions that you use. These declarations provide information about a function: how many parameters, the parameter types, and the return type. The actual code is in the lib directory -- the linker inserts the code for the functions you use.

And yes, you can write your own header files. I was working today on a program I wrote about a year ago, adding more functionality to it. The application consists of two projects -- one written in C++ and the other in C#. There is also a header file. The entry point (a Main function) is in the C# file. The C++ portion gets compiled to a DLL (dynamic link library). The C# code uses (calls) the functions in the DLL and does I/O. In C# parlance, this is called interop (short for interoperability).

The compiler generates an object file -- machine code for the code your write, but nothing else. The linker adds the code for library functions, to make the complete application.
yungman said:
I still have to try create and dummy .cpp file using Empty Project command so I know how to start my own .cpp. I think I am going somewhere, I am stoked.
Good. With an empty project, I think it's easier to not get confused by a bunch of extra stuff.
 
  • Like
Likes yungman
  • #48
So those are not called subroutines, they called declarations or prototypes of the functions now a days?

The Include folder, in the C drive is called "Header files"?

I am trying to learn the new names which is very important to understand what I am reading. I find Google is very good at that. I read about Solutions, Build solution, Clean Solution. These are all new to me. That Solution and just Compiling the program and Link the Prototype function in the Header files to produce the final executable file( I don't know the name yet). is it .exe?

Can you tell me what other important terms I need to look up?
 
  • #49
I just looked at the VS help documentation, I realize what I missed. In the explanation like Build and Run C++, the screen pictures are actually moving showing where to point and open files and run the build.

I have neck problem and it's not comfortable reading on the laptop, so I copy onto word file and print them out to read. Obviously the pictures are NOT moving anymore and I miss the whole picture instructions! No wonder there's a big disconnect from reading on paper to the real operation.

Now I know, it becomes a lot clearer. Wow, I wasted so much time on this! Luckily I was told here the documentation is very good, so I give it another chance.
 
  • #50
C++ is an old language but still one of the most important (the other one is Java, a much slower and buggy and annoying language), and it's very fast.

The new alternative to C++ is Rust.

And would also suggest Julia, the future for scientific programming. It's a very fast and capable scientific language which is going to supersede R+Python+Fortran.
 
Back
Top