Different approaches to learn non-blocking timing/coding

As user @red_car recently commented

There is an irresolvable tension between the poles of highly abstracted code that hides the all details and the elementary basic elements of C++ .

You can't have both at the same time:

easy & quickly to apply code that a beginner can adapt to her/his needs within half an hour
a there is an irresolvable tension between the poles of highly abstracted code that hides the details and the elementary basic elements of C++

A very deep understanding of the C++ programming language

This means there is very finely granulated almost continuum between these two poles where a tutorial can be settled to explain all and everything down to the ground or just explain the surface.

My understanding of the Arduino-project is:
at least at the beginning the intention was: make it easier to use microcontrollers for people who don't know anything about microcontrollers yet. Give them an opportunity to learn a rather small package of knowledge to enable using microcontrollers for small projects or art.

IMHO the arduino-project drifted away from this intention. I'm just stating it. I'm not judging this.

For applying some basic functionalities it is enough to explain the surface. If somebody wants to dive deeper into it; all doors are opened as arduino is an opensource project.

For libraries it is commonly accepted that they are there and that you are just using them

#include <SPI.h>
#include <Wire.h>
#include <Adafruit_GFX.h>
#include <Adafruit_SSD1306.h>

#define SCREEN_WIDTH 128 // OLED display width, in pixels
#define SCREEN_HEIGHT 64 // OLED display height, in pixels
#define OLED_RESET     4 // Reset pin # (or -1 if sharing Arduino reset pin)
#define SCREEN_ADDRESS 0x3D ///< See datasheet for Address; 0x3D for 128x64, 0x3C for 128x32
Adafruit_SSD1306 display(SCREEN_WIDTH, SCREEN_HEIGHT, &Wire, OLED_RESET);

as far as I my experience with the forum is: nobody ever claimed "oh! before using these libraries you must learn all the inner details of SPI.h, wire.h etc.. etc.

What is the categorial difference between using these libraries ithout explaining the details and using functions without explaining the details?

To me there is no difference at all. Sure always better to know more details down to how and when does the compiler optimise something in this or that way and what are the consequences out of this optimisation.

But it is not nescessary. If there should really occur a problem the beginner then has a reason to ask.

Forcing all beginners "You have to learn all these details before you can go beyond uploading ready to use binaries IMHO is a bad approach.

A famous example for this "You have to learn this grade of details and this complexity of code before you can apply this kind of functionality"

Is the blink without delay example-code.
IMHO: forcing the user to accept certain kind of programming style that is medium hard to understand for beginners.

Each new beginner-question about how to use millis() is a new evidence that this blink without delay-example is difficult to understand. Almost all of these questions have a general character. I have rarely seen a question about a certain detail.

So my point of view is:
hide away most of the details to make it easy to apply is OK. It is only a gradual difference.

To not explain things like "passing by reference" using the "&"-operator is just the same as not explaining "make sure to keep array-indeing within the defined boundaries".

And still it can be explained demonstrated on an example-code that does it wrong and demonstrates what will happen.

But just repeating posting a link to the blink without understand... ehm sorry blink without delay example is not the worst way but is far away of beeing optimal.

best regards Stefan

Examples should be used as a base of own investigations. What can be modified, which effect does it have? Can I modify it for solving one of my own problems?

1 Like

Stefan, your observations are correct within themselves, but they’re in the same bucket that separates the rapid development model of python, vs the rapid execution environment of assembler.

The user needs to decide what they want from the outcome… ‘near enough is good enough’, or ‘i’m proud of that, and I doubt anyone can criticise it’

Actually I think there is a difference.

There is absolutely no problem at all with abstracting details of code that hide the low level details that are completely irrelevant to what the user is trying to achieve.

Example ... "I would like to write the number "3" to my 7-segment display"... I don't want to figure out that I need to send a HIGH to segments A,B,C,D,G... for that I will use a library and simply call display.digit(3).

But when it comes to the fundamentals of program control... like how to use millis(), and how to make things happen in parallel... then I don't see how you can dumb that down.

You need to understand the programming concepts that sit behind it. If you don't then the next program that needs a slight variation to the scenario the code was designed for, then there is no ability to adapt the code because you no longer have control of the code (if fact you don't even understand the code).

Programming is not just about knowing which methods and functions to call... there is a component of writing code that needs a fundamental understanding of good program design, flow control, error handling, documentation, etc, etc... you can't put everything in a function and call that good code.

3 Likes

Hello @StefanL38 ,
I moved this to general discussion as it seemed more appropriate.

Good points but if there were a simple answer to this someone would already have found it. Years ago (like about 1980 or something) there was some software called The Last One, which claimed you could use it and never, ever need any other software. Well, despite knowing nothing about writing software then I believed this was nonsense. Clearly it was nonsense. Here we are over 40 years on discussion how best to write software and how best to teach beginners and all related stuff. There is no best! What works for one person is a hopeless nightmare for someone else, you just have to adapt as best you can to the needs of the person trying to learn.

2 Likes

YMMD

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.