User avatar
[email protected]
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 9:17 pm

Fascinating :)

I've dipped in & out of this thread for some time now - it's been going for over a year now! Seems to have quickened pace in the past few weeks, Yet, here we are, still talking about BASIC. It's obviously not going away. It'll never die. Hurrah for BASIC, I say ;-)

Anyway, I'm biased - I started with BASIC, but I had good teachers and went on to learn FORTRAN, IMP77 (an algol-like high level language), then Pascal, COBOL, C, BCPL, many different assemblers, dabbled with prolog, occam, c++ and so on.. And a year ago I wrote a BASIC interpreter (in C) - I wasn't initially aiming it at the Pi, but as I do all my work under Linux, it "just worked" on the Pi without any issues - and I've subsequently added some "Pi Stuff" into it like GPIO handling.

So BASIC didn't do me any harm!

(But if I'd started with Python/C/Pascal would I want to write my own Python/C/Pascal interpreter? Probably not!)

The one thing that I don't think anyone has mentioned is not the actual language but the "entry level" to it. BASIC: I can turn on my Sharp PC-1211, Apple II or BBC Micro and be in BASIC in about a second. It takes 5 seconds to boot into my BASIC on a Pi. (which I'm a little sad about, but there is one heck of a lot more to do on a Pi to make it usable, so I'll give it that) Now, I don't know if I can boot a Pi into an interactive Python in the same time nor what capabilities it has (can you write programs in it's 'shell' - does it have a 'shell' of sorts? but I suspect I'd really need to boot the Pi fully, start X, open a terminal, start an editor and so on to do anything more than a 1-liner. In BASIC you can just go ahead and write programs, save them, run them.

Seeing the joy on someone face when they make a program print their name is amazing!

Anyway, it's a dreary Saturday evening and I'll do some of the stuff that was posted a few days ago - some examples based on earlier ones:

Calculate the day of week? Well that was one of the earliest programs I ever wrote in BASIC - don't see why it's non-trivial at all. Don't they teach Zellers congruence anymore?

Code: Select all

DIM weekdays$(7)
FOR i = 0 TO 6 CYCLE 
  READ weekdays$(i)
REPEAT 

PRINT "Weekday calculator"
INPUT "Day   ? ", day
INPUT "Month ? ", month
INPUT "Year  ? ", year
weekday = FN zeller(day, month, year)
PRINT day;  "/";  month;  "/";  year;  " is ";  weekdays$(weekday)
END 

DEF FN zeller(day, month, year)
LOCAL t1, t2, t3, t4
IF month < 3 THEN 
  year = year - 1
  month = month + 12
ENDIF 
t1 = INT (((month + 1) * 26) / 10)
t2 = INT (year / 4)
t3 = INT (year / 100)
t4 = INT (year / 400)
 = (day + t1 + year + t2 + 6 * t3 + t4) MOD 7
DATA "Saturday", "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday"
Image
It gets today right (Saturday) and it got my birthday right (Monday) It's good for any Gregorian date.

Boxes: I'm not sure what the circle is doing there, but:

Code: Select all

HGR
COLOUR = 0
CYCLE 
  RECT (40 + COLOUR * 20, 80 + COLOUR * 20, 60, 40, TRUE)
  COLOUR = COLOUR + 1
REPEAT UNTIL COLOUR = 16
COLOUR = Pink
CIRCLE (360, 150, 150, TRUE)
END 
Image
Rectangles in RTB take a width and height rather than a 2nd XY coordinate. The "TRUE" means filled. The circle is x,y, radius, filled.

RTB supports a simplified colour scheme, either numbers 0-15, or the usual names (like Pink here) as well as the full RGB type colours. And I've just realised that a feature of my parser doesn't let me use system variables in a for loop. I feel that I ought to be able to do:

Code: Select all

FOR COLOUR = Black TO White CYCLE
that's now irritating me, so I might fix that...

The third example, oh well, if you insist:

Code: Select all

DIM ages(100)
FOR i = 0 TO 100 CYCLE 
  ages(i) = -1
REPEAT 

ages("Sue") = 23
ages("Peter") = 19
ages("Andrew") = 78
ages("Karen") = 45

PRINT "The dictionary has ";  FN counter(ages(), 100);  " entries in it."
PROC finder("Sue")
PROC finder("Gordon")
END 

DEF FN counter(arr(), n)
LOCAL i, c
c = 0
FOR i = 0 TO n CYCLE 
  IF arr(i) <> -1 THEN c = c + 1
REPEAT 
 = c

DEF PROC finder(who$)
IF ages(who$) <> -1 THEN 
  PRINT who$;  " is in the dictionary. Age: ";  ages(who$)
ELSE 
  PRINT who$;  " is not in the dictionary."
ENDIF 
ENDPROC 
Image

OK. It's not complete as RTB doesn't have key access to the associative arrays (hey, it is BASIC afterall ;-) but I could print them out the same way I count them - that's the only reason for the -1 marker. I only added associative arrays into it as a challenge from a friend. He actually wanted me to put a sqLite module into it, but I declined...

So there you are - just another BASIC - it's not /the/ BASIC (what is?) it's not ANSI BASIC (who can afford to buy the ANSI specification document?) but it's my BASIC, I wrote it as a personal project and it works for me.

(And just FYI: The examples above are done without line numbers, but when they're loaded in, they get line numbers starting at 1 - if nothing else when you get an error, it gives you the line number in the editor to look for. I'll occasionally renumber a program once loaded to do some trivial changed to it, then save it again without line numbers, whereupon it'll be renumbered from 1 by 1 when its next loaded)

I've watched and helped some kids use it. Fantastic. See their faces light up when they do simple things. Easy introduction to the concept of programming using turtle graphics too - just typing in:

Code: Select all

hgr
pendown
move(100)
right (90)
move(100)
right (90)
move(100)
right (90)
move(100)
right (90)
then show them how to "record" it by putting line numbers it front, then they can run it many times, then introduce them to variables and make it repeat and before you know it, they're drawing flowers. (it supports "clock" angles too if they are not good with degrees but can read an analog clock - right(15) rather than right(90)

So there you go. Personally I think BASIC is a good and easy way into computing. (but not BASIC with arcane 'vdu', 'sys $foobarWimpGrot' stuff in it, nor peek or poke!) Give a class of kids some easy access, then you can very quickly weed out the ones that just don't have the "knack" without boring them to the point of disruption, and for those who do "get it", take them onto bigger and better things. I do not think BASIC is a "production" language - certianly not this form of BASIC anyway, but in ye olde days we did write huge packages in the various BASICs and it did mutate into who knows what in the commercial sector. (VB and the like) I would not suggest using any BASIC today for a commercial project, but as an easy intro into computing? I'd use BASIC every time.

-Gordon

Ps. Disk based binary tree file handling: http://unicorn.drogon.net/rtb/animals.rtb
--
Gordons projects: https://projects.drogon.net/

tufty
Posts: 1456
Joined: Sun Sep 11, 2011 2:32 pm

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 9:17 pm

rurwin wrote:All I said was that in a weekend (maybe for those with some programming experience) or a week (maybe for those without) of intensive training, teachers could learn BASIC sufficiently to be confident to teach it, an d that could not be done using Python.
They could learn the bits that BASIC can do :)
rurwin wrote:to teach kids, we need teachers, and teachers do not have the time to spend a month off learning Python, or Lisp.
To teach any subject properly, the teachers need to be properly trained in that subject. That's why PE teachers don't "fill in" for the maths department. And it's why letting untrained but enthusiastic teachers of any kind loose with (or, even worse, without) a CS curriculum is a really bad idea.

pygmy_giant
Posts: 1562
Joined: Sun Mar 04, 2012 12:49 am

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 9:25 pm

Well done Gordon!

However, until the primary / secondary school curriculum makers stamp their approval on a specific language this is all just pointless conjecture.

If they choose Lua or SmallTalk we'll all look daft.

If I were the Foundation I would be lobbying hard for Python (as that is their preference).

This whole enterprise can have no direction until that happens.

If/once it does the Foundation needs to be ready to step in supported by readily available teaching resources.

I believe there is currently a secondary school CS curriculum based on BASIC-like psuedo code - is that correct?

User avatar
danpeirce
Posts: 100
Joined: Thu May 10, 2012 8:32 am
Location: Richmond & Surrey BC Canada
Contact: Website

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 9:37 pm

DavidS wrote:
danpeirce wrote:Amazing; except, what does that mean? If teachers can be taught to be programmers in days why is Eben saying universities are not getting competent applicants and that we need people with thousands of hours of programming experience behind them?
I do not know why there is a lack of qualified university applicants. I do not understand why most of the younger generation does not have any interest in these things.

Though it is obvious why there is a need for at least 20000 hours of programming experience, doing it correctly. This builds the correct habits and makes sure that there is good full understanding.
Yet you think a teacher could have a deep enough understanding after three days to teach programming? Looks to me like you are contradicting yourself.

User avatar
DavidS
Posts: 3801
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 9:48 pm

@gordon:
Nice job. That looks a lot like BBC BASIC V. Though they are not needed for beginers, please do tell me that you did include support for SYS and pointers? So that it can be a completely usable language. And do you plan on making it suport standard "FOR TO STEP : : NEXT " loops, and "WHILE ENDWHILE" and "LOOP UNTIL" BASIC style loops? Other than this it is very close to BBC BASIC.
RPi = Way for me to have fun and save power.
100% Off Grid.
Household TTL Electricity Usage = 1.4KW/h per day.
500W Solar System, produces 2.8KW/h per day average.

User avatar
DavidS
Posts: 3801
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 9:50 pm

@danpeirce:
I do not think that they could have a deep enough understanding to teach. I do think that they could have a good understanding of the language, at least enough to start writing programs and gaining enough experience to get a eep enough understanding to teach kids.
RPi = Way for me to have fun and save power.
100% Off Grid.
Household TTL Electricity Usage = 1.4KW/h per day.
500W Solar System, produces 2.8KW/h per day average.

User avatar
[email protected]
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 10:18 pm

DavidS wrote:@gordon:
Nice job. That looks a lot like BBC BASIC V. Though they are not needed for beginers, please do tell me that you did include support for SYS and pointers? So that it can be a completely usable language. And do you plan on making it suport standard "FOR TO STEP : : NEXT " loops, and "WHILE ENDWHILE" and "LOOP UNTIL" BASIC style loops? Other than this it is very close to BBC BASIC.
What does SYS do? (ie. I don't have a "SYS", but if you tell me what it does, or what you think it's supposed to do, then I can include it)

Pointers... What would they point to? There is no peek & poke for direct memory access... it runs under Linux/Mac (& Win when I do the cross compile), so that concept doesn't really make sense here... I never really designed it to be like the microprocessor BASICs of old...

You can fetch the current reference manual from here: http://project-downloads.drogon.net/rtb/rtb.pdf

chapter 13 ...but It has just one looping construct: cycle...repeat.

which can be modified with for/while/until. while and until can be at the top or the bottom of the loop, but for must be at the top.

for i = 1 to 10 step 2 cycle
...
repeat

until a = 7 cycle
...
repeat

while a = 7 cycle
...
repeat

cycle
...
repeat until a = 7

cycle
...
repeat while a = 7

break and continue are supported too.

-Gordon
--
Gordons projects: https://projects.drogon.net/

User avatar
danpeirce
Posts: 100
Joined: Thu May 10, 2012 8:32 am
Location: Richmond & Surrey BC Canada
Contact: Website

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 10:49 pm

rurwin wrote:... but we have to be pragmatic; to teach kids, we need teachers, and teachers do not have the time to spend a month off learning Python, or Lisp. A weekend or a week might be manageable.
I fear that without full in commitment from teachers this will fail and programming will once again drop out of sight in most schools. Most primary teachers will not commit the same sort of time to programming as some of the students and they will quickly feel inadequate. They will think why teach this when the students know it better than I do. At least at the secondary level the teachers are less generalists than in primary school. Some can pick it up and others stick to what they are good at.

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4249
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 10:54 pm

That's a very nice language, Gordon. Congratulations.

I believe on RiscOS, SYS is a OS function call, like the INT calls in good old MS-DOS. There's no clear equivalent on Linux, which has multiple vectors into the OS and where the GUI is in user-space.

(BTW: DavidS, you can take the entire puts call out of your calculations; write(2) is a direct OS call with effectively the same functionality.)

gritz
Posts: 449
Joined: Sat Jan 28, 2012 2:33 am

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 11:14 pm

DavidS wrote:@danpeirce:
I do not think that they could have a deep enough understanding to teach. I do think that they could have a good understanding of the language, at least enough to start writing programs and gaining enough experience to get a eep enough understanding to teach kids.
I'm sure that Michael Gove (the UK government's Secretary of State for Education) would like this to be so, but c'mon! Many (if not all) of us will have crossed paths with inspirational teachers in our youth and I'm with tufty - it takes far more than just "tally-ho" style enthusiasm. A teacher has to be really comfortable with a subject and be able to improvise with a concept in maybe thirty subtly different forms, or the kids will find him / her out. There's no place to hide, especially when it comes to teaching a science.

I'm also with pygmy_giant - until there's some clue as to the form of the curriculum then all of ^^this^^ is just speculation / flag waving for one's particular lingo / dialect of choice. I can't help feeling that to "normal people" (y'know - the kind of people that this whole computer education inclusivity thing is aimed at), it all must look painfully naff. It's not exactly a great advert for getting involved in computer science, is it?

Anyway, consider our teacher: not only will they need a *suitable* degree of fluency in whatever language(s), but they will need (assuming classrooms of Pi in some form) a degree of comfort with Linux and terminal - because you can bet that the majority of their pupils won't have experienced this environment before. It's easy to forget how different the Linux way of doing things is - until you e.g. read posts from newbies on this forum regarding permissions / directory structures, how to install and run stuff and all the other things that we all regard as trivial. Rows of Pi in a classroom environment do offer the possibility however of offering an integrated OS and suite of tools that "just work", rather than the "fits where it touches" model of the last two decades. One can hope...

Those rows of GPIO also suggest that our teacher will also need to learn (in three days) about hardware interfacing. I think that the Pi's greatest strength as a teaching tool is it's ability to lend physical form to lines of drab code. Again, until there's an actual curriculum then it's all just speculation, but doubtless it's gonna be more than binking an LED. Again, this forum demonstrates that many gifted programmers can be absolutely bamboozled by electricity.

And who's going to administer all these classrooms full of Pi and attendant hardware? Remember that we're already paying for acres of PCs in schools that are criminally under utilised because of a lack of will, understanding and full time technical backup. Or do we expect that our hapless teacher will also undertake the task of administering the local Pi network and all the backing up / SD card writing / updates/ troubleshooting, etc. that this will entail?

Someone's got to figure all this stuff out and sell it to a bunch of accountants. Suddenly twenty-two pages of hand-wringing over GOTO looks trivial and self-indulgent. Hats off to the men and women who are actually going to teach this stuff, I say...

pygmy_giant
Posts: 1562
Joined: Sun Mar 04, 2012 12:49 am

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 11:58 pm

No biggie.

The teachers can learn along with the kids as long as they keep one lesson ahead.

The teaching resources need to be hot though.

User avatar
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: BASIC - more harmful than useful?

Sun Jan 27, 2013 12:30 am

@Gordon, great work.
Batteries not included, Some assembly required.

User avatar
DavidS
Posts: 3801
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: BASIC - more harmful than useful?

Sun Jan 27, 2013 12:36 am

[email protected] wrote:
DavidS wrote:@gordon:
Nice job. That looks a lot like BBC BASIC V. Though they are not needed for beginers, please do tell me that you did include support for SYS and pointers? So that it can be a completely usable language. And do you plan on making it suport standard "FOR TO STEP : : NEXT " loops, and "WHILE ENDWHILE" and "LOOP UNTIL" BASIC style loops? Other than this it is very close to BBC BASIC.
What does SYS do? (ie. I don't have a "SYS", but if you tell me what it does, or what you think it's supposed to do, then I can include it)
On BBC BASIC V SYS makes a direct SWI call to the OS, on other OSes it would have to implement the apropriate method of making a direct system call.
Pointers... What would they point to? There is no peek & poke for direct memory access... it runs under Linux/Mac (& Win when I do the cross compile), so that concept doesn't really make sense here... I never really designed it to be like the microprocessor BASICs of old...
Pointers are needed for Linked lists, tree, and many many other things.
You can fetch the current reference manual from here: http://project-downloads.drogon.net/rtb/rtb.pdf

chapter 13 ...but It has just one looping construct: cycle...repeat.

which can be modified with for/while/until. while and until can be at the top or the bottom of the loop, but for must be at the top.

for i = 1 to 10 step 2 cycle
...
repeat

until a = 7 cycle
...
repeat

while a = 7 cycle
...
repeat

cycle
...
repeat until a = 7

cycle
...
repeat while a = 7

break and continue are supported too.

-Gordon
Yes I whas thinking with the large amount of documentation preexisting for BBC BASIC if you made a couple of little tweeks to the loops to be more BASIC like it could be an advantage for those that already use BBC BASIC to use it to teach there kids.
RPi = Way for me to have fun and save power.
100% Off Grid.
Household TTL Electricity Usage = 1.4KW/h per day.
500W Solar System, produces 2.8KW/h per day average.

User avatar
DavidS
Posts: 3801
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: BASIC - more harmful than useful?

Sun Jan 27, 2013 12:39 am

rurwin wrote:That's a very nice language, Gordon. Congratulations.

I believe on RiscOS, SYS is a OS function call, like the INT calls in good old MS-DOS. There's no clear equivalent on Linux, which has multiple vectors into the OS and where the GUI is in user-space.

(BTW: DavidS, you can take the entire puts call out of your calculations; write(2) is a direct OS call with effectively the same functionality.)
Thank you very much. I whas just attempting to make it completely ANSI C.
RPi = Way for me to have fun and save power.
100% Off Grid.
Household TTL Electricity Usage = 1.4KW/h per day.
500W Solar System, produces 2.8KW/h per day average.

User avatar
danpeirce
Posts: 100
Joined: Thu May 10, 2012 8:32 am
Location: Richmond & Surrey BC Canada
Contact: Website

Re: BASIC - more harmful than useful?

Sun Jan 27, 2013 12:42 am

gritz wrote:...it takes far more than just "tally-ho" style enthusiasm. A teacher has to be really comfortable with a subject and be able to improvise with a concept in maybe thirty subtly different forms, or the kids will find him / her out. There's no place to hide, especially when it comes to teaching a science.
good points
gritz wrote: I'm also with pygmy_giant - until there's some clue as to the form of the curriculum then all of ^^this^^ is just speculation / flag waving for one's particular lingo / dialect of choice. I can't help feeling that to "normal people" (y'know - the kind of people that this whole computer education inclusivity thing is aimed at), it all must look painfully naff. It's not exactly a great advert for getting involved in computer science, is it?
The board itself and the sales of it are impressive accomplishments of the Raspberry Pi foundation. Big curriculum is not normally developed by little npos and it is not going to happen over night. I don't think anyone needs to be embarrassed about that.
gritz wrote: Anyway, consider our teacher: not only will they need a *suitable* degree of fluency in whatever language(s), but they will need (assuming classrooms of Pi in some form) a degree of comfort with Linux and terminal - because you can bet that the majority of their pupils won't have experienced this environment before. It's easy to forget how different the Linux way of doing things is - until you e.g. read posts from newbies on this forum regarding permissions / directory structures, how to install and run stuff and all the other things that we all regard as trivial. Rows of Pi in a classroom environment do offer the possibility however of offering an integrated OS and suite of tools that "just work", rather than the "fits where it touches" model of the last two decades. One can hope...
It has been said all along there would be kits developed so one would not have to purchase all of the accessories separately.
gritz wrote: Those rows of GPIO also suggest that our teacher will also need to learn (in three days) about hardware interfacing. I think that the Pi's greatest strength as a teaching tool is it's ability to lend physical form to lines of drab code. Again, until there's an actual curriculum then it's all just speculation, but doubtless it's gonna be more than binking an LED. Again, this forum demonstrates that many gifted programmers can be absolutely bamboozled by electricity.
The list of third party products that can plug into the port are growing. The USB could potentially be more useful for easy plug and play (and everyone knows how to plug in USB cords these days. A bluetooth turtle robot could be a good product.
gritz wrote: And who's going to administer all these classrooms full of Pi and attendant hardware? Remember that we're already paying for acres of PCs in schools that are criminally under utilised because of a lack of will, understanding and full time technical backup. Or do we expect that our hapless teacher will also undertake the task of administering the local Pi network and all the backing up / SD card writing / updates/ troubleshooting, etc. that this will entail?

Someone's got to figure all this stuff out and sell it to a bunch of accountants. Suddenly twenty-two pages of hand-wringing over GOTO looks trivial and self-indulgent. Hats off to the men and women who are actually going to teach this stuff, I say...
Yes, and to anyone who moves this all forward. It really is a grand big idea.

User avatar
DavidS
Posts: 3801
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: BASIC - more harmful than useful?

Sun Jan 27, 2013 12:47 am

@gritz:
I personally agree that the good teachers, the ones that realy get the kids into programming are going to be the ones tht love to program already. The trouble is how many are there? I am worried that fulfill the best ase requirements would require first raising a new generation of instructors that have this interest and are nurtured in this interest, and are probably between 6 and 10 years old today. How long do we have to make the transition? And who is going to nurture there interest? We end up with a chicken and egg scenario.

Also as I have pointed to many times I would personally recommend something more like Pascal for a kids first structured procedural language.

But tis thread is about BASIC and there is nothing wrong with BASIC.
RPi = Way for me to have fun and save power.
100% Off Grid.
Household TTL Electricity Usage = 1.4KW/h per day.
500W Solar System, produces 2.8KW/h per day average.

pygmy_giant
Posts: 1562
Joined: Sun Mar 04, 2012 12:49 am

Re: BASIC - more harmful than useful?

Sun Jan 27, 2013 12:56 am

So thanks to Gordon Raspbian Linux now has BASIC.

RISC OS also now has Smalltalk, Squeak and Scratch.

If someone ported the old RISC OS Python to the PI then we could all have all the beginner languages on both platforms.

That could only be a good thing.

User avatar
DavidS
Posts: 3801
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: BASIC - more harmful than useful?

Sun Jan 27, 2013 1:09 am

And it seems that once again people are attempting to limit the options to Linux and Linux.

Do the fallowing ecxperiment (I have a couple of times):
FIRST:
Take a small group of children that have never touched a computer before in there life, teach them to use a well set up Linux where everything is point and click (eg with KDE or GNOME etc). Then teach them to program on Linux(choose what ever language you feel best suites the job). Keep a complete record of the dificulties in teaching them and the time to goal for each step of the way.
NEXT:
Take a small group of children (try to keep the educational level the same as the above group) that have never touched a computer in there lives and teach them to use RISC OS, then teach them to program on RISC OS using the same programming language used for the Linux group. Keep a complete set of records of the dificulties in teaching them and of the time to goal for each step of the way.
It is ver important herein that your enthuasium for teaching each is equal (you know how kids are they pick up on it).
NEXT:
Compare the results.

After doing this (and adding to it for any other OS that you feel is apropriate), then decide what OS is best suited to teaching the kids. It seems to be jumping the cart in front of the horse for the Raspberry Pi foundation, or any one else to be making any recommendations of what Operaing System hould be used in an educational enviroment withe Elementry School kids before doing these simple tests enough times to have a reliable pool of data to make a well informed decision based on experimentl results. And this kind of experiment does not take much time.

Also do simulare experiments to determine which Programming Language best suites the purpose for very young Elementry School students.
RPi = Way for me to have fun and save power.
100% Off Grid.
Household TTL Electricity Usage = 1.4KW/h per day.
500W Solar System, produces 2.8KW/h per day average.

gritz
Posts: 449
Joined: Sat Jan 28, 2012 2:33 am

Re: BASIC - more harmful than useful?

Sun Jan 27, 2013 1:18 am

Hi Dan, I've been enjoying your input as you seem to have a rare handle on the whole "laypeople and the damned computer" conundrum.
danpeirce wrote:
gritz wrote: Anyway, consider our teacher: not only will they need a *suitable* degree of fluency in whatever language(s), but they will need (assuming classrooms of Pi in some form) a degree of comfort with Linux and terminal - because you can bet that the majority of their pupils won't have experienced this environment before. It's easy to forget how different the Linux way of doing things is - until you e.g. read posts from newbies on this forum regarding permissions / directory structures, how to install and run stuff and all the other things that we all regard as trivial. Rows of Pi in a classroom environment do offer the possibility however of offering an integrated OS and suite of tools that "just work", rather than the "fits where it touches" model of the last two decades. One can hope...
It has been said all along there would be kits developed so one would not have to purchase all of the accessories separately.
I was really musing on the operating system and software environment, rather than hardware. I feel that if we're going to instill best practice then what better place to start than with an environment that's a transparent interface between the hardware and the applications that the pupils are using? An educational Pi and it's attached hardware really suggests the opportunity for an environment that's really transparent, as opposed to exposing another generation to over reliance on commandline dogma and a lack of quality control, customer focus and all the other ropey stuff that we put up with for the sake of "free".
danpeirce wrote:
gritz wrote: Those rows of GPIO also suggest that our teacher will also need to learn (in three days) about hardware interfacing. I think that the Pi's greatest strength as a teaching tool is it's ability to lend physical form to lines of drab code. Again, until there's an actual curriculum then it's all just speculation, but doubtless it's gonna be more than binking an LED. Again, this forum demonstrates that many gifted programmers can be absolutely bamboozled by electricity.
The list of third party products that can plug into the port are growing. The USB could potentially be more useful for easy plug and play (and everyone knows how to plug in USB cords these days. A bluetooth turtle robot could be a good product.
If your Bluetooth Turtle comes with exhaustive documentation and an excellent software development kit then definitely! I'm a firm believer in "bootstrapping" - arduino didn't become a success simply because of it's "free and open source-ness" - it has become a success because it became a standard that commercial ventures decided was worth supporting. Many people will be aware of companies such as Adafruit. Smart and passionate folks like Ladyada are essential to making these kind of ventures work imo because they appreciate the importance of making knowledge inclusive, attainable and as free from geekspeak as possible. This stuff matters because not all of us are very good at deciphering 733t documentation, or figuring out the exact value that a certain resistor should be...
danpeirce wrote:
gritz wrote: And who's going to administer all these classrooms full of Pi and attendant hardware? Remember that we're already paying for acres of PCs in schools that are criminally under utilised because of a lack of will, understanding and full time technical backup. Or do we expect that our hapless teacher will also undertake the task of administering the local Pi network and all the backing up / SD card writing / updates/ troubleshooting, etc. that this will entail?

Someone's got to figure all this stuff out and sell it to a bunch of accountants. Suddenly twenty-two pages of hand-wringing over GOTO looks trivial and self-indulgent. Hats off to the men and women who are actually going to teach this stuff, I say...
Yes, and to anyone who moves this all forward. It really is a grand big idea.
It is a grand idea and knowing our mean-minded, penny-pinching governments (of all persuasions) it will take no little doggedness to bring it to fruition. :lol:

pygmy_giant
Posts: 1562
Joined: Sun Mar 04, 2012 12:49 am

Re: BASIC - more harmful than useful?

Sun Jan 27, 2013 1:47 am

I suppose spending £50 on a Pi+case+SD for each student in a class is no more than the average for a bunch of books - and this is a computer that they can do homework on at home and hardware experiments with at school.

I agree its going to be a hard sell as most UK schools these days are teched up to the eyeballs and will be asking themselves "more computers? don't we just need some software and books?"

I think the Pi could really score in the developing world which is not over-saturated with technology.

gritz
Posts: 449
Joined: Sat Jan 28, 2012 2:33 am

Re: BASIC - more harmful than useful?

Sun Jan 27, 2013 2:05 am

pygmy_giant wrote: I think the Pi could really score in the developing world which is not over-saturated with technology.
The UK is the developing world. Everywhere is saturated with tech.

User avatar
rpdom
Posts: 14138
Joined: Sun May 06, 2012 5:17 am
Location: Chelmsford, Essex, UK

Re: BASIC - more harmful than useful?

Sun Jan 27, 2013 9:36 am

[email protected] wrote:The one thing that I don't think anyone has mentioned is not the actual language but the "entry level" to it. BASIC: I can turn on my Sharp PC-1211, Apple II or BBC Micro and be in BASIC in about a second.
Hmm, I remember my first decent computer - a Sharp MZ-80K - took quite a few minutes to get BASIC loaded from tape. It did have the advantage that you could also load other languages, or even assembled programs that ran without an interpreter. I once wrote a crude audio sampler program that used the built-in cassette tape drive to sample a (very) rough PWM and play it back through one of the pins on the printer interface. The program was about 720 bytes long and used all 48K of main memory plus the 1Kof video memory to store up to 50 seconds of what I can only descibe as awful noise ;)

There were several versions of BASIC for that machine, as well as the official one. One of them allowed extensions to be added. It just took a few days work with a pencil, lots of paper and a copy of "Programming the Z80" to work out the bytes to be added :)

User avatar
[email protected]
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: BASIC - more harmful than useful?

Sun Jan 27, 2013 11:20 am

[email protected] wrote:
DavidS wrote:@gordon:
Nice job. That looks a lot like BBC BASIC V. Though they are not needed for beginers, please do tell me that you did include support for SYS and pointers? So that it can be a completely usable language. And do you plan on making it suport standard "FOR TO STEP : : NEXT " loops, and "WHILE ENDWHILE" and "LOOP UNTIL" BASIC style loops? Other than this it is very close to BBC BASIC.
What does SYS do? (ie. I don't have a "SYS", but if you tell me what it does, or what you think it's supposed to do, then I can include it)
DavidS wrote:On BBC BASIC V SYS makes a direct SWI call to the OS, on other OSes it would have to implement the apropriate method of making a direct system call.
OK. Think I get it now. There is really no direct equivalent in RTB under Linux. I remember the old *fx (osbyte) commands on the Beeb and Arc and from what I recall, they were really there to overcome shortcomings in the system (and not through choice either, I suspect) - ie. we were dealing with a memory starved system where commands have to be terse, so you end up with one command being overloaded to perform 100 other duties. I've had a quick look through the forums here for examples - found some in the Gertboard section:

Code: Select all

SYS "GPIO_WriteData" ,b%(led%),1
So here is SYS being used to overcome a language limitation. In RTB, this is simply:

Code: Select all

digitalWrite (led,1)
but only because I chose to extend the language with my wiringPi library - I wasn't restricted by space issues, so it was trivial to add this in.

A "system call" in *nix land is really a call to something direcly implemented by the kernel - e.g. open/read/write/close, etc. anything in section 2 of the manual... (type man 2 syscalls for the list under Linux!) so while I could implement a generic syscall mechanism, do you really want to call e.g. inotify_add_watch from a BASIC program?

There's also no "mode" or "vdu" commands in RTB either - primarilly as it uses the underlying native screen and doesn't want to change it - however it's using SDL (which pyGame uses), so can run either native in the console, or inside an X window (or on a Mac, or when I get round to it under MS Windows)

I did think of adding in a system() call - ie. the same as system() or popen() in C and other languages - launch another program and optionally capture its output, but I felt that's going too far for BASIC.
Pointers... What would they point to? There is no peek & poke for direct memory access... it runs under Linux/Mac (& Win when I do the cross compile), so that concept doesn't really make sense here... I never really designed it to be like the microprocessor BASICs of old...
Pointers are needed for Linked lists, tree, and many many other things.
Sure, but then you need data structures, then you need a "new" construct to create storage space, then ... And this is BASIC, not C, php, pascal, pyhon, etc. I suppose you could simulate them with multi-dimensional arrays (any index can be a string too, so names(), could have names ("gordon","age") = 50 and build it from there. We're also running in a VM environment, so peek and poke aren't going to be useful - no direct access to the hardware (other than via wiringPi and additional functions)

So it's a basic BASIC. Use it to get people interested and used to writing, storing, etc. stuff with computers, learn about variables, arrays, procedures and functions. touch on local vs. global variables and even recursion, then if they're keen, take them on to something more suitable rather than try bludgeon more and more features into one language/platform.

I'm of the opinion that it's the teacher and learning environment that's key here. I think I got lucky.

However, you can use RTB to sort of build up complex structures though - in random access files. See the animals.rtb example I posted earlier for a binary tree structure example. Maybe not the easiest thing to follow though :) (and I almost didn't bother with file operations at all... but random access files - there's another name for that now - nosql... well, almost ;-)

I did a lot of BCPL at one point too - if only the environment was easier to use - again early computer resources led to the contraints, I reckon, but BCPL on the BBC Micro - a brilliant stop-gap between a full-blown compiler system like C and a stage or 2 better than BBC Basic. I wrote a big distributed factory automation system in BCPL once - it ran over a dozen BBC Micros with a network filestore behind it...
Yes I whas thinking with the large amount of documentation preexisting for BBC BASIC if you made a couple of little tweeks to the loops to be more BASIC like it could be an advantage for those that already use BBC BASIC to use it to teach there kids.
I used BBC Basic as well as Apple II BASIC as an inspiration when I wrote RTB. My original desire was to write something I could re-run some of my old Apple II programs in! (anyone have an Apple II serial card they can sell/give/lend me?) Looping constructs always irritated me though. Why were they fixed the way they were? Why used different words for what was effectively the same thing? And it all goes back to what I touched on earlier - the "ground rules" were laid down in the days when we had resource-starved computers and we had to eek out every ounce of performance from them. (which I admire them for!) I think BASIC is the only language that has a "next" keyword on its for loop. I omitted it in favour of a unified cycle...repeat looping construct.

IMP77 was the first high-level structured language I learned - and I learned it from one of it's authors. It has some really nice constructs such as:

a = 5 unless b = 7

that's where I copied the cycle...repeat looping construct from too. And no-one told me I couldn't have while at the top or the bottom of a loop, similarly with until. So what I think I have is (a) something that pleases me, and (b) the principle of least surprise.

I loved programming the Apple II and (surprisingly?) to a lesser extent my BBC Micro (and Arc) but all those peek/poke/ !?$ fx, vdu, etc. commands sort of just got in the way. I think it's important to know that they existed - and why - but for today's modern world? I'm not convinced. I think we need something new, but I don't know what that might be. My fear is that we'll end up like: http://xkcd.com/927/

-Gordon
--
Gordons projects: https://projects.drogon.net/

User avatar
rurwin
Forum Moderator
Forum Moderator
Posts: 4249
Joined: Mon Jan 09, 2012 3:16 pm
Contact: Website

Re: BASIC - more harmful than useful?

Sun Jan 27, 2013 11:46 am

I've used a good many "BASIC"s in my day, that were stupidly far from the language we all know. In my previous job there was an embedded language that we called BASIC, but us engineers thought the software director had probably just copied all the keywords out of a manual and then implemented his own language using them.

Gordon, would it be possible to:
  • Make the CYCLE at the end of the FOR optional.
  • Rename CYCLE "DO".
  • Make DO (CYCLE) required syntax at the head of a loop, like REPEAT is at the tail of a loop.
  • Make "NEXT" a synonym of REPEAT, or even replace it.
  • Allow NEXT to take an optional variable that is matched to the opening FOR.
That would bring RTB more in line with other BASIC syntaxes and make it more orthogonal.

for i = 1 to 10 step 2
...
next i

do until a = 7
...
repeat

do while a = 7
...
repeat

do
...
repeat until a = 7

do
...
repeat while a = 7

User avatar
[email protected]
Posts: 2020
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website

Re: BASIC - more harmful than useful?

Sun Jan 27, 2013 1:18 pm

rurwin wrote:I've used a good many "BASIC"s in my day, that were stupidly far from the language we all know. In my previous job there was an embedded language that we called BASIC, but us engineers thought the software director had probably just copied all the keywords out of a manual and then implemented his own language using them.
Well he'd not be the first - and I've more or less done this myself in the past for some embedded little scripting test systems I've developed
rurwin wrote: Gordon, would it be possible to:
  • Make the CYCLE at the end of the FOR optional.
  • Rename CYCLE "DO".
  • Make DO (CYCLE) required syntax at the head of a loop, like REPEAT is at the tail of a loop.
  • Make "NEXT" a synonym of REPEAT, or even replace it.
  • Allow NEXT to take an optional variable that is matched to the opening FOR.
That would bring RTB more in line with other BASIC syntaxes and make it more orthogonal.
The answer is "yes, it's possible", however then there's the "do I want to" bit too. (To which the initial answer is tending towards "not really, but...")

One thing that annoyed me (and still does) is the number of different ways to do loops! Why is that? I did suggest in my last post that it's highly likely because of constraints in old systems - memory, speed, space, etc. so why limit myself to those legacy constraints... (But in the 70's IMP77 didn't take that stance, so there is precident there... I just wish it hadn't been limited to Edinburgh (and Manchester) though - so much potential back then, but C "won" at the end of the day.

Anyway - in the above: CYCLE is a requrement at the top of the loop but it's the keyword order that you're asking about. My:

[[while|until] (condition)] cycle
...
repeat

vs. your

do [[while|until] (condition)]
...
repeat

but what about the bottom of the loop? Currently it's

repeat ([while|until] (condition)]

I can sort of see what you're getting at though - do/cycle and repeat would then line-up vertically (and I'm surprised my own ocd didn't choose that way initially ;-)

I don't think that would be difficult to implement. And I could have it both ways - keep cycle the way it is and introduce a new 'do' keyword...
rurwin wrote: for i = 1 to 10 step 2
...
next i
So this is the "classic" BASIC for loop. The "next i" is there to mark the end, and to let the interpreter scan backwards for find the corresponding for statement (memory was tight, why keep track of the line when you can scan backwards, and speed wasn't important as it was for teaching, right?)

The microprocessor BASICs in the late 70's/80's did optimise this somewhat by allowing the 'i' to be dropped, then it would just search backwards for the first FOR it encountered. Some BASICs allow you to early terminate a nested FOR loop using an outermost variable name, but that breaks all sorts of ideas about structured programming. Might as well use goto...

Let me mull that over. There is currently a (roughly implemented) single stack for all cycle...repeat loops, so I'll have to think about side-effects like break and continue (no reason for them to not work in FOR loops) and it might just be an excuse to fix that stack too - currently if you endproc inside a loop, the stack is left in a somewhat "interesting" position...

I did originally write this really to satisfy my own desire to write a BASIC interpreter, (how hard can it be?) so it does reflect a lot of my own ideas. I still want to port over some of my early Apple programs into it though (Any old Apple II kit, throw it my way - I have a working Apple II with floppy drives and it still reads all my 32-year old disks, but I need a serial card to get data off it before they're gone for good)

But would people be intersted in using it? The boot a Pi into BASIC in 6 seconds is somewhat crude (no networking for a start!) but it does work well, although booting a Pi, logging in, then running 'basic' is no different to how people used the very first Dartmouth BASIC, and BASICs on the older "time sharing" systems.

I've written some demos for it (and Ladder board software, CESIL interpreter, etc.) but the uptake there hasn't been much. (200 downloads in the past 90 days and no-one submitted an entry for the CESIL competition )-: but I've no idea if people have actually used it, other than a handfull who've emailled me directly..

-Gordon
--
Gordons projects: https://projects.drogon.net/

Return to “Staffroom, classroom and projects”