jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22050
Joined: Sat Jul 30, 2011 7:41 pm

Re: BASIC - more harmful than useful?

Fri Jan 25, 2013 10:55 pm

pygmy_giant wrote: Hats off for writing a linked list in BASIC btw - I would not know where to start with that.
It was 30 years ago, so I'm afraid I cannot remember how I did it. The floppy disk drives did chatter a bit though.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

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

Re: BASIC - more harmful than useful?

Fri Jan 25, 2013 11:56 pm

jamesh wrote:The hello world program for Python does't use class methods, it's almost the same as BASIC.
Ok I spoke incorrectly. I have been looking at Python, and I an not give a good direct system example of doing any thing in python. Every example I find beyond the extremely simple uses some extension lib or another that is not native to the system though rather an extension. Further the documentation that I have found on verious sites seems to state that the intrinsic types are not intrinsics (things like unlimited integers? WHAT!!). I do not understand how this is helpful in any in teaching kids CS.

Do we want kids to come back in there tens thinking that there hoby CPU design is useless becaus it is only 32-bit? Give them some reality PLEASE.
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?

Sat Jan 26, 2013 12:06 am

jamesh wrote
It was 30 years ago, so I'm afraid I cannot remember how I did it. The floppy disk drives did chatter a bit though.

Bit like us - just read this thread from the beginning and compared it to others and the running motifs seem to be:

1) All programming is good
2) BASIC is how many of us started and some parents and teachers may already be familiar with it
3) BASIC does many things well
4) Although similar in many respects Python does extra things that BASIC can't
5) Python is acknowledged by universities
6) Many people think Python is more elegant and stylish
7) Many people do not realise that BASIC has evolved to incorporate many of these structures
8) People are turned off by too many BASIC dialects

I accept that times have changed, but I feel a bit uncomfortable about that.

I think BASIC's strength is in being basic. I question whether for an interpreted language a comprehensive set of abstract control structures is actually a good thing. GCC is fantastic at optamising during the compile process so I can see a reason for layers of abstraction in a compiled language, but if you are using an interpreter (or 'virtual machine') that converts programmed (or 'scripted') instructions to machine code on the fly, then perhaps there is an argument for keeping the language primative and meeting the cpu half way.

I am tempted to re-visit BASIC V under RISC OS for performance reasons as it has such a small footprint and as the interpreter runs in the cache and can accept assembly instructions.

I accept that that is not most peoples cup of tea, or necessarily a good way to learn programming and that modern processors are faster by an order of magnitude, so speed is not so much an issue as it used to be.

Despite this, and perhaps this is just an irrational emotional old fashioned view, I wonder whether all this 'good programming grammar and flow' is from the machine's perspective complicated bloat.

I guess not if using a python compiler - do they exist?

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

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 1:10 am

pygmy_giant wrote:
jamesh wrote
It was 30 years ago, so I'm afraid I cannot remember how I did it. The floppy disk drives did chatter a bit though.

Bit like us - just read this thread from the beginning and compared it to others and the running motifs seem to be:

1) All programming is good
2) BASIC is how many of us started and some parents and teachers may already be familiar with it
3) BASIC does many things well
4) Although similar in many respects Python does extra things that BASIC can't
5) Python is acknowledged by universities
6) Many people think Python is more elegant and stylish
7) Many people do not realise that BASIC has evolved to incorporate many of these structures
8) People are turned off by too many BASIC dialects

I accept that times have changed, but I feel a bit uncomfortable about that.

I think BASIC's strength is in being basic. I question whether for an interpreted language a comprehensive set of abstract control structures is actually a good thing. GCC is fantastic at optamising during the compile process so I can see a reason for layers of abstraction in a compiled language, but if you are using an interpreter (or 'virtual machine') that converts programmed (or 'scripted') instructions to machine code on the fly, then perhaps there is an argument for keeping the language primative and meeting the cpu half way.

I am tempted to re-visit BASIC V under RISC OS for performance reasons as it has such a small footprint and as the interpreter runs in the cache and can accept assembly instructions.

