BASIC - more harmful than useful?

Drop in for a chat and a cup of tea

899 posts   Page 26 of 36   1 ... 23, 24, 25, 26, 27, 28, 29 ... 36
by -rst- » Fri Feb 01, 2013 2:29 pm
Abishur's idea about extending Nano sounds like worth taking a look. Or could we have a CLI version of IDLE (defaults to interactive mode, but easy way to open/save files)?

There is a (admittedly cumbersome) way to execute stored scripts from the Python shell using execfile().

There are also ways to save the interactive session http://docs.python.org/2/tutorial/inter ... y-bindings (code in startup file).

The startup file could be used to import most used libraries and maybe activate a graphics library (does pygame work from CLI? or maybe a custom dispmanx+open* one)...

In addition there is already a turtle graphics implementation (at least for windowed envs, based on Tk): http://docs.python.org/2/library/turtle.html


In no way trying to diss BASIC, just pointing out what is available/possible in Python ;)
http://raspberrycompote.blogspot.com/ - Low-level graphics and 'Coding Gold Dust'
Posts: 893
Joined: Thu Nov 01, 2012 12:12 pm
Location: Dublin, Ireland
by DavidS » Fri Feb 01, 2013 3:05 pm
As to the concept of assembly as a first language:
I do believe that if the student is at least 9 years old that Assembly may indeed be the best point to begin. Assembly is actually very simple, easy to debug, direct, and on the ARM has a fairly small and consistent instruction set. Further if the student begins in assembly they are likely to learn way way more than any other beginning language. Though for the very young or those that are not sure if they are interested, we still need an entry point to get them hooked, BASIC is one good option for this. Then there are LOGO, Scratch, Interpreted Pascal, Interpreted C, and a few other options.

@Gordan:
The only reason I did not download the updated RTB is I can not run it, I do like it though, and would recommend it to any one that is stuck on the idea that the OS makes a huge difference (and it can not be RISC OS) and thus is stuck on Linux on there RPi. People do not seem to realize that most of the things that they want are related to Applications, not the OS on which they run.
ARM Assembly Language: For those that want: Simple, Powerful, Easy to learn, and Easy to debug.
User avatar
Posts: 1251
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
by simplesi » Fri Feb 01, 2013 11:25 pm
Assembly is actually very simple, easy to debug, direct, and on the ARM has a fairly small and consistent instruction set.


A 9 year old isn't at all interested in small and consistent instruction sets - they want things to move on the screen. The want to make/play games and animate stories :)

Assembly at 9 :lol:

Simon
Seeking help with Scratch and I/O stuff for Primary age children
http://cymplecy.wordpress.com/ @cymplecy on twitter
Posts: 1788
Joined: Fri Feb 24, 2012 6:19 pm
Location: Euxton, Lancashire, UK
by DavidS » Sat Feb 02, 2013 2:49 am
simplesi wrote:
Assembly is actually very simple, easy to debug, direct, and on the ARM has a fairly small and consistent instruction set.


A 9 year old isn't at all interested in small and consistent instruction sets - they want things to move on the screen. The want to make/play games and animate stories :)

Assembly at 9 :lol:

Simon


Are you thinking of a 5 year old? I have taught a couple of 9 year olds to code in ARM assembly (of course I had already taught them LOGO, and BASIC). Now if you were talking about x86 assembly, or PPC assembly I would agree. The consistent instruction set makes it easier to teach it to young children. For this reason the only instruction sets that I would ever attempt to teach a young child are ARM, 680x0, MIPS, and PDP-11.

And this is another advantage of BBC BASIC, it is easy to transition into ARM assembly language.
ARM Assembly Language: For those that want: Simple, Powerful, Easy to learn, and Easy to debug.
User avatar
Posts: 1251
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
by DexOS » Sat Feb 02, 2013 4:01 am
I agree with DavidS, i have taught 9 year olds assembly, its down to the person.
If there brains are wired in the right way, they will find ASM very easy to understand and learn, if not, they will find it hard.
This does not mean they are more intelligent, than those that find it hard, it just mean there brains are wired in a different way.

