User avatar
thagrol
Posts: 4258
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Missing half the skill?

Tue Oct 13, 2020 9:00 pm

Don't want to start a flame war but...

Having observed many of the questions being asked when folks are searching for help with their code I've come to a rather unhappy conclusion:

Many folks learning to code aren't learning how to debug and how to trap and handle errors gracefully. And not learning that it's even necessary to handle errors.

Seems a major oversight to me. Am I the only one seeing it that way?

I guess those exhibiting this the most could be self taught which would go some way to explaning it.
Arguing with strangers on the internet since 1993.

All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.

trejan
Posts: 3064
Joined: Tue Jul 02, 2019 2:28 pm

Re: Missing half the skill?

Tue Oct 13, 2020 9:30 pm

I expect it is novices who are following a step by step guide. They're being hand held and don't yet understand any of the basic concepts in that language. The sometimes bizarre code is from trying to mash together the hopefully working guide code and some examples they found elsewhere to build their project. A quick lesson on the basics would help greatly but people want results fast so jump in with a guide and zero understanding.

Usually anybody who does gain a real interest in programming will start to dig deeper at this point and start learning properly. A helpful prod in the right direction is sometimes needed. The main issue is to prevent them picking up awful habits from elsewhere *cough*stackoverflow*cough*

User avatar
UbuntuWizard
Posts: 65
Joined: Sat Sep 26, 2020 3:52 pm

Re: Missing half the skill?

Tue Oct 13, 2020 9:35 pm

thagrol wrote:
Tue Oct 13, 2020 9:00 pm
Don't want to start a flame war but...

Having observed many of the questions being asked when folks are searching for help with their code I've come to a rather unhappy conclusion:

Many folks learning to code aren't learning how to debug and how to trap and handle errors gracefully. And not learning that it's even necessary to handle errors.

Seems a major oversight to me. Am I the only one seeing it that way?

I guess those exhibiting this the most could be self taught which would go some way to explaning it.
if your referring to people who don't know how to debug properly (ex. search the error or look at previous forum posts that have the solution for their problem) then yes, I do notice that quite often.

If you want to help this problem, you should probably inform them that they should search it themself if there is already a solution:
You could tell said person something like:

Always put (site:raspberrypi.org) after your google searches to see topics for the raspberry pi website.
Google your problems or look in other forums for that topic.
Check if others have your problem.
etc
I use Ubuntu Linux!

User avatar
UbuntuWizard
Posts: 65
Joined: Sat Sep 26, 2020 3:52 pm

Re: Missing half the skill?

Tue Oct 13, 2020 9:38 pm

trejan wrote:
Tue Oct 13, 2020 9:30 pm
I expect it is novices who are following a step by step guide. They're being hand held and don't yet understand any of the basic concepts in that language. The sometimes bizarre code is from trying to mash together the hopefully working guide code and some examples they found elsewhere to build their project. A quick lesson on the basics would help greatly but people want results fast so jump in with a guide and zero understanding.

Usually anybody who does gain a real interest in programming will start to dig deeper at this point and start learning properly. A helpful prod in the right direction is sometimes needed. The main issue is to prevent them picking up awful habits from elsewhere *cough*stackoverflow*cough*
I've been in stackoverflow for a while. The general out-of-curiosity question answers aren't that good, but programming wise I haven't noticed much wrong? Whats wrong with StackOverflow?
I use Ubuntu Linux!

trejan
Posts: 3064
Joined: Tue Jul 02, 2019 2:28 pm

Re: Missing half the skill?

Tue Oct 13, 2020 10:52 pm

UbuntuWizard wrote:
Tue Oct 13, 2020 9:38 pm
I've been in stackoverflow for a while. The general out-of-curiosity question answers aren't that good, but programming wise I haven't noticed much wrong? Whats wrong with StackOverflow?
If you use it wisely then Stack Overflow can be helpful. Too many people aren't doing that though. The problem is still the copy & pasting of code snippets without any attempt at understanding it. Stack Overflow has made it a lot easier now which is a double-edged sword. The rush to provide the first answer doesn't help the quality of answers either.

User avatar
jahboater
Posts: 6723
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: Missing half the skill?

Tue Oct 13, 2020 11:07 pm