I accept that that is not most peoples cup of tea, or necessarily a good way to learn programming and that modern processors are faster by an order of magnitude, so speed is not so much an issue as it used to be.

Despite this, and perhaps this is just an irrational emotional old fashioned view, I wonder whether all this 'good programming grammar and flow' is from the machine's perspective complicated bloat.

I guess not if using a python compiler - do they exist?
Yes I would say it is bloat. I was going to show some hand translated assembly for the same simple example in C, C++, Charm, and BBC BASIC to make the point, thouh after 130 lines for the C++ translation in assembly I decided that it would be better to just sum it up.

The example in BBC BASIC is:

Code: Select all


PROCSbegin
END

DEF PROCSbegin
  FOR n% = 0 TO &7FFF0000 STEP 1
    PRINT "Counting at"; n%; "In this loop"
  NEXT n%
ENDPROC
Now the translation results in ARM Assembly( including the code inside of lbrary calls):
BBC BASIC: 31 Instructions.
C : 123 Instructions.
C++: 565 instructions.
Charm: 102 instructions.

So is this new way of structering stuff a large contributor to bloat? YES.

This being said I also did Pascal at 27 instrctions :-) . Though who is countin any way?
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
DexOS
Posts: 876
Joined: Wed May 16, 2012 6:32 pm
Contact: Website

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 1:18 am

The problem is not the programming language BASIC, all the best coder's i know learned on a mixture of basic and assembly.
Its not so much what language you learn, as how well you know it.
I have seen some great stuff coded in basic.

The problem is "FREE" software, theres no chance of any young coders making any money, coding in there bedroom, because software is devalued by it being given away free.
Kids know that 95% of software is free, so why bother coding anything ?.
Now it seems the only way to make any money is to develop hardware and give the software away with it free.

The foundation is doing its bit to try and encourage some value back into software, with its Pi shop etc, but to some the mere mention of money and software in the same sentence, makes them see red.

To those people that see red, i would like to find out what they do for a living and encourage large group of people all over the world to do it for free.
Batteries not included, Some assembly required.

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

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 1:31 am

DexOS wrote:The problem is not the programming language BASIC, all the best coder's i know learned on a mixture of basic and assembly.
Its not so much what language you learn, as how well you know it.
I have seen some great stuff coded in basic.
So have I. There are some amzing posibiltis in this language.
BASIC is not obsolete. And the lack of b]strong[/b] standardization made BBC BASIC V possible. BASIC is just mostly misunderstood.
The problem is "FREE" software, theres no chance of any young coders making any money, coding in there bedroom, because software is devalued by it being given away free.
Kids know that 95% of software is free, so why bother coding anything ?.
Now it seems the only way to make any money is to develop hardware and give the software away with it free.
This is unfortunatly true. I can understand giving scaled down products, or educational demenstrations away for free, though to give away the whole ship is insanity.
The foundation is doing its bit to try and encourage some value back into software, with its Pi shop etc, but to some the mere mention of money and software in the same sentence, makes them see red.

To those people that see red, i would like to find out what they do for a living and encourage large group of people all over the world to do it for free.
DO; PLEASE DO. If you succeed we may actually be able to make a living again.
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?

Sat Jan 26, 2013 2:11 am

DexOS wrote:The problem is not the programming language BASIC, all the best coder's i know learned on a mixture of basic and assembly.
Its not so much what language you learn, as how well you know it.
I have seen some great stuff coded in basic.

The problem is "FREE" software, theres no chance of any young coders making any money, coding in there bedroom, because software is devalued by it being given away free.
Kids know that 95% of software is free, so why bother coding anything ?.
Now it seems the only way to make any money is to develop hardware and give the software away with it free.

The foundation is doing its bit to try and encourage some value back into software, with its Pi shop etc, but to some the mere mention of money and software in the same sentence, makes them see red.

To those people that see red, i would like to find out what they do for a living and encourage large group of people all over the world to do it for free.
The activist in me applauds you, but I can't help feeling that it's even worse than that.

