Why does Arduino try to deny it's origins?

I have been programming professionally for a 'long' time and have written a non-trivial Arduino sketch. I have written code on projects that are highly complex. I keep coming back to the same thing.

Why does Arduino try so hard to avoid mentioning it uses 'C' and C++ as the language you write in? I have had colleagues assure me that Arduino doesn't use 'C' and has it's own language. I know this is untrue and have asked them what is different about the syntax of an Arduino program and an equivalent 'C' program.

The ways I see this are many.

It seems like the tutorials go through the explanation of how to program without saying "This is 'C'" ? It would be ever so much simpler and there are much better and more complete tutorials on the web.

Why does Arduino want code projects to be referred to as sketches? What's magical about a sketch that is unique and not already found in a VisualStudio solution, or a makefile, or an Xcode project? What makes a Sketch so magical that it can't be called a project like every other 'C' code effort? The Arduino environment is just another IDE, nothing more or less.

Why does Arduino deprecate and hide the use of main(), and instead create the setup() and loop() functions? This is easily something any programmer can create, why is it necessary to create these new functions and suggest they are somehow really important and that is the only way to create Arduino software? I'm not saying setup() and loop() are not a good way to structure some programs, but they are not the only way?

It also seems to me that Arduino tends to hide the #include header file needed for all external libraries. It can be really hard to find with some libraries. Why isn't the list of appropriate header files not a standard item for every library description.

These are really philosophy questions more than any practical limitation. It just seems like the Arduino approach is to rename common things and describe them like they are something new or special. I would think this just leads to confusion when crossing between Arduino and the rest of the universe. I'm not saying it's wrong, but it is very confusing coming from my background of writing embedded software for many years. Why does Arduino see value in doing this?

I don't represent Arduino but I always took it to be because they want to simplify things for beginners, so they hid and automated as much as possible so as to leave just the actual code writing for people to do. I consider myself a reasonably good hobby programmer in C (not C++). I use MPLABX for PIC and the Arduino IDE for Arduino stuff. The two are, as I am sure you know, miles apart in terms of functionality but also intimidation value for beginners. Remember that you and I are not the primary target audience for Arduino, so are looking at this from the wrong end.

I found calling them sketches a bit off putting until I realised it was just their term for their product. I guess it's another way to make things easier for beginners.

mcmahad:
Why does Arduino try so hard to avoid mentioning it uses 'C' and C++ as the language you write in?

Here's the explanation I received:

mcmahad:
Why does Arduino want code projects to be referred to as sketches?

This term was inherited from the Wiring project Arduino is a fork of, which in turn inherited it from the Processing project Wiring was based on.

My impression was that the original idea behind Wiring was to provide the equivalent of Processing for embedded systems. The terminology, IDE UI, and API all mirrored the conventions established by Processing, making the same concepts apply to both programming PCs and microcontrollers. In the present day, I don't think the Processing cross-over capabilities are really so important, but things may have been different, or at least appeared different back in 2005 and now the conventions have been well established.

In the end, does it really matter what the word is as long as we know what it means? I know that I have much better things to do with my life than get upset over something like that. As they say: "A rose by any other name...".

mcmahad:
What's magical about a sketch

You can learn about it here:
https://arduino.github.io/arduino-cli/latest/sketch-build-process/#pre-processing

mcmahad:
The Arduino environment is just another IDE, nothing more or less.

I disagree. The Arduino IDE is more because it is less than other IDEs. The design is based around providing a gentle learning curve. That is meaningless to you, but so incredibly important in achieving Arduino's primary goal of making embedded systems accessible to everyone.

mcmahad:
Why does Arduino deprecate and hide the use of main(), and instead create the setup() and loop() functions? This is easily something any programmer can create

Easy for you, but for someone who has never written a single line of code, it results in a steeper learning curve. Arduino is all about that gentle learning curve.

But Arduino is also based on professional quality technology. If you don't like the setup() and loop() paradigm, you are not obligated to use them. Feel free to define your own main().

mcmahad:
It also seems to me that Arduino tends to hide the #include header file needed for all external libraries. It can be really hard to find with some libraries. Why isn't the list of appropriate header files not a standard item for every library description.

I haven't noticed any official Arduino library reference that doesn't provide this information. Maybe you're thinking of 3rd party libraries?

a cpp file is C++ a C files is C, S file is assembly and ino file is Arduino. C++ compiler can't compile ino

sketch is a folder with source files to be build with Arduino builder. there is no makefile, arduino builder rules apply

esp8266 and esp32 SDK hide the main() too. reasons are the same. the framework needs to do its tasks.

I don't understand the part about hidden header files.

and to add to Processing origin of Arduino mentioned by Per: Processing is DSL based on Java (as Arduino is DSL based on C++). That is why Arduino language uses Java code styling and some API parts are unusual for C++