There is also code review:-
https://codereview.stackexchange.com/
where code that's posted must be working, and people ask for help improving it.
Pi4 8GB (Raspberry Pi OS 64-bit), Pi4 4GB, Pi4 2GB, Pi1 Rev 1 256MB, Pi Zero

User avatar
UbuntuWizard
Posts: 65
Joined: Sat Sep 26, 2020 3:52 pm

Re: Missing half the skill?

Tue Oct 13, 2020 11:18 pm

trejan wrote:
Tue Oct 13, 2020 10:52 pm
UbuntuWizard wrote:
Tue Oct 13, 2020 9:38 pm
I've been in stackoverflow for a while. The general out-of-curiosity question answers aren't that good, but programming wise I haven't noticed much wrong? Whats wrong with StackOverflow?
If you use it wisely then Stack Overflow can be helpful. Too many people aren't doing that though. The problem is still the copy & pasting of code snippets without any attempt at understanding it. Stack Overflow has made it a lot easier now which is a double-edged sword. The rush to provide the first answer doesn't help the quality of answers either.
I usually don't rush the code from StackOverflow, probably why I don't think its that bad. If theres anything wrong with the code from StackOverflow I just change the code to fit my needs (usually a few lines) But I see your point
I use Ubuntu Linux!

User avatar
thagrol
Posts: 4258
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Missing half the skill?

Tue Oct 13, 2020 11:49 pm

UbuntuWizard wrote:
Tue Oct 13, 2020 9:35 pm
thagrol wrote:
Tue Oct 13, 2020 9:00 pm
Don't want to start a flame war but...

Having observed many of the questions being asked when folks are searching for help with their code I've come to a rather unhappy conclusion:

Many folks learning to code aren't learning how to debug and how to trap and handle errors gracefully. And not learning that it's even necessary to handle errors.

Seems a major oversight to me. Am I the only one seeing it that way?