I would say about 10% of programmers brains are wired in the right way.
The other 90% need a rewire ;) .
(only joking)
Batteries not included, Some assembly required.
User avatar
Posts: 851
Joined: Wed May 16, 2012 6:32 pm
by jamesh » Sat Feb 02, 2013 9:11 am
DavidS wrote:
simplesi wrote:
Assembly is actually very simple, easy to debug, direct, and on the ARM has a fairly small and consistent instruction set.


A 9 year old isn't at all interested in small and consistent instruction sets - they want things to move on the screen. The want to make/play games and animate stories :)

Assembly at 9 :lol:

Simon


Are you thinking of a 5 year old? I have taught a couple of 9 year olds to code in ARM assembly (of course I had already taught them LOGO, and BASIC). Now if you were talking about x86 assembly, or PPC assembly I would agree. The consistent instruction set makes it easier to teach it to young children. For this reason the only instruction sets that I would ever attempt to teach a young child are ARM, 680x0, MIPS, and PDP-11.

And this is another advantage of BBC BASIC, it is easy to transition into ARM assembly language.


I have to say DavidS you do have some bizarre experiences. I would seriously hesitate about teaching 5 year old programming, and 9 years old I think would be an unsuitable target for assembler except in a very simple form. As for Arm - on which planet is there a transitioon from BBC Basic to Arm assembly? And since when was Arm assembly simple?

6502 maybe. Not Arm.
Moderator
Moderator
Posts: 10528
Joined: Sat Jul 30, 2011 7:41 pm
by pygmy_giant » Sat Feb 02, 2013 5:31 pm
I'm 36 and the thought of any kind of assembler scares me ****less.

My 8 yearold enjoys playing with spreadsheets, but I doubt he would have the patience for assembler - I have yet to try him with Scratch (waiting for the RISC OS bugs to get ironed out) but I still anticipate interesting him in that being a minor challenge. I can imagine him enjoying it once he gets the hang of it as he enjoys computer games with level editors, but assembler? Can't see it. That would take more bribing than I could afford.

I don't doubt that some 9 yr olds could do some assembler - but they must be exceptional. I have noticed a reort of 11 year olds enjoying assembler on another thread.

What specifically did you teach them and what resources did you use? I would be interested to know as it could remove some of my fears as a 36 year old.
Posts: 1566
Joined: Sun Mar 04, 2012 12:49 am
by abishur » Sat Feb 02, 2013 5:41 pm
DexOS wrote:I agree with DavidS, i have taught 9 year olds assembly, its down to the person.

+1
Not that I've taught anyone assembly, but that what you teach them and when you teach them it all comes down to the individual
Dear forum: Play nice ;-)
User avatar
Moderator
Moderator
Posts: 4221
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
by pygmy_giant » Sat Feb 02, 2013 5:50 pm
I guess so - there is a youtube clip of a 6 year old solving a rubiks cube. Maybe as adults we forget how adaptable kids brains really are.
Posts: 1566
Joined: Sun Mar 04, 2012 12:49 am
by abishur » Sat Feb 02, 2013 6:05 pm
pygmy_giant wrote:I guess so - there is a youtube clip of a 6 year old solving a rubiks cube. Maybe as adults we forget how adaptable kids brains really are.


This might be circling things back around, but I think one of the main issues in programming is making it enjoyable enough for the kid. I could certainly force my child to learn something, but I think the true focus should be on enticing kids to learn it in an education environment (i.e., kids you ultimately have no control over).

To that end, I think Gordon raised some good points about the ease to begin programming (you turn it on and there you are) and the ease of the basic format of the language.

Once you make a good environment for a kid to pick it up and go, I think that making it interesting is the next big step.
Dear forum: Play nice ;-)
User avatar
Moderator
Moderator
Posts: 4221
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
by pygmy_giant » Sat Feb 02, 2013 6:19 pm
Like the BBC micro booting straigth into BASIC command line.

Expectations are different these days - way back then anything with bright lights and buttons was an instant WOW.

Now-a-days GUI is standard.