Let's look at all this free (in every sense) software from the point of view of the youngsters that we're trying to encourage. A lot of it is the absolute antithesis of good practice - poorly documented, poorly supported and unintuitive to use.

It doesn't have to earn it's keep, so there's no imperative for improvement. Worse than that, proponents of FOSS take criticism of any product within the genre badly and tend to retort with "if you don't like it then fix it yourself".

Ever tried fixing someone else's buggy application? If they can't code, write proper documentation or create an intuitive user interface then they probably can't be bothered to comment their code properly either (assuming that any of it is worth recycling in the first place). So, it's easier to start from scratch - and that's just what people do. This leads to duplication of effort and ultimately creates more half-finished applications for the hapless newbie to wade through. And all the while FOSS proponents shuffle the deckchairs around while potential consumers ('cos that's what they are) go elsewhere. Those newbies who do adopt open source will quickly learn the bad habits that come from a complete lack of quality control as well as forgetting the importance of concepts such as customer support and actually finishing what you start...

I've nothing against "free" software per se, but half-arsed, outdated and clunky applications just make everyone in the FOSS community look like a bunch of silly old men with too much time on their hands. Perhaps there's an opportunity for the next generation of smart kids to make some money by fixing this sorry state of affairs with an affordable, flexible operating system that just works and that existing software and hardware manufacturers consider to be worth supporting...

User avatar
jojopi
Posts: 3063
Joined: Tue Oct 11, 2011 8:38 pm

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 5:31 am

DavidS wrote:

Code: Select all

PROCSbegin
END
DEF PROCSbegin
  FOR n% = 0 TO &7FFF0000 STEP 1
    PRINT "Counting at"; n%; "In this loop"
  NEXT n%
ENDPROC
Now the translation results in ARM Assembly( including the code inside of lbrary calls):
BBC BASIC: 31 Instructions.
C : 123 Instructions.
C++: 565 instructions.
Not that I agree that counting machine instructions makes any sense in a discussion about the suitability of languages for learners, but I cannot reconcile your results here.

31 instructions does not appear sufficient to convert a 32 bit integer to decimal ASCII string efficiently. So what is your definition of including the code inside of library calls? Also, GCC produces only 13 instructions for your example, excluding the implementation of printf.

By the way, in BBC BASIC you should include trailing or leading spaces inside strings when they are pressed up against integers with ";". Otherwise the results look ugly. Perhaps you were thinking of Python, where this is not necessary.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22050
Joined: Sat Jul 30, 2011 7:41 pm

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 8:47 am

jojopi wrote:
DavidS wrote:

Code: Select all

PROCSbegin
END
DEF PROCSbegin
  FOR n% = 0 TO &7FFF0000 STEP 1
    PRINT "Counting at"; n%; "In this loop"
  NEXT n%
ENDPROC
Now the translation results in ARM Assembly( including the code inside of lbrary calls):
BBC BASIC: 31 Instructions.
C : 123 Instructions.
C++: 565 instructions.
Not that I agree that counting machine instructions makes any sense in a discussion about the suitability of languages for learners, but I cannot reconcile your results here.

31 instructions does not appear sufficient to convert a 32 bit integer to decimal ASCII string efficiently. So what is your definition of including the code inside of library calls? Also, GCC produces only 13 instructions for your example, excluding the implementation of printf.

By the way, in BBC BASIC you should include trailing or leading spaces inside strings when they are pressed up against integers with ";". Otherwise the results look ugly. Perhaps you were thinking of Python, where this is not necessary.
Agreed. Someone has miscounted there.

Notwithstanding, I still find is odd people are arguing for BASIC when Python is much better suited, if for no other reason than it's standardised. I'm sure there are BASIC's with many of the structure features of Python (etc), but why bother? You have Python which is standard over many more platforms, used in anger in actual projects, is just as easy to use, and has a damn sight more teaching material available.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

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 9:58 am

If it wasn't for FOSS, then the Raspberry Pi would not exist, or would cost twice or three times as much. Linux, Python, RiscOS and BASIC are all FOSS.