I guess those exhibiting this the most could be self taught which would go some way to explaning it.
if your referring to people who don't know how to debug properly (ex. search the error or look at previous forum posts that have the solution for their problem) then yes, I do notice that quite often.
That's part of it certainly but not really what I meant. People have a tendancy to ask someone who knows before doing their own research. Ask me once, that's fine (unless it's a common question). Ask me twice you'll get pointed at existing resources. Ask me a third time, you'll get short shrift.

It's things like:
  • Folks not even understanding that the first step in fixing anything is finding out what error is actually occuring. All those "my program won't run at boot but runs in the command line" threads for example.
  • Not realising that a program which runs under ideal conditions isn't finished.
  • Not realising just how usefull the humble print statement is.
  • Thinking that kuldging things outside their program (all those suggestions to "sleep 60" when trying to start something at boot from cron or rc.local or to "use sudo" when there are permissions problems for example) rather than fixing the problem in their code is the way to go.
I'm really not talking about break points and single stepping code. I wouldn't expect a beginner to have got to grips with those.
If you want to help this problem, you should probably inform them that they should search it themself if there is already a solution:
You could tell said person something like:

Always put (site:raspberrypi.org) after your google searches to see topics for the raspberry pi website.
Google your problems or look in other forums for that topic.
Check if others have your problem.
etc
Oh I do. I've lost count of how many times I've written something like "try a forum and/or web search " prefixed with a brief explanation if I'm in a generous mood. "See the man page" and "check the docs" are favourites too. As is, for non programming issues, "check the help section".
Arguing with strangers on the internet since 1993.

All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.

User avatar
Imperf3kt
Posts: 4236
Joined: Tue Jun 20, 2017 12:16 am
Location: Australia
Contact: Twitter

Re: Missing half the skill?

Wed Oct 14, 2020 3:05 am

Not so much here, but at another forum where it's specifically centred around one programming language, we got a lot of these questions.

My first response is usually to explain the error message and point to probable causes / fixes.

If the poster has trouble understanding my explanation, I'll explain why the error occurred (if I know) and give them a quick sample of code to try or something to change.

If they still don't understand, then I'll do one of three things.

If I have the time and the user is sufficiently struggling, I'll just put up some commented code and explain how to use it (sometimes this is usually just a snippet from something I wrote in a project of my own or something I wrote from memory of the syntax without reference) it won't work as is, but it gives them a big head start. Ordinarily, tweaking it to suit their needs and comparing it with how they were going about it, teaches them enough to understand what happened and why.

If I suspect they are just being lazy, I generally point to the documentation and stop replying.

If I suspect it is beyond their skill level, I suggest an alternative
55:55:44:44:4C
52:4C:52:42:41

Rose tinted glasses are difficult to see through.

User avatar
davidcoton
Posts: 5876
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: Missing half the skill?

Wed Oct 14, 2020 8:38 am

Something that annoys me just as much is that, when you try to teach someone to fish, another "expert" delivers cans of sardines. :x
Location: 345th cell on the right of the 210th row of L2 cache

Heater
Posts: 17468
Joined: Tue Jul 17, 2012 3:02 pm

Re: Missing half the skill?

Wed Oct 14, 2020 10:30 am

thagrol wrote:
Tue Oct 13, 2020 9:00 pm
Many folks learning to code aren't learning how to debug and how to trap and handle errors gracefully. And not learning that it's even necessary to handle errors.
I have a theory about that.

Beginner programmers, or indeed anyone new to some library or language, will be reading tutorials and getting started guides. Often those guides omit any mention of errors and their examples omit any checking of return values for error status etc.

This is understandable, such tutorials don't want to clutter the example code up with error checking code. They want to show the essentials of their API as simply as possible.

The end result is that beginners use that code, perhaps tweak it to do something a bit different. It fails. They end up here asking the question "My code don't work, why?"

I'm in favor of not spoon feeding canned solutions to such questions. Better to ask them to put in that error checking code, report back their results. Whatever it takes.
Memory in C++ is a leaky abstraction .

User avatar
thagrol
Posts: 4258
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Missing half the skill?

Wed Oct 14, 2020 10:55 am

davidcoton wrote:
Wed Oct 14, 2020 8:38 am
Something that annoys me just as much is that, when you try to teach someone to fish, another "expert" delivers cans of sardines. :x
Oh yes.Hope I've not been guilty of that.

And then there's the "expert" who delivers frozen chips (fries to you Yanks). Or the "expert" with about 10 minutes more experience than the person seeking help.

Joke alert:

You guy know the definition of expert?

An ex is a has been and a spurt is a drip under pressure...
Arguing with strangers on the internet since 1993.

All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.

User avatar
DougieLawson
Posts: 40835
Joined: Sun Jun 16, 2013 11:19 pm
Location: A small cave in deepest darkest Basingstoke, UK
Contact: Website Twitter

Re: Missing half the skill?

Wed Oct 14, 2020 11:01 am

thagrol wrote:
Tue Oct 13, 2020 9:00 pm

Many folks learning to code aren't learning how to debug and how to trap and handle errors gracefully. And not learning that it's even necessary to handle errors.
That's the crux of it. When folks started with the ZX80, ZX81, ZXSpectrum the programs they were writing were usually printed on pulped dead tree, you could send a question to the author (on paper in an envelope with a stamp) that might get published in the next month's edition of the pulped dead tree publication. So we had to learn to spot our own errors, we had to learn to look for the typographical/transcription errors and if the published article included a bug (which wasn't unknown) you learned how to add PRINT statements to spot it.

Hardest of the lot was the Microtan 65 space invaders game. Type in another page of hex, save to cassette tape (and hope it would reload later) then single step through the code trying to find where you'd entered 5E rather than E5. There was no support, there was no way to write it up on the forum and wait for the sardine salesman to hand you a tin rather than a fishing rod.

There's a lot to be said for line by line debuggers. There's a lot to be said for learning gdb (with all of its quirks). There's a lot to be said for searching before posting (which is the piece that is missing from here). Learning to put a breakpoint or a printf() or a deliberate error in your code so you can see why a variable has an incorrect value is the missing skill.

At the moment the forum is also in "Eternal September" mode with so many questions that appear to be "please write my homework for me for free, I'd like the degree at the end of this". That's an annual annoyance with the forum newbies every autumn.
Any language using left-hand whitespace for syntax is ridiculous

Any DMs sent on Twitter will be answered next month.
Fake doctors - are all on my foes list.

Any requirement to use a crystal ball or mind reading will result in me ignoring your question.

hippy
Posts: 9237
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Missing half the skill?

Wed Oct 14, 2020 11:56 am

davidcoton wrote:
Wed Oct 14, 2020 8:38 am
Something that annoys me just as much is that, when you try to teach someone to fish, another "expert" delivers cans of sardines. :x
If someone asks you what the number for an emergency service is; would you tell them or tell them how they should find out for themselves ?

It's never as serious as that but there is still a judgement call as to what will help someone asking the question best at the point they are asking.

My view is that it's often better to give someone the answer they need than not. Being taught how to fish may help them better long term but doesn't solve their immediate problem which is what they will be most concerned with.

Telling people what the answer is and telling them how they can help resolve such issues in future themselves is probably the best approach IMO.

User avatar
thagrol
Posts: 4258
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Missing half the skill?

Wed Oct 14, 2020 11:58 am

DougieLawson wrote:
Wed Oct 14, 2020 11:01 am
At the moment the forum is also in "Eternal September" mode with so many questions that appear to be "please write my homework for me for free, I'd like the degree at the end of this". That's an annual annoyance with the forum newbies every autumn.
That leads me to my other bugbear: "I'm a business please give me free tech support " or worse "I'm making a product please provide free design and implimentation consultancy". But those are off topic for this thread.
Arguing with strangers on the internet since 1993.

All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.

User avatar
thagrol
Posts: 4258
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Missing half the skill?

Wed Oct 14, 2020 12:04 pm

hippy wrote:
Wed Oct 14, 2020 11:56 am
davidcoton wrote:
Wed Oct 14, 2020 8:38 am
Something that annoys me just as much is that, when you try to teach someone to fish, another "expert" delivers cans of sardines. :x
If someone asks you what the number for an emergency service is; would you tell them or tell them how they should find out for themselves ?
I'd probably dial it then hand them the phone. ssuming an immediate need rathe than a general enquiry.
It's never as serious as that but there is still a judgement call as to what will help someone asking the question best at the point they are asking.

My view is that it's often better to give someone the answer they need than not. Being taught how to fish may help them better long term but doesn't solve their immediate problem which is what they will be most concerned with.
But in doing so you increase their dependency on you. Instead of catching thier own fish they'll expect you to turn up every day with a can of sardines.

Or in a much bleaker way get em hooked on hard drugs by giving away the first dose for free.
Telling people what the answer is and telling them how they can help resolve such issues in future themselves is probably the best approach IMO.
There's truth to that but the trick is to get them to read beyond the solution you handed them and into the adivce for the future.
Arguing with strangers on the internet since 1993.

All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.

hippy
Posts: 9237
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Missing half the skill?

Wed Oct 14, 2020 12:20 pm

thagrol wrote:
Wed Oct 14, 2020 12:04 pm
hippy wrote:
Wed Oct 14, 2020 11:56 am
My view is that it's often better to give someone the answer they need than not. Being taught how to fish may help them better long term but doesn't solve their immediate problem which is what they will be most concerned with.
But in doing so you increase their dependency on you. Instead of catching thier own fish they'll expect you to turn up every day with a can of sardines.
Not necessarily and it's not a certainty.

And I added that the best approach IMO is to give them the answer they immediately want and how to find the answers for themselves in future. That creates a good enough foundation to withdraw or limit support later.

One needs to lead people to stand on their own two feet. Merely telling them to do so has a degree of elitism about it and isn't necessarily the best way to pull someone out of their predicament. As I said it's a judgement call.

User avatar
jahboater
Posts: 6723
Joined: Wed Feb 04, 2015 6:38 pm
Location: Wonderful West Dorset

Re: Missing half the skill?

Wed Oct 14, 2020 1:23 pm

hippy wrote:
Wed Oct 14, 2020 12:20 pm
And I added that the best approach IMO is to give them the answer they immediately want and how to find the answers for themselves in future. That creates a good enough foundation to withdraw or limit support later.
I once did a morning a week on a help desk.
Sometimes I would pretend that I didn't know the answer, and go through the process of looking it up with the user watching.
That way, they a) got the answer, b) learned how to investigate in future, and c) gave them extra confidence knowing that even experts don't know all the answers.
Pi4 8GB (Raspberry Pi OS 64-bit), Pi4 4GB, Pi4 2GB, Pi1 Rev 1 256MB, Pi Zero