I like your back-to-basics thinking but wont kids just think - WTF? Where's the internet and Angry Birds? Even my brother's phone has that.

"Miss - theres something wrong with this computer - it wants me to type something..."
Posts: 1566
Joined: Sun Mar 04, 2012 12:49 am
by abishur » Sat Feb 02, 2013 6:20 pm
pygmy_giant wrote:"Miss - theres something wrong with this computer - it wants me to type something..."

:lol:
Dear forum: Play nice ;-)
User avatar
Moderator
Moderator
Posts: 4221
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
by pygmy_giant » Sat Feb 02, 2013 6:25 pm
"Yes dear, thats what we're going to be doing today - its called 'programing' "

"Don't you mean scripting Miss?"
Posts: 1566
Joined: Sun Mar 04, 2012 12:49 am
by DavidS » Sun Feb 03, 2013 12:22 am
pygmy_giant wrote:What specifically did you teach them and what resources did you use? I would be interested to know as it could remove some of my fears as a 36 year old.


It is quite simple:
1::: Get them into BBC BASIC V to where they have a usable understanding of Variables, Scope, Flow control, etc.

2::: A little bit at a time get them to start replacing the built in BBC BASIC V commands with equivalent SYS calls, and in the process slowly introduce them to the concept of indirection (eg Pointers).

3::: Build on this until they are only using BBC BASIC statements for flow control, and managing variables. Then slowly step them into building WIMP based multitasking applications.

4::: Use analogies from BBC BASIC V to start them in assembly language, at first just very simple stuff that just calls a SWI and then returns, then add loading and storing to/from memory/registers.

5::: Slowly nudge them into using the flow control and translating the BBC BASIC V expressions into a sequence of assembly instructions (Remember integers are probably more natural for them than floating point so stick with the integer unit for now). They may stumble a little with division :) though you will be surprised how much they enjoy knowing that they are getting the computer to do what they want with something close to its own language.

And before you know it they will be writing programs entirely in ARM Assembly.

I also thinks that this helps to explain my earlier statement about BBC BASIC being a good stepping stone into Assembly.
ARM Assembly Language: For those that want: Simple, Powerful, Easy to learn, and Easy to debug.
User avatar
Posts: 1251
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
by dextrus » Sun Feb 03, 2013 12:40 am
What you are describing is a scenario that a personal tutor, and expert, one-on-one with a student might be able to achieve. In a classroom scenario, things are so different. I won't even begin to explain but I'm sure you must have an inkling of the problems associated with teaching more than one person at a time, in a subject they might not be interested in for whatever reason.

I'm firmly in the "pretty pictures" camp, but with strings attached.

/Dextrus

DavidS wrote:
pygmy_giant wrote:What specifically did you teach them and what resources did you use? I would be interested to know as it could remove some of my fears as a 36 year old.


It is quite simple:
1::: Get them into BBC BASIC V to where they have a usable understanding of Variables, Scope, Flow control, etc.

2::: A little bit at a time get them to start replacing the built in BBC BASIC V commands with equivalent SYS calls, and in the process slowly introduce them to the concept of indirection (eg Pointers).

3::: Build on this until they are only using BBC BASIC statements for flow control, and managing variables. Then slowly step them into building WIMP based multitasking applications.

4::: Use analogies from BBC BASIC V to start them in assembly language, at first just very simple stuff that just calls a SWI and then returns, then add loading and storing to/from memory/registers.

5::: Slowly nudge them into using the flow control and translating the BBC BASIC V expressions into a sequence of assembly instructions (Remember integers are probably more natural for them than floating point so stick with the integer unit for now). They may stumble a little with division :) though you will be surprised how much they enjoy knowing that they are getting the computer to do what they want with something close to its own language.

And before you know it they will be writing programs entirely in ARM Assembly.

I also thinks that this helps to explain my earlier statement about BBC BASIC being a good stepping stone into Assembly.
Have more FUN with your Pi. Visit www.pi-fun.com
Posts: 119
Joined: Tue Jan 24, 2012 10:10 pm
Location: Eastleigh, Hampshire
by gritz » Sun Feb 03, 2013 1:38 am
My answer would be to stop geeks having any access to the front office...