As to the quality of FOSS code, sure some of it is bad, but a great deal of it is very good. I'm sure we can argue for another 22 pages about where that split lies.

Case in point, last Sunday I found I had a problem with my favourite editor, jEdit, when working with the Pi. jEdit has a plugin to treat FTP servers as filesystems. So I can edit code on the PC and use SFTP to load and save it onto the Pi. I found it was leaving a lot of dead sshd processes around on the Pi. With only 256MB of RAM, the Pi even crashed a couple of times. I did some googling and found it did not seem to be a problem of sshd, so it must be in the jEdit plugin. I don't know Java (which jEdit is written in) or how SSH works, but I downloaded the source code and had a poke around, and I checked on the jEdit bug-list and found an old report from 2009 talking about the same behaviour but in rare circumstances, so it hadn't seemed important. I wrapped up my research in a detailed post to the developers mailing list.

Three hours later, the bug was fixed. On a Sunday, at 9pm.


Back on-topic, it just struck me that BASIC may have an important advantage over Python in the classroom. Not in teaching kids; I still feel Python is the best language for them. But BASIC is a very small language. It would be possible to teach the teachers to teach it, very quickly -- in weekend or week-long courses. If you try the same thing with Python then you have to stop half-way. The teachers will have enough knowledge to teach the same concepts to the kids, but they will know they are only scratching the surface of the language, and that will make them uneasy. If they learned BASIC, then they can learn the whole language and all its possibilities, which will make them more confident teaching it.

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

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 12:54 pm

jojopi wrote:
DavidS wrote:

Code: Select all

PROCSbegin
END
DEF PROCSbegin
  FOR n% = 0 TO &7FFF0000 STEP 1
    PRINT "Counting at"; n%; "In this loop"
  NEXT n%
ENDPROC
Now the translation results in ARM Assembly( including the code inside of lbrary calls):
BBC BASIC: 31 Instructions.
C : 123 Instructions.
C++: 565 instructions.
Not that I agree that counting machine instructions makes any sense in a discussion about the suitability of languages for learners, but I cannot reconcile your results here.

31 instructions does not appear sufficient to convert a 32 bit integer to decimal ASCII string efficiently. So what is your definition of including the code inside of library calls? Also, GCC produces only 13 instructions for your example, excluding the implementation of printf.

By the way, in BBC BASIC you should include trailing or leading spaces inside strings when they are pressed up against integers with ";". Otherwise the results look ugly. Perhaps you were thinking of Python, where this is not necessary.
Not a miscoun, I did cheat a litle, I converted to a octal ascii string instead of decimal. This saved the need to do a base 10 devide. If I did not cheat you would be correct, my instruction count would be low. Tough I did the same cheat in all versions.

As to the C version I did not use printf(), I used puts() and puts(itoa()), just like I would if I were writing a program in C, and i included the __init__ code. Though you just got me to look and aparently itoa() is not ANSI C, my error.
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: 3800
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 1:06 pm

rurwin wrote:If it wasn't for FOSS, then the Raspberry Pi would not exist, or would cost twice or three times as much. Linux, Python, RiscOS and BASIC are all FOSS.

As to the quality of FOSS code, sure some of it is bad, but a great deal of it is very good. I'm sure we can argue for another 22 pages about where that split lies.

Case in point, last Sunday I found I had a problem with my favourite editor, jEdit, when working with the Pi. jEdit has a plugin to treat FTP servers as filesystems. So I can edit code on the PC and use SFTP to load and save it onto the Pi. I found it was leaving a lot of dead sshd processes around on the Pi. With only 256MB of RAM, the Pi even crashed a couple of times. I did some googling and found it did not seem to be a problem of sshd, so it must be in the jEdit plugin. I don't know Java (which jEdit is written in) or how SSH works, but I downloaded the source code and had a poke around, and I checked on the jEdit bug-list and found an old report from 2009 talking about the same behaviour but in rare circumstances, so it hadn't seemed important. I wrapped up my research in a detailed post to the developers mailing list.