User avatar
davidcoton
Posts: 5876
Joined: Mon Sep 01, 2014 2:37 pm
Location: Cambridge, UK
Contact: Website

Re: Missing half the skill?

Wed Oct 14, 2020 3:11 pm

hippy wrote:
Wed Oct 14, 2020 12:20 pm
thagrol wrote:
Wed Oct 14, 2020 12:04 pm
hippy wrote:
Wed Oct 14, 2020 11:56 am
My view is that it's often better to give someone the answer they need than not. Being taught how to fish may help them better long term but doesn't solve their immediate problem which is what they will be most concerned with.
But in doing so you increase their dependency on you. Instead of catching thier own fish they'll expect you to turn up every day with a can of sardines.
Not necessarily and it's not a certainty.

And I added that the best approach IMO is to give them the answer they immediately want and how to find the answers for themselves in future. That creates a good enough foundation to withdraw or limit support later.

One needs to lead people to stand on their own two feet. Merely telling them to do so has a degree of elitism about it and isn't necessarily the best way to pull someone out of their predicament. As I said it's a judgement call.
There are very few cases where fixing a bug in code is so urgent that giving a canned answer is justified. Life or serious injury is seldom the result of a slower answer, but in the longer term such bad outcomes may be prevented in debugging skills are transferred -- we never know where the beginner is going to end up and whether their ability to debug may become crucial. Taking a step-by-step approach to debugging is always going to be a better learning experience than revealing the answer first and the workings second. It will also be far more satisfying to the serious learner -- they make a contribution to the solution. Consider also that the Pi is meant to be a learning platform.