When you think about it, in an embedded environment (without an OS to return to), you'd end up implementing the same functionality as setup() and loop() anyway. So, why get bent about having it done for you?

I think the often overlooked (or perhaps misunderstood) advantage of the Arduino core, and yet obvious too, is the processor portability. There's lots of targeted development systems, and I use a few also, but the portability also extends to a greater ability to share code across different platforms.

Why does Arduino try to deny it's origins?

It's just about "make things for beginners as easy as possible". Most of their ideas are well done and sometimes it is a "bit over the top".

And when they insist of having something called "Arduino Language" and not C++, it's just one of these examples. Ok - it's their product - so they can call it what they think that sells best.

Or lot of definitions, which would exists anyway in other form (what the hack makes a define B00001111 easier than 0b00001111 ?) ... the list could go on.

It's like when I enter a restaurant and I see mushrooms on the menu: I don't need to eat them if I don't like them.

I have been programming professionally for a 'long' time

I assume you are not the primary target group of the Arduino guys.

noiasca:
what the hack makes a define B00001111 easier than 0b00001111 ?)

At the time the binary.h macros were defined, GCC didn't have support for binary literals, so that wasn't even an option.

Now that support for binary literals is well-established in the Arduino world, work is in progress to transition to using them exclusively (while still retaining the legacy macros for backwards compatibility):

I can accept "for historical reasons", but as we have nearly 2021 the cleanup should be done everywhere. examples, references, homepage ...

I agree completely. I have been maintaining a list of the instances of the usage of the deprecated macros here:

and added your link to it. If you find any others, please let me know and I'll add it to the list.

Unfortunately, the contents of that "PortManipulation" page are not hosted in a repository where we can propose the change from the use of the deprecated macros (actually they are being transitioned to enums). If you like, you can submit your suggestion to make this change via the Arduino support contact form, which is the best way to bring it to the attention of the people who do have the access to edit this content:
https://www.arduino.cc/en/contact-us/

mcmahad:
I have been programming professionally for a 'long' time

I suspect that is the problem.

When you have been programming for a long time it is difficult (or impossible) to see through the eyes of a newbie. Even more so through the eyes of a newbie who just wants his project to work and has no real interest in programming.

...R

these may help

Explainer: what is Arduino?

the Untold history of Arduino

188

pert:
Here's the explanation I received:
Suggested improvements to the home page text · Issue #476 · arduino/reference-en · GitHub
This term was inherited from the Wiring project Arduino is a fork of, which in turn inherited it from the Processing project Wiring was based on.

I figured it was something like that. IMO, this is a noble goal that is usually unmatched by the facts on the ground. Kind of the same reason for creating the LOGO programming language and using the turtle metaphor.

I seem to recall various similar attempts at such things through the years. Most of them didn't survive the test of time, much like the Processing project seems to have run out of steam. In the end, they failed because they had a concept that didn't provide sufficient usable value. Does Processing still have a support base other than the author?

From one of the links you provided, I found this post:

That post said the differences in the arduino language are:

  • Functions do not need forward declarations, because these are autogenerated by the IDE.
  • Arduino.h is automatically included.
  • .ino files are concatenated before compilation.
  • Libraries to be used are automatically detected based in #include directives.

These things do not change the syntax and create a new language. I agree they are useful tasks for beginners.

In the end, does it really matter what the word is as long as we know what it means? I know that I have much better things to do with my life than get upset over something like that. As they say: "A rose by any other name...".

Thanks for the links, they were useful to help me understand, which was my original request.

I disagree. The Arduino IDE is more because it is less than other IDEs.

We will have to agree to disagree here. The arduino IDE has all the basic parts : editor, compiler/linker, interface to hardware, etc. That's pretty much what VisualStudio and other IDEs have. VS has a source debugger with breakpoints, which Arduino seems to lack and would be nice. I understand the technical difficulties in implementing a debugger or simulator, but I wouldn't say that lack of a debugger (i.e.- less than) makes Arduino more desirable. It's the one big feature that would really make the IDE noticeably more useful in developing projects.

The design is based around providing a gentle learning curve. That is meaningless to you, but so incredibly important in achieving Arduino's primary goal of making embedded systems accessible to everyone.
Easy for you, but for someone who has never written a single line of code, it results in a steeper learning curve. Arduino is all about that gentle learning curve.

I think you presume too much of me.

The gentle learning curve is nice, but much too short to be a useful curve. This is my big complaint with the approach. It doesn't offer enough lasting value. I understand the goal of 'putting lipstick on a pig' but there isn't enough lipstick to do this. The language is C++ and trying to hide that doesn't work well once you get past the novice stage. Most of the questions and problems I see in the forums are based on difficulties with the C++ language syntax, not the Arduino specific material.