Three hours later, the bug was fixed. On a Sunday, at 9pm.
Most good Oprating Systems have been open source since the 1970s. An Operating System, the basic tools, and the needed compilers are nessesities, and should be free and open. It is everything else; the stuff that programmers make there living at that is a concern. And of cource there are cases where even non FOSS OSes are an advantage (though I still think that Free helps).

For example ROOL RISC OS, it is shared source (not Open Source). So you can fix a bug, though some one has control of the direction it goes, we do not loose this. There is still a commercial ententy behind ROOL.
Back on-topic, it just struck me that BASIC may have an important advantage over Python in the classroom. Not in teaching kids; I still feel Python is the best language for them. But BASIC is a very small language. It would be possible to teach the teachers to teach it, very quickly -- in weekend or week-long courses. If you try the same thing with Python then you have to stop half-way. The teachers will have enough knowledge to teach the same concepts to the kids, but they will know they are only scratching the surface of the language, and that will make them uneasy. If they learned BASIC, then they can learn the whole language and all its possibilities, which will make them more confident teaching it.
For this argument you could have just a easily pointed to Pascal, or C as pointing to BASIC. Though I do agree (if you point to BASIC or Pacal).
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?

Sat Jan 26, 2013 4:40 pm

rurwin wrote: Back on-topic, it just struck me that BASIC may have an important advantage over Python in the classroom. Not in teaching kids; I still feel Python is the best language for them. But BASIC is a very small language. It would be possible to teach the teachers to teach it, very quickly -- in weekend or week-long courses. If you try the same thing with Python then you have to stop half-way. The teachers will have enough knowledge to teach the same concepts to the kids, but they will know they are only scratching the surface of the language, and that will make them uneasy. If they learned BASIC, then they can learn the whole language and all its possibilities, which will make them more confident teaching it.
BASIC is not a small language. C is a small language but that does not make it easy. It takes some practice programming to know a programming language and it is a time consuming activity.

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 5:37 pm

You disagree with my choice of words. That's OK; I'm not perfect. Do you disagree with my conclusion?

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

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 6:58 pm

rurwin wrote:You disagree with my choice of words. That's OK; I'm not perfect. Do you disagree with my conclusion?
I do. The syntactic size of a language has nothing to do with what's possible to express in that language, or the ease with which it can be taught.