It is also inconsiderate and rude to cut in with the "lob the canned fish" approach while another poster is trying to teach the answer.
Location: 345th cell on the right of the 210th row of L2 cache

User avatar
thagrol
Posts: 4258
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Missing half the skill?

Wed Oct 14, 2020 3:26 pm

hippy wrote:
Wed Oct 14, 2020 12:20 pm
And I added that the best approach IMO is to give them the answer they immediately want and how to find the answers for themselves in future.
I know you did and to a limited extent I agree (as wintnessed by the portion of my post you didn't quote).

I've taken that approach in the past and will likely do so again. My concern is that once they've got the answer they won't read further, won't follow any links, and likely won't make the connection next time they hit a problem they don't know the answer to. That rather than apply the advice given (read the man page, read the docs, search the forum, search the web) they'll just be back asking for another tin of sardines.

That does seem to be human nature though. I see a lot of questions on these fora that fall into this trap. Not just when it comes to programming.

Admittedly it's hard/impossible to know how many people do manage to find the solution on their own as they generally don't post anything about it.

Maybe I'm biased. A career in software test & QA can do that to you.
Arguing with strangers on the internet since 1993.

All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.

swampdog
Posts: 509
Joined: Fri Dec 04, 2015 11:22 am

Re: Missing half the skill?

Wed Oct 14, 2020 4:37 pm

Bit more advocacy than flame methinks. I'll chance being more wordy than usual.
thagrol wrote:
Tue Oct 13, 2020 9:00 pm
Don't want to start a flame war but...

Having observed many of the questions being asked when folks are searching for help with their code I've come to a rather unhappy conclusion:

Many folks learning to code aren't learning how to debug and how to trap and handle errors gracefully. And not learning that it's even necessary to handle errors.
It's increasingly common in all modern life that folks just want to "do" in favour of "understand". Fortunately, with coding the distinction is made apparent much earlier than in other areas. Unfortunately it can persist much longer which is why most bridges stay standing but it takes nigh on 90 seconds for my car audio system to seek back to the track it was playing off a 128Gb memory stick when I restart the motor. It probably runs java.

C++ is too complex and C is not taught properly. Other languages exist to take up the slack but at the end of the day there's nothing better for debugging than judicious print statements. That gets tedious real quick which instils defensive programming. If I'm at liberty to give one quick example it's "SDE_NULL(x)" where 'x' is a C++ pointer argument. It's a horrible macro of mine which tests for null at runtime and raises an exception. It was originally conceived as a -DDEBUG only thing but proved so useful it stays in release code. The overhead of typing SDE_NULL() for each pointer arg on entry to a method far outweighs its runtime overhead, especially as it spits out the source file and line number. It was born around borland c++ builder 3 era whenever that was. Once I went unix only, I reckon I can admit now, as I'm retired from commercial programming, there never was a release version. It was -DDEBUG all the way and if the client ever thought the binary was too big (they never did) I could have run 'strip'.

Coming back to your point, when there's a "do" coder about even the above can't help. All one had to do to make the above work was..

Code: Select all

#define SD_CATCH
#include blah

int main(blah)
{
 try	{
 	Init();
 	//app
 	Term();
 }
 SD_CATCH
 return sdRetv();
}
..but instead of invoking their new class inside Init() they declared it static above main(). It's ctor died and the program called abort.
Seems a major oversight to me. Am I the only one seeing it that way?

I guess those exhibiting this the most could be self taught which would go some way to explaning it.
It must be very difficult to self teach these days. There is so much junk out there. I hope academia is better than it was in my day. Uni: first year. First assembler group. "What's the first thing you do when receiving an non maskable interrupt?"

These days I know to keep my mouth shut. To give an idea how badly this lecturer took my reply I have to digress: we once visited a seal sanctuary and after the seal guy did his spiel, any questions? It looked like I was about to pop, about to say something but my wife kept glaring at me. The parents & kids all looking at me. After we left she said, okay what did you not say? "What do they taste like?"

The NMI answer is, of course, mask it off. Turned out for the best. I knew 6502 assembler inside out so used the time to learn C. Unless you were there you'd not appreciate how much that lecturer loathed me for killing his pet intro.

I don't know if it's a good idea for budding programmers to know an assembler. I know it helped me understand C, K&R back then (so almost no compiler help). I also knew the motorola 6809(?B?) (whatever was in the dragon 32) and then the 68000 which where I learned K&R C. Other asm like Z80, not so much. The K&R compiler was so dumb I could visualise the asm it would spit out for function calls etc.

Contrast with when I used to post on usenet C/C++ groups and yet again hit a wall with academia. I'd try and explain what a pointer really was and get jumped on by language purists. A noob comes for help and sees "experts" arguing. Not good.

In these rpi forums though, we tend (mostly) to give alternate suggestions.

Pointers are not going away though. Even if it's just array element a[0] indexing a[7], still a pointer. ;-)

User avatar
thagrol
Posts: 4258
Joined: Fri Jan 13, 2012 4:41 pm
Location: Darkest Somerset, UK
Contact: Website

Re: Missing half the skill?

Wed Oct 14, 2020 4:56 pm

swampdog wrote:
Wed Oct 14, 2020 4:37 pm
at the end of the day there's nothing better for debugging than judicious print statements. That gets tedious real quick which instils defensive programming.
Absolutely agree though as I'm mostly writing python these days I tend to use the logging module.
I don't know if it's a good idea for budding programmers to know an assembler.
Me neither. There are definitely things you learn with assembler that you don't learn elsewhere. That said the last time I wrote any assembler was in the 90s. For ARM under RISCOS when BBC BasicV proved too slow for the heavy lifting.

Love the seal centre story BTW.
Arguing with strangers on the internet since 1993.

All advice given is based on my experience. it worked for me, it may not work for you.
All GPIO pin numbers are BCM numbers.

hippy
Posts: 9237
Joined: Fri Sep 09, 2011 10:34 pm
Location: UK

Re: Missing half the skill?

Wed Oct 14, 2020 4:57 pm

davidcoton wrote:
Wed Oct 14, 2020 3:11 pm
There are very few cases where fixing a bug in code is so urgent that giving a canned answer is justified.
When looked at from one's own perspective that may be so but it may not be how the person wanting help sees it, or others.
davidcoton wrote:
Wed Oct 14, 2020 3:11 pm
It is also inconsiderate and rude to cut in with the "lob the canned fish" approach while another poster is trying to teach the answer.
From your perspective it may be but not everyone will agree, and probably not the person who wants that answer.

Please note that I don't object to you finding it that way or even saying that.

User avatar
UbuntuWizard
Posts: 65
Joined: Sat Sep 26, 2020 3:52 pm

Re: Missing half the skill?

Wed Oct 14, 2020 5:02 pm

thagrol wrote:
Tue Oct 13, 2020 11:49 pm
UbuntuWizard wrote:
Tue Oct 13, 2020 9:35 pm
thagrol wrote:
Tue Oct 13, 2020 9:00 pm
Don't want to start a flame war but...

Having observed many of the questions being asked when folks are searching for help with their code I've come to a rather unhappy conclusion:

Many folks learning to code aren't learning how to debug and how to trap and handle errors gracefully. And not learning that it's even necessary to handle errors.

Seems a major oversight to me. Am I the only one seeing it that way?

I guess those exhibiting this the most could be self taught which would go some way to explaning it.
if your referring to people who don't know how to debug properly (ex. search the error or look at previous forum posts that have the solution for their problem) then yes, I do notice that quite often.
That's part of it certainly but not really what I meant. People have a tendancy to ask someone who knows before doing their own research. Ask me once, that's fine (unless it's a common question). Ask me twice you'll get pointed at existing resources. Ask me a third time, you'll get short shrift.

It's things like:
  • Folks not even understanding that the first step in fixing anything is finding out what error is actually occuring. All those "my program won't run at boot but runs in the command line" threads for example.
  • Not realising that a program which runs under ideal conditions isn't finished.
  • Not realising just how usefull the humble print statement is.
  • Thinking that kuldging things outside their program (all those suggestions to "sleep 60" when trying to start something at boot from cron or rc.local or to "use sudo" when there are permissions problems for example) rather than fixing the problem in their code is the way to go.
I'm really not talking about break points and single stepping code. I wouldn't expect a beginner to have got to grips with those.
If you want to help this problem, you should probably inform them that they should search it themself if there is already a solution:
You could tell said person something like:

Always put (site:raspberrypi.org) after your google searches to see topics for the raspberry pi website.
Google your problems or look in other forums for that topic.
Check if others have your problem.
etc
Oh I do. I've lost count of how many times I've written something like "try a forum and/or web search " prefixed with a brief explanation if I'm in a generous mood. "See the man page" and "check the docs" are favourites too. As is, for non programming issues, "check the help section".
A thing beginners also always do is execute everything with "sudo". Executing ANYTHING with full unix super user permissions is extremely dangerous on any UNIX system. (Including the Raspberry Pi)

Executing something with super user permissions is like someone having the opportunity to push you off a cliff and to your death.

No built in antivirus / windows service to prevent a program from deleting critical files without permission (unless you have a linux antivirus but those are pretty basic)

Nothing to check if a program is sending files without your permission

The super user is above the restrictions of the system. Execute with sudo only when you trust the program being executed fully. Never put sudo on everything you type.
I use Ubuntu Linux!

Heater
Posts: 17468
Joined: Tue Jul 17, 2012 3:02 pm

Re: Missing half the skill?

Wed Oct 14, 2020 5:40 pm

swampdog wrote:
Wed Oct 14, 2020 4:37 pm
C++ is too complex and C is not taught properly.
I agree, C++ is absurdly complex. Whilst at the same time not doing anything to make programs more robust than C.

Also agree that C is a much simpler language. However using it to create robust, complex code is anything but simple.
swampdog wrote:
Wed Oct 14, 2020 4:37 pm
If I'm at liberty to give one quick example it's "SDE_NULL(x)" where 'x' is a C++ pointer argument. It's a horrible macro of mine which tests for null at runtime and raises an exception.
The fact that you needed to create that macro show up a huge problem in the supposedly "high level" language.
swampdog wrote:
Wed Oct 14, 2020 4:37 pm
I don't know if it's a good idea for budding programmers to know an assembler.
Back in the dark ages, before any kind of home computer, we learned BASIC is school. That was a good introduction to what a program even is and what it means to program.

However, in that same year we were taught assembler and producing an assembler project contributed significantly to our final grades.

As a result I feel that anyone who aspires to program computers should have some experience with assembler.
swampdog wrote:
Wed Oct 14, 2020 4:37 pm
Pointers are not going away though. Even if it's just array element a[0] indexing a[7], still a pointer. ;-)
I'm sure pointers are not going away. But they are very different things to array indexing in a high level language.
Memory in C++ is a leaky abstraction .

Return to “General programming discussion”