My other big concern with the "Arduino programming language" is that it really isn't a distinct language. There are some board support functions, like every common board has to get you started. Talking about it as a distinct and unique language may provide some initial comfort but establishes a mental block to migrate later. I have had a co-worker swear to me that Arduino is not C++ because he believed the documentation. And yet, it is.

The fact that the IDE compiler uses the gnu C++ compiler is a big hint as to what the language is.

Since there is no Arduino source debugger, I did the next best thing with my Arduino project and cross-compiled it using VisualStudio so I could use the MicroSoft debugger. Of course, I had to provide my own stub functions to implement the Arduino board support function but that was easy enough. The remainder of the code compiled with no changes. I was able to do this because the code is C++.

But Arduino is also based on professional quality technology. If you don't like the setup() and loop() paradigm, you are not obligated to use them. Feel free to define your own main().

I think I agree with you regarding the technology. The core compiler came from the gnu C++ compiler project but the IDE integrates it reasonably well.

I haven't noticed any official Arduino library reference that doesn't provide this information. Maybe you're thinking of 3rd party libraries?

Yes, I think you are probably correct.

mcmahad:
These things do not change the syntax and create a new language.

I'm sympathetic to that point of view. My GitHub user name is @per1234, which you might recognize from that issue discussing whether Arduino is a language.

Over the course of that discussion, I spent some time researching what exactly are the criteria for calling something a programming language, and didn't find anything. I think it's probably a fairly subjective distinction. I realized that this is something I'm simply not qualified to make authoritative statements on. If people who have far more experience in this matter think it's a language, I'm not going to argue.

mcmahad:
That's pretty much what VisualStudio

Do you really believe that something like VisualStudio would provide a superior experience to the average Arduino beginner?

mcmahad:
VS has a source debugger with breakpoints, which Arduino seems to lack and would be nice. I understand the technical difficulties in implementing a debugger or simulator, but I wouldn't say that lack of a debugger (i.e.- less than) makes Arduino more desirable. It's the one big feature that would really make the IDE noticeably more useful in developing projects.

You'll be happy to learn that Arduino Pro IDE has a debugger.

mcmahad:
The gentle learning curve is nice, but much too short to be a useful curve. This is my big complaint with the approach. It doesn't offer enough lasting value. I understand the goal of 'putting lipstick on a pig' but there isn't enough lipstick to do this. The language is C++ and trying to hide that doesn't work well once you get past the novice stage.

You misunderstood. My comment about the gentle learning curve was about the Arduino IDE's UI, not the "Arduino Language" vs C++ thing.

mcmahad:
Most of the questions and problems I see in the forums are based on difficulties with the C++ language syntax, not the Arduino specific material.

My other big concern with the "Arduino programming language" is that it really isn't a distinct language. There are some board support functions, like every common board has to get you started. Talking about it as a distinct and unique language may provide some initial comfort but establishes a mental block to migrate later. I have had a co-worker swear to me that Arduino is not C++ because he believed the documentation. And yet, it is.

The fact that the IDE compiler uses the gnu C++ compiler is a big hint as to what the language is.

As I said, even though I've accepting the "Arduino Language", I'm very sympathetic to your point of view, as you can see from this proposal I wrote as a follow up to the debate over whether Arduino is a separate language from C++:

A bit far fetched - I’d be happy if C++ was in the spotlight too - but the sheer fact that everything gets dumped in a gigantic file before compilation (in alphabetic order - I’ve see some people relying on that for file name conventions and breaking up long files in smaller chunks!) and functions’ signature forward declarations are done for you means that when writing code in « arduino speak » (to not say language) you can be breaking some C++ grammar or compilation rules but still end up with something fully functional.

So if there are differences in grammar and linking, may be you could claim the language is different...even if it’s just an IDE trick...

mcmahad:
The gentle learning curve is nice, but much too short to be a useful curve. This is my big complaint with the approach. It doesn't offer enough lasting value.

What is "lasting value"?

Most people using Arduinos just want to get one project working. They don't want to become proficient C++ programmers.

My other big concern with the "Arduino programming language" is that it really isn't a distinct language.

I know some people refer to the "Arduino programming language" but I don't think anyone seriously believes it is not C++. On the other hand if the name "Arduino programming language" provides a less off-putting entree to microprocessors than the name "C++" then I'm happy with that.

If you stand back and look at it dispassionately it is easy to conclude that the designers went out of their way to make C and C++ as difficult to use as possible.

...R

If you called it C++, the forums would be inundated with people saying things like “it’s not REALC++; it doesn’t even have the STL.”

westfw:
If you called it C++, the forums would be inundated with people saying things like “it’s not REALC++; it doesn’t even have the STL.”

true, but 'AVR C++' doesn't have it either :slight_smile:

You could use this library (never tried)

They don't have (on AVR) either the try-block statement.

You need some trade-offs when memory is limited...