For example, Lisp is possibly one of the smallest langages out there (the core of McCarthy's purely symbolic lisp consists of 17 operators and can be reduced further; one can have a fully fledged lisp, which saves having to mess about deriving arithmetic and logic, in 25 operators or less). Its syntax is trivial and unambiguous. In comparison to BASIC (even Dartmouth BASIC is large compared to lisp, both in terms of keyword / operator / function count and in terms of what operators are provided), it's minuscule. However, using just those few, sparse, operators, lisp can express concepts that are effectively inexpressible* in BASIC, or the majority of other programming languages out there.

To learn the syntax, the core, of Lisp and scheme takes minutes. To learn to really program with it, rather longer. To understand it, to dream in it, to be able to teach it, months or years.

I would argue that you have no place teaching computer science if you don't at least understand why it is the case that an essentially mathematical construct is vastly more expressive, more flexible, than a supposedly purpose built language for *ahem* "all purpose" computing.

BASIC is easy to teach because it is deliberately and savagely crippled in terms of what it can express. You find yourself asking "and what about the rest?". But there is no "the rest". It's a dead end. Python, at least, has a "the rest", it genuinely is more or less "all purpose".

* Greenspun's 10th rule applies, of course.

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 7:35 pm

rurwin wrote:You disagree with my choice of words. That's OK; I'm not perfect. Do you disagree with my conclusion?
It may be different in the UK but I suspect most teachers here have next to zero background in programming. The BBC BASIC manual I looked at is over 400 pages. I don`t think someone is going to learn that in a weekend. It covers a lot of ground and it does include functions, procedures and variable scope. Sure one could cover some useful stuff in a weekend but to say they would learn it all and be confident is unrealistic.

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

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 7:40 pm

...
BASIC is easy to teach because it is deliberately and savagely crippled in terms of what it can express. You find yourself asking "and what about the rest?". But there is no "the rest". It's a dead end. Python, at least, has a "the rest", it genuinely is more or less "all purpose".
Ok I am befudled. I am not certain what BASIC you speak of here, or what you are comparig it to. Maybe standard BASIC, and definitely Darthmouth BASIC meet your dscription, though not any of the good BASICs, BBC BASIC is at least as capable as C, and C at least as capable as C++.

Now I do understand that some languages are truely eloquent (like lisp).
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: 3800
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 7:43 pm

danpeirce wrote:
rurwin wrote:You disagree with my choice of words. That's OK; I'm not perfect. Do you disagree with my conclusion?
It may be different in the UK but I suspect most teachers here have next to zero background in programming. The BBC BASIC manual I looked at is over 400 pages. I don`t think someone is going to learn that in a weekend. It covers a lot of ground and it does include functions, procedures and variable scope. Sure one could cover some useful stuff in a weekend but to say they would learn it all and be confident is unrealistic.
I have toughtplenty of people that have zero background in programming BBC BASIC in under 3 days. Now if they have zero background in math (like many 5 and 6 year old kids) it will take a couple of weeks to teach. Though I do not think that this would be a problem with 99% of teachers.
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.

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 22050
Joined: Sat Jul 30, 2011 7:41 pm

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 7:55 pm

DavidS wrote:
...
BASIC is easy to teach because it is deliberately and savagely crippled in terms of what it can express. You find yourself asking "and what about the rest?". But there is no "the rest". It's a dead end. Python, at least, has a "the rest", it genuinely is more or less "all purpose".
Ok I am befudled. I am not certain what BASIC you speak of here, or what you are comparig it to. Maybe standard BASIC, and definitely Darthmouth BASIC meet your dscription, though not any of the good BASICs, BBC BASIC is at least as capable as C, and C at least as capable as C++.

Now I do understand that some languages are truely eloquent (like lisp).
No, it isn't as capable as C. Never has been, never will be. Otherwise OS's and embedded software would all be written in BASIC.They aren't. Of course, all languages have their place. But I'm not sure how many modern programming projects use BASIC. Very few I imagine. There is a reason for that.

And you have emphasised one of the points against BASIC - that of its fragmentation - there are so many different version, no-one know which one is being talked about or which one to use.

LISP? Not a language for teaching programming. Certainly has its place though. Just not sure what that place is.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Contrary to popular belief, humorous signatures are allowed. Here's an example...
"My grief counseller just died, luckily, he was so good, I didn't care."

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 8:20 pm

DavidS wrote: I have toughtplenty of people that have zero background in programming BBC BASIC in under 3 days. Now if they have zero background in math (like many 5 and 6 year old kids) it will take a couple of weeks to teach. Though I do not think that this would be a problem with 99% of teachers.
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?

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

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 8:26 pm

jamesh wrote:
DavidS wrote:
...
BASIC is easy to teach because it is deliberately and savagely crippled in terms of what it can express. You find yourself asking "and what about the rest?". But there is no "the rest". It's a dead end. Python, at least, has a "the rest", it genuinely is more or less "all purpose".
Ok I am befudled. I am not certain what BASIC you speak of here, or what you are comparig it to. Maybe standard BASIC, and definitely Darthmouth BASIC meet your dscription, though not any of the good BASICs, BBC BASIC is at least as capable as C, and C at least as capable as C++.

Now I do understand that some languages are truely eloquent (like lisp).
No, it isn't as capable as C. Never has been, never will be. Otherwise OS's and embedded software would all be written in BASIC.They aren't. Of course, all languages have their place. But I'm not sure how many modern programming projects use BASIC. Very few I imagine. There is a reason for that.

And you have emphasised one of the points against BASIC - that of its fragmentation - there are so many different version, no-one know which one is being talked about or which one to use.

LISP? Not a language for teaching programming. Certainly has its place though. Just not sure what that place is.
1:) What is BBC BASIC V missing that makes it less capable than C? I can not think of anything. BBC BASIC V has pointers, typed variables, reentrant functions, the means to implement structures (this one amy not be as eloquent as it is in C but it is there), linked lists, not a problem. And all of this with out a single line of assembly. It also has every form of looping construct that C does plus a couple, witch case we have, defined constants no trouble, unions same as implementing structures. So what is missing? It would be different if Ihad not specified BBC BASIC V.