No-one in the real world cares if a particular recursive test runs 0.02 seconds quicker in RISCOS than in Debian. They just want to realise what's in their imagination. Perhaps a better benchmark might include all the hours that one spends resisting the urge to toss the computer out of the window because it's just so stupid, unintuitive and designed by idiots.

If formal languages were all that then we'd still be speaking (and texting and twittering) in Latin. And let's not forget that the qwerty keyboard was specifically designed over 100 years ago as an artifice to slow down human input and prevent mechanical issues. Dogma, just dogma.

Imagine for a moment that children could not be taught, but instead had to be programmed. Discovery would stop and new ideas would only happen because of accidental mutations, or because the existing ideas were so dysfunctional that someone has to grudgingly include some new parameters (albeit bounded by artifice, because the machine cannot cope with true variables).

This is where we are now and it's absolutely ridiculous. When I was a kid wrestling with computer science in the early 1980s I tolerated the status quo because all of the teachers were just old, but now there's no excuse. There seems to be no hunger to make better machines, because "faster but still stupid" seems to be acceptable. Meh.
Posts: 449
Joined: Sat Jan 28, 2012 2:33 am
by DexOS » Sun Feb 03, 2013 2:22 am
Heres someone that learn't assembly at 8
I started on a TRS-80 at the age of 5. No colour, no sound (without a hack to write to the tape drive to work like a speaker) so I worked on simple text manipulation programs with my dad.
Got a BBC Micro a couple of years later, and then started 6502 assembly aged 8 (learned 2-complement binary arithmetic doing sums in the sand on the beach in Spain) – this was back in 1982 …

Stood me in good stead for a career in computing – even if I didn’t learn C++ until I was in my 20s (and handicapped by having learned C first!)
http://herbsutter.com/2012/04/30/worlds-youngest-c-programmer/
Batteries not included, Some assembly required.
User avatar
Posts: 851
Joined: Wed May 16, 2012 6:32 pm
by jackokring » Sun Feb 03, 2013 2:33 am
BASIC can be useful for teaching, because the number of statement words to learn is small. Yes, GOTO is bad (considered as enabling unstructured programming), but it is simple to explain. Much of the immediate interest effect of media could be simple by having MEDIA <filename> as a language statement, along with the old favorite AT.

IF <filename> AT x,y THEN ... could be the basis for all collision detection, an essential for games.

LABEL <name> is enough to prevent the whole thing from turning into just number references. If a whole program can be treated as a kind of media for use by another program, then a very simplified introduction to objects and classes can be started without over complicating the language.

If your going to go as far as procedures and functions, then BASIC is perhaps not the best choice to continue in. Maybe each statement (or line) should have a calculated or returned value after it is run, which can be accessed (<filename> AT x,y,line) or some such, but then maybe it would have to return an array. It perhaps gives a new slant on what (or where) a variable is.
Pi=B256R0USB CL4SD8GB Raspbian Stock. https://sites.google.com/site/rubikcompression/strictly-long
User avatar
Posts: 748
Joined: Tue Jul 31, 2012 8:27 am
Location: London, UK
by DavidS » Sun Feb 03, 2013 11:37 am
@jackokring:
What BASIC do you use. Using line numbers as a reference whent out with the 8-bitters. Procedures are part of just about every BASIC out there now.

Take a look at BBC BASIC V (the one that comes with RISC OS), QBASIC (on DOS), FreeBASIC, QB64, TrueBASIC, XBASIC, etc.
ARM Assembly Language: For those that want: Simple, Powerful, Easy to learn, and Easy to debug.
User avatar
Posts: 1251
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
by pygmy_giant » Sun Feb 03, 2013 4:25 pm
Hey look - robot using RISC OS and BASIC: http://www.raspberrypi.org/phpBB3/viewtopic.php?f=37&t=32145&p=276855&hilit=robot#p276855

The builder says he chose that platform because it meant "I did not have to learn another programing language".

