What is the recommended programming language one should learn, when learning electronics?

djsfantasi

Joined Apr 11, 2010
9,163
At least you remembered to free resources! I'd have expected no less from you. But as I'm sure you're aware, many people who call themselves professional programmers would forget to clean up. Then, they come for help because the program crashes and they don't understand why.

I did say "eliminate most Goto statements". This is a clear, well-defined acceptable use.
 

WBahn

Joined Mar 31, 2012
30,058
The only problem to be multi-lingual is that it takes lots of time.
The only problem to be good at anything is that it takes a lot of time.

For example i've heard that it takes lots of years to master C++.
It takes years to master almost any programming language. But you can become productive with most programming languages in a reasonably short amount of time.

I would rather focus on a single language. The one that would be most useful.
While the sentiment is nice, the problem is that if the only tool you know how to use is a hammer, then every problem looks suspiciously like a nail.

As a side note, i also don't understand why so many programming languages do exist.
Why do so many types of vehicles exist? Why don't we have just one type of vehicle for everything? The same vehicle that you take the family on vacation with should be usable to deliver meat to the grocery store, mail to your house, and gasoline to filling stations. We have different vehicles because different tasks require different things from a vehicle and so we make compromises in order to satisfy the critical needs of certain tasks at the expense of accepting less than stellar performance in other areas.

Programming is like that on steroids. The needs of someone developing code for a resource-starved microcontroller with RAM measured in bytes and an 8kHz clock speed that has to perform in real time are very, very, very different than the needs of someone writing a distributed web-based database application for Google or Amazon.

Just like speaking languages, wouldn't it be better to have just one that does the work.
I mean wouldn't it be better if all the people in the world spoke the same language?
Yes and no. For everyday communication it would be quite handy, but for technical communication it would be a disaster. People involved in specialized fields speak very specialized variants of a language. In fact, in some fields it is easier for people that speak different languages to communicate because of the high degree of shared jargon than it is for either of them to communicate (about that stuff) with a lay person that speaks their own language just because the lay person lacks the vocabulary to follow the conversation.

But keep in mind that the communication needs of people has a pretty small variance -- the overwhelming majority of communication between people has very similar requirements and so a single language has the real potential to satisfactorily meet the needs of the overwhelming number of people and overwhelming fraction of the time. That's just not the case with programming.
 

WBahn

Joined Mar 31, 2012
30,058
I'm loving my RPi 2 here. Most of my programming is in C at the kernel level where C is just a high level assembler for the Linux abstract machine.

I would tell a person to have the C language in the tool-box as the first electronics related computer language. It has the structure to do what the books teach you and the freedom to do it the 'quick' way when needed.
Most of the books say don't use 'goto', it's bad style. (something that BASIC makes too easy) That's great if you have lots of cycles to kill but in an embedded systems you usually don't, so properly using explicit jumps in structure just to terminate execution is sometimes the 'best' answer.
I tell students that there are certain rules that will aid in developing good code -- or at least make it less likely that you'll write really bad code. One of those is to never, ever use a goto statement unless you've got a damn good reason -- and I immediately point out that damn good reasons DO exist. The example I usually through out is resource-starved, real-time applications usually involving embedded applications or system-level programming.

The problem with goto statements (or whatever "bad" habit you like, such as using a gated clock or asynchronous logic) isn't the technique itself, it is that the technique is most commonly used by people who lack the skill or motivation to "do it the right way", i.e., using the "proper" technique. and are just trying to "make it work". The result is that they use these "quick and simple" techniques without the skill or motivation to do it the right way.
 
Top