2:) there have some fairly advanced embeded Operating systems written 100% in a compiled BASIC it depends on the dielect, so what BASIC were you speaking of? And at least three in compiled BBC BASIC V.

3:) Yes over all BASIC is fragmented. But we have an ARM based computer that does a wonderful job of running BBC BASIC V on RISC OS, so for our HW there is a standard BASIC.

4:) yes there is a reason for the over all lack of use of BASIC today; due to misconceptions based on the poorly thought nature of many of the earlier implementations of BASIC (especialy MS 8KB BASIC and those modeled there after), there is a negitive view that prevents any one from being taught any of the good veriants of BASIC. This is why I am often very specific when mentioning BBC BASIC, as it seems that each major kind of BASIC should be called as language unto it self. Even though there are a huge number of programs that will run on 99%+ of the BASIC dialects.
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.
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: 3800
Joined: Thu Dec 15, 2011 6:39 am
Location: USA
Contact: Website

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 8:35 pm

@danpeirce: You just gave me the concept for the introdution of my programming tutorials for RISC OS series, do you mind if I give you credit in the bibliography?
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.

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

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 8:41 pm

jamesh wrote:LISP? Not a language for teaching programming. Certainly has its place though. Just not sure what that place is.
In an educational context, that place is called computer science. Real computer science, the study of computation itself, rather than merely teaching programming. It's a bit like the difference between materials science and woodwork ;)

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 8:55 pm

tufty wrote:I would argue that you have no place teaching computer science if you don't at least understand why it is the case that an essentially mathematical construct is vastly more expressive, more flexible, than a supposedly purpose built language for *ahem* "all purpose" computing.

BASIC is easy to teach because it is deliberately and savagely crippled in terms of what it can express. You find yourself asking "and what about the rest?". But there is no "the rest". It's a dead end. Python, at least, has a "the rest", it genuinely is more or less "all purpose".
Who said I didn't understand the difference between expressive power and language size? I certainly did not express an opinion about expressive power. 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. I agree that BASIC is a dead-end, 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.

And for the record I have both dreamed in Lisp, (a mighty strange experience it was,) and successfully used it to teach a teenager programming.

User avatar
jojopi
Posts: 3063
Joined: Tue Oct 11, 2011 8:38 pm

Re: BASIC - more harmful than useful?

Sat Jan 26, 2013 9:06 pm

DavidS wrote:BBC BASIC: 31 Instructions.
C : 123 Instructions.
C++: 565 instructions.

Not a miscoun, I did cheat a litle, I converted to a octal ascii string instead of decimal. This saved the need to do a base 10 devide. If I did not cheat you would be correct, my instruction count would be low. Tough I did the same cheat in all versions.

As to the C version I did not use printf(), I used puts() and puts(itoa()), just like I would if I were writing a program in C, and i included the __init__ code. Though you just got me to look and aparently itoa() is not ANSI C, my error.
BBC BASIC does not have a facility to print numbers in octal, does it? And no matter how much you dislike the "hidden complexity" of printf, you cannot replace it with multiple calls to puts, because each of those appends a newline. Not only does that change the behaviour, but it also increases the number of system calls, slowing the program noticeably. And your non-standard itoa function appears to take the base as a runtime parameter. So that is worse than a hard-coded decimal divide.

You are comparing DavidS BASIC with DavidS C, which is meaningless.

I doubt that anyone would have believed that compiled BASIC is generally faster than compiled C. But you could at least have attempted to contrive an example without palpable bias.

Return to “Staffroom, classroom and projects”