So BASIC has its uses and people are already familiar with it.
Posts: 1566
Joined: Sun Mar 04, 2012 12:49 am
by jackokring » Sun Feb 03, 2013 5:44 pm
DavidS wrote:@jackokring:
What BASIC do you use. Using line numbers as a reference whent out with the 8-bitters. Procedures are part of just about every BASIC out there now.


I use any BASIC suitable for the task (I think Amiga Blitz BASIC about the pinnacle, and VBA is more paid work practical currently). I'm not saying procedures are bad, what I am saying is procedures and local scoping are quite a lot for lesson 1. I found 81/spectrum BASIC easy to remember as it was written on the keys. Would I have preferred LOGO? The spectrum did not come with LOGO (but I read about it). Was I envious of FORTH's speed? It's not a practical consideration with today's machines (but I read about it). Did I learn Pascal? Yes, even though I had no machine to run it on, and Lazarus rose from the dead. I could not get SpecBAS to compile from source and have moved on to other things. As a general hobby project language I use Java, and switch to plain C for some things.

Today I'm familiar with parse trees and http://en.wikipedia.org/wiki/LR_parser, and have designed my own syntax and limited grammar language. BASIC is not my favourite semi-structured language.
Pi=B256R0USB CL4SD8GB Raspbian Stock. https://sites.google.com/site/rubikcompression/strictly-long
User avatar
Posts: 748
Joined: Tue Jul 31, 2012 8:27 am
Location: London, UK
by DavidS » Mon Feb 04, 2013 12:53 pm
While there are some advantages to tracing a tree in parsing, a recursive descent parser has a few advantags:
    1) It is a lot quicker to implement.
    2) It is a lot quicker, thus good for interpreters as well as compilers.
    3) Optimization can still be added.
    4) If needed you can easily translate to a tree parser later.
ARM Assembly Language: For those that want: Simple, Powerful, Easy to learn, and Easy to debug.
User avatar
Posts: 1251
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
by DavidS » Mon Feb 04, 2013 12:58 pm
Perhaps it is time to begin a thread on compiler design? It is part of CS so I feel hat it is a topic that needs to be addressed for the RPi.
ARM Assembly Language: For those that want: Simple, Powerful, Easy to learn, and Easy to debug.
User avatar
Posts: 1251
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
by jackokring » Mon Feb 04, 2013 5:00 pm
If you have never studied BASIC before and are looking for your first structured compiled application language, you could do much worse than free pascal a.k.a. lazarus. http://www.raspberrypi.org/phpBB3/viewtopic.php?f=34&t=7422. It takes a little getting used to the GUI, and I understand that fp from the command line opens an old style text programming environment. Turbo Pascal was good, and in this risen incarnation is still excellent.

Java is more difficult to get off the ground so to speak,and takes more memory resources, especially with eclipse. You may think, you'd miss out on object orientation programming, but UNITs are just as effective when nested functionality is considered (this is how objects are internally modeled). The consistency of Pascal puts BASIC to shame. Don't forget the Pascal command FORWARD, as names or identifiers have to be defined before use (written earlier in the serial program before used).

If '80s computers had come with lazarus, BASIC would have been a joke. It does make the simplest program a little more complicated, but having a form designer in lazarus is very helpful for teaching people, and it's also good for individual style art. Having said that it does make the more complicated programs much simpler.
Pi=B256R0USB CL4SD8GB Raspbian Stock. https://sites.google.com/site/rubikcompression/strictly-long
User avatar
Posts: 748
Joined: Tue Jul 31, 2012 8:27 am
Location: London, UK
by gordon@drogon.net » Mon Feb 04, 2013 5:06 pm
jackokring wrote:If '80s computers had come with lazarus, BASIC would have been a joke. It does make the simplest program a little more complicated, but having a form designer in lazarus is very helpful for teaching people, and it's also good for individual style art. Having said that it does make the more complicated programs much simpler.


80's computers came with UCSD Pascal. I did a lot of work on the Apple II with that. I disliked Pascal once I'd had experience with C though.

-Gordon
--
Gordons projects: https://projects.drogon.net/
User avatar
Posts: 1421
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK