Page 19 of 36
Re: BASIC - more harmful than useful?
Posted: Mon Oct 29, 2012 6:05 pm
by psutton
spock wrote:basic isn't harmful but also not useful.
i always see those example here:
10 print "hello world!"
20 goto 10
and how great this is for kids.
in python the same is:
while 1: print "hello world!"
as great and with a useful modern language you can grow with.

What is the difference in python in using
print ("hello world") and print "hello world"
I take it python uses both conventions
actually the basic program would print hello world down the screen repeatedly where as the python statement(s) would print once.
Re: BASIC - more harmful than useful?
Posted: Mon Oct 29, 2012 6:12 pm
by rurwin
No. The "while 1:" statement makes it repeat endlessly.
And print() is Python 3, whereas the version without the parentheses is Python 2.
-----
Welcome ladybridge; the more the merrier.
When I learned programming back in 1975, we used real "Dartmouth" BASIC, with one statement per line, no block structuring, no integer variables, but with built-in matrix operations. (That might be interesting in these days of 3D graphics and fast vector coprocessors.)
I have seen many languages over the years that have called themselves BASIC. Sometimes the only relation to the original language was the use of the DIM statement and the THEN keyword, sometimes not even those. The microcomputers of the late 1970's and early 1980's took the language and re-shaped it into something block structured. I'm sure you could take it and add object orientation as well. There is the question of when exactly it ceases to be the language it was and becomes something else, but I think that boat has sailed long ago. I am reminded of
The Languages Of Pao; BASIC is the hotchpotch Pastiche that gets the job done while the more specialised languages keep to their own little worlds.
There is also the question of whether object orientation is all that important for pedagogic purposes. Like block structuring, it will probably settle down and become a part of the scenery, but it is not necessarily where today's children will be building their careers. Before today's ten year-olds leave university, there are likely to have been multiple waves of new techniques, some of them more important and maybe longer-lived than object orientation.
Re: BASIC - more harmful than useful?
Posted: Tue Oct 30, 2012 7:55 am
by DavidMS
Downloaded Tiny Basic to my Rpi yesterday, marvellous.
I can see Python has a place educationally, it may be that I started with BASIC [on punched cards] or it may be the way Python is implemented but I still find BASIC an easier starting point. That said I spent a far more time that I should have done over the weekend creating a treasure island search in Scratch which I am mad about.
Does BASIC rot the brain ? Well for me I went straight from BASIC to programming in Z80 assembler and more recently PIC assembly language [ both of which have a direct equivalent of those apparently damaging GOTO statements ].
Re: BASIC - more harmful than useful?
Posted: Tue Oct 30, 2012 2:21 pm
by hippy
psutton wrote:What is the difference in python in using
print ("hello world") and print "hello world"
I take it python uses both conventions
Version 3 of Python has print as a function and requires the first form, earlier versions have print as a statement and can use the second.
http://www.python.org/dev/peps/pep-3105
Re: BASIC - more harmful than useful?
Posted: Tue Jan 15, 2013 5:54 pm
by Caddystash
Having got the general drift of this rather long thread, could I chip in with (yet another ! ) BASIC as a potential candidate for consideration for educational use with the Rpi?
My vote goes to DIGITAL BASIC. It's a contemporary Japanese programme, by SHIRAISHI Kazuo, it appears to be an open source project published under GPL, it is aimed at teaching and seems to run on Linux i386, Windows and OS-X. It is, to all intents and purposes, a complete implementation of the ratified ANSI/ISO international standard for FULL BASIC, a structured top-down language which is very robust and has a high degree of mathematical accuracy.
Due to the need for backward compatibility with the earlier ANSI/ISO standard for MINIMAL BASIC, it does support line numbering, GOTO, GOSUB, and POKE etc. but non of this is mandatory and most of these things appear to be frowned upon within the standard.
It wasn't created to handle OOP or pure TRUE/FALSE boolean commands, but it seems very easy to use, quite powerful and shouldn't leave the user with too many bad habits.
Although I personally know of only two other commercial implementations based upon this standard, TRUE BASIC from the creators of the original Dartmouth BASIC, and IS-BASIC, created by Intelligent Software for use on the Elan Enterprise 64/128 home computer (remember that Z80 marvel anyone?) it never the less has full ISO, ANSI, ECMA and (obviously) JIS support.
It's not the fastest BASIC in the world but there is a compiler for it. Strikes me a bit like an updated BBC BASIC on steroids. But then again, I am no programer. Anyhow; just a suggestion.
Here's the Japanese web site:
http://hp.vector.co.jp/authors/VA008683 ... /index.htm
…and here's an independent forum talking about FULL BASIC and DIGITAL BASIC in particular.
http://www.mombu.com/programming/progra ... 80103.html
Re: BASIC - more harmful than useful?
Posted: Sun Jan 20, 2013 11:00 pm
by danpeirce
No, saying "more harmful than useful" is going too far I think.
I'd don't think statements like that are helpful.
Unlike a lot of people who have posted here I learned FORTRAN first then 8 bit assembly (6809, Z80, 68HC11) then some GW-BASIC followed by Pascal and then C and PIC assembly. I have also dabbled in a bit of C++, JavaScript, Java, PHP, Perl, TCL and Python. I took a Pascal course in 1991 stopped using gw-basic at that time. I have not used FORTRAN since graduating from University in 1984.
As I see it a programming is not a solitary activity done by programmers in isolation. Debating about which programming language is best to teach to beginners is a bit (not completely) like debating which natural human language one should acquire first. Young people will do better with teachers (at least to start off with) so there is a question of who is available to teach and what do they know? Having a teacher who is knowledgeable and somewhat passionate about programming in some language would be very helpful.
In recent years the community doing active development around Python has increased dramatically. Generally the same version of Python can be used across many (perhaps most platforms capable of running the interpreter) platforms. Python is being used by many in the scientific community who are neither computer scientists nor engineers. It is not only computer science that has seen a drop in highly qualified applicants. Other sciences have also seen this and the Raspberry Pi could be helpful in generating more interest in science, math and engineering as well as programming. Just the other day I saw a physics group installing Python to help them solve differential equations numerically. Primary school kids don't use differential equations but a raspberry pi and python could be used to make learning math less tedious at all levels.
From my perspective the big and quickly growing Python community make Python a rising star. The manner in which Python is licensed is a significant contributor to this in my opinion.
Re: BASIC - more harmful than useful?
Posted: Wed Jan 23, 2013 1:33 am
by DavidS
I aggree with some comments here, about many newer verients of BASIC being only in name and not retaining anything of the BASIC language.
I would say that any canidate should contain enough BASIC to make it easy to understand even for those that only have access to quite old documentation (not every one has access to the Internet).
This is why I threw in my vote for BBC BASIC in this very thread about a year ago. BBC BASIC V is a good structured programming language, and it still has all of the standard BASIC constructs, library functions ( ABS(), LEFT$(), RIGHT$(), MID$(), ASC(), CHR(), SPC(), LEN(), VAL(), SIN(), COS(), TAN(), ATN(), ASN(), ASC(), LOG(), EXP(), INT() ) as well as the standard BASIC error handling. The only thing missing from good old BASIC is TRON/TROFF.
Further BBC BASIC V promotes the use of structured programming by encourging the use of callable procedures instead of GOTO/GOSUB/CALL/RETURN, and discourging the use of line numbers as references for commands. Further BBC BASIC is able to directly make Operating System calls on RISC OS, and has a built in ARM Assembler, that in current versions of RISC OS 5.19 fully supports the ARMv6/7 instruction set and VFP. BBC BASIC also uses Inderection from a base address stored in a variable (or what C calls 'pointers').
Re: BASIC - more harmful than useful?
Posted: Wed Jan 23, 2013 2:15 am
by danpeirce
DavidS I'd have to wonder how many teachers in North America have any background at all in BBC Basic V? I expect the number would be very small. What universities are offering courses, seminars or workshops where they can brush up on their skills? I had a quick look with Google and did not find any. I'd expect there are actually more teachers with some exposure to Python and there are some universities offering introductory Python courses and they are post secondary departments making use of Python. It is probably a good idea to introduce young people to a language they may use again later.
This appears interesting
http://arxiv.org/ftp/arxiv/papers/0809/0809.1437.pdf which is
a MASTERS THESIS on "How applicable is Python as first computer language for teaching programming in a pre-university educational environment, from a teacher’s point of view?"
Re: BASIC - more harmful than useful?
Posted: Wed Jan 23, 2013 8:57 am
by SimonSmall
There is a major problem with this thread (as well as being too long!) - some people seem to be tagging BASIC as the language that has line numbers and GOTO statements, and does not do so-called "modern" concepts like tracing, OOP and others. I think this misses the point, and is not the case with a lot of the versions of BASIC today
We could question the value of teaching children to ride a three-wheel bike as they won't use this later in life; in fact many won't use a two-wheel bike! Firstly, successfully learning this provides a bit of freedom by giving the children a quicker way of travelling that they can control. Secondly, many of the concepts can be applied to the next stage, and we learn how to use the new bits and which bits we can 'forget'.
Using a version of BASIC that provides subroutines, functions and does not mandate line numbers is like that initial skill. Code can be grouped in the subroutines, comments added and other "good practices" encouraged, all in a single code file that uses a single thread. After the initial success, other languages (like Scratch and Python) can be introduced, with the new concepts explained. After that, covering C, C++ and others that use compilers, with such things as code repositories and IDEs can be brought in.
What our primary focus should be is teaching "programming", not any particular language. I doubt that anyone can predict what the "best" language will be in 15 years, when a 7 year old will be looking to be a successfully employed adult. If people are worried about bad habits, we need to find a way of making people aware of the bad habits and avoiding them. We should also teach about code obsolescence and the need to keep learning
Re: BASIC - more harmful than useful?
Posted: Wed Jan 23, 2013 1:25 pm
by DavidS
danpeirce wrote:DavidS I'd have to wonder how many teachers in North America have any background at all in BBC Basic V? I expect the number would be very small. What universities are offering courses, seminars or workshops where they can brush up on their skills? I had a quick look with Google and did not find any. I'd expect there are actually more teachers with some exposure to Python and there are some universities offering introductory Python courses and they are post secondary departments making use of Python. It is probably a good idea to introduce young people to a language they may use again later.
This appears interesting
http://arxiv.org/ftp/arxiv/papers/0809/0809.1437.pdf which is
a MASTERS THESIS on "How applicable is Python as first computer language for teaching programming in a pre-university educational environment, from a teacher’s point of view?"
I assume that you use Python?
Would you realy want to teach Python to a 7 year old as there first experiece with programming? I feel that this is one of the major problems with modern computer education, we do not attempt to expose young children to programming, they are able to understand it better than an adult that has been incorrectly preconditioned to think that it is hard. And they will come out of it coditioned to think that it is simple (which is correct [as we know]). In the 1980s me and my freinds all played with simple programming, all starting under 8 years of age.
As to the availability of knowledge among Primary School Proffessors in the Unite States (where I am), I think you would find the same problem with any programming language. Generaly this is not considered important for Primary school education
(unfortunately) 
. So if not BBC BASIC what language that encourages proper style could be used to teach young children that is simple to learn for a student of 7 in his/her 3rd year of primary school?
I grew up in the US and my third computer (when I was 9 years old) was an Acorn Archimedes, and in my neighborhood most of the other kids also got Archimedes in that same year (late 1987 or early 1988). Just because they were not common over here does not mean that they were nonexistant, or that the knowledge from them is nonexistant.
Re: BASIC - more harmful than useful?
Posted: Wed Jan 23, 2013 1:38 pm
by DavidS
SimonSmall wrote:There is a major problem with this thread (as well as being too long!) - some people seem to be tagging BASIC as the language that has line numbers and GOTO statements, and does not do so-called "modern" concepts like tracing, OOP and others. I think this misses the point, and is not the case with a lot of the versions of BASIC today
I would agree with this view being incorrect. BBC BASIC V on RISC OS is a good example of a good modern BASIC.
Unfortunately some languages that carry the name BASIC are not BASIC and are much more dificult for first time programmers to learn than BASIC. To point VisualBASIC is NOT BASIC, RealBASIC is NOT BASIC, and many more.
... ...
Using a version of BASIC that provides subroutines, functions and does not mandate line numbers is like that initial skill. Code can be grouped in the subroutines, comments added and other "good practices" encouraged, all in a single code file that uses a single thread. After the initial success, other languages (like Scratch and Python) can be introduced, with the new concepts explained. After that, covering C, C++ and others that use compilers, with such things as code repositories and IDEs can be brought in.
YES YES.
Now there is needed a BASIC that meets these needs. While there are a few good ones (FreeBASIC, QB64, QB45) most target the x86 CPU and OSes there on. The only one that I am aware of, at this time, for the ARM is BBC BASIC V on RISC OS. The other ports of BBC BASIC and BRANDY BASIC are lacking (unfortunate truth).
What our primary focus should be is teaching "programming", not any particular language. I doubt that anyone can predict what the "best" language will be in 15 years, when a 7 year old will be looking to be a successfully employed adult. If people are worried about bad habits, we need to find a way of making people aware of the bad habits and avoiding them. We should also teach about code obsolescence and the need to keep learning
Agreed, Agreed, Agreed.
Re: BASIC - more harmful than useful?
Posted: Wed Jan 23, 2013 2:15 pm
by rurwin
DavidS wrote:Would you realy want to teach Python to a 7 year old as there first experiece with programming?
yes, at least more than I would want to teach them BASIC.
I would rather teach them Scratch, but if it was BASIC or Python, I'd choose Python. BASIC is not the worst choice, in fact it might come in second, but any BASIC program you can point to, I can point to the equivalent Python program that is as understandable or more so. It has everything that BASIC has for the beginner and it is more internally consistent.
Re: BASIC - more harmful than useful?
Posted: Wed Jan 23, 2013 5:22 pm
by DavidS
Rurwin wrote:yes, at least more than I would want to teach them BASIC.
I would rather teach them Scratch, but if it was BASIC or Python, I'd choose Python. BASIC is not the worst choice, in fact it might come in second, but any BASIC program you can point to, I can point to the equivalent Python program that is as understandable or more so. It has everything that BASIC has for the beginner and it is more internally consistent.
Ok you give an interesting challenge. You say that you can poin to better more understandable Python equilivents to
any BASIC program that I could point out.
I take this challenge, and I begin by pointing out the programms that are part of the two tutorials included in the RPi default RISC OS SD Image. The Tutorials are:
- 1: First Steps in Programming RISC OS computers.
2: A biginners Guide To Wimp Programming.
Both of these are in the Books directory in the Documents Directory on the standard RISC OS SD image for the RPi.
I am interested to see the results, If you can prove Python to be as simple as BBC BASIC V I will concede. Though I have looked at many Python samples, and it seems pretty convoluted (though this could easily be do to the programmers style). I sencerly do hope that you can prove me wrong.
I do agree that for 99% of every one BASIC (or what ever there first language is) would be just a stepping stone.
And in case you do not use RISC OS at all on the RPi, these are both available as part of Foudation RiscWorld magazine, which you can view for free at tere site.
Re: BASIC - more harmful than useful?
Posted: Wed Jan 23, 2013 7:23 pm
by danpeirce
DavidS wrote:
I assume that you use Python?
Would you realy want to teach Python to a 7 year old as there first experiece with programming? I feel that this is one of the major problems with modern computer education, we do not attempt to expose young children to programming, they are able to understand it better than an adult that has been incorrectly preconditioned to think that it is hard. And they will come out of it coditioned to think that it is simple (which is correct [as we know]). In the 1980s me and my freinds all played with simple programming, all starting under 8 years of age.
As to the availability of knowledge among Primary School Proffessors in the Unite States (where I am), I think you would find the same problem with any programming language. Generaly this is not considered important for Primary school education
(unfortunately) 
. So if not BBC BASIC what language that encourages proper style could be used to teach young children that is simple to learn for a student of 7 in his/her 3rd year of primary school?
I grew up in the US and my third computer (when I was 9 years old) was an Acorn Archimedes, and in my neighborhood most of the other kids also got Archimedes in that same year (late 1987 or early 1988). Just because they were not common over here does not mean that they were nonexistant, or that the knowledge from them is nonexistant.
In 1987-88 I was an electronics technology lab instructor and the adult students I was working with at that time were learning z80 assembly (I'm sure they got some Pascal at that time too and other things electronics related). In British Columbia today students are not even learning any programming language at secondary school. I have four kids and three of them are finished high school. The closest any of my own kids got was learning a little basic HTML and a text markup language is not a programming language. There may be a few bright lights that teach programming already here and there but in general programming is not being taught even in high school.
The first challenge will be to give teachers a grounding in programming. Teachers get trained at University. If you look through the masters thesis linked in my last post you will get the essentials of the attitude towards BASIC in computer science departments at most Universities.
While it would be nice to see computer programming taught at some point in primary school it will probably be more feasible in the short run to try to get some actual programming taught in high schools. To see this happen at most schools the teachers will have to be taught first. That training will come from universities and University Computing Science departments are more open to Python than BASIC. A lot of introductory programming courses in University actually teach Java these days. So I think what we really want to promote at this point is teaching Python which many Universities may be open to.
Re: BASIC - more harmful than useful?
Posted: Wed Jan 23, 2013 8:26 pm
by DavidS
@danpeirce:
I am aware of the general university level oposition to BASIC, this was even the case when I first began my CS studies at university (beginning at Baylor in fall 1990). And while I will never accept a degree (despite many universities attempting to talk me into it) I continue my studies (as CS is still an evolvng feild), unfortunately this aditude has become worse with time (except in UCBerkley where they are bginning to see structured BASIC).
Yes it is needed to teach the Professors the skill before they can teach it. Though as we do begin to get this into Primary Schools the universities will also need to reevaluate there views, and question what programming language you teach a very young child. For now it is up to the parents/gardians to teach there children these skills.
Re: BASIC - more harmful than useful?
Posted: Wed Jan 23, 2013 11:59 pm
by rurwin
Two non-trivial examples chosen at random:
Days2
Code: Select all
# Days 2
# Calculates day of week
monnum = [0,3, 3, 6, 1, 4, 6, 2, 5, 0, 3, 5]
day = ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
while True:
date = int(raw_input("Please enter the day of the month: "))
mon = int(raw_input("Now enter the month number(1-12): "))
year = int(raw_input("Now enter the year: "))
if year < 40: year += 100
if year < 140: year += 1900
if year < 1900 or year > 2099: print "Sorry, this program only works with years 1900 to 2099"; continue
year -= 1900
leaps = year // 4
if year % 4 == 0 and mon < 3 and year > 0: leaps -= 1
total = year + leaps + monnum[mon-1] + date
total = total % 7
print "That day was a", day[total]
char = raw_input("Do you want another go (y/n): ")
print
if char[0] != "Y" and char[0] != "y": break
There's no READ/DATA statements in Python, but I think the solution above is clearer than BASIC. Python indexes start at zero, otherwise the above is a faithful rendition of the (execrable) BASIC code. BASIC has two UNTIL statements that break the structured paradigm, but Python lacks REPEAT-UNTIL. I'd call that one all.
Boxes
Code: Select all
# Boxes
# Creates rectangle to show different colours
import sys
import pygame
pygame.init()
window = pygame.display.set_mode((640, 480))
BBC_COLOUR=[(0,0,0), (255,0,0), (0,255,0), (255,255,0), (0,0,255),
(255,0,255), (0,255,255), (255,255,255)]
for colour in range(7,-1,-1):
rectangle = pygame.Rect(40+colour*20, 80+colour*20, 120+colour*12, 100+colour*10)
pygame.draw.rect(window, BBC_COLOUR[colour], rectangle)
pygame.draw.circle(window, pygame.Color("white"), (360, 150), 300, 2)
pygame.display.flip()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
sys.exit(0)
Note that pygame uses the full colour-space of the screen, while the example BASIC only uses indexed 8-colour mode, so I had to work hard to generate the right colours (which don't agree with the RaspPi implementation.) Also the coordinate systems don't agree and I couldn't be bothered to research and re-jig the maths too much. There's a certain amount of boiler-plate code at the end to keep the screen open and visible.
Back at you: convert this to BASIC:
Code: Select all
ages = {}
ages['Sue'] = 23
ages['Peter'] = 19
ages['Andrew'] = 78
ages['Karen'] = 45
print "The dictionary has", len(ages), "entries in it"
if ages.has_key('Sue'):
print "Sue is in the dictionary. She is", ages['Sue'], "years old"
else:
print "Sue is not in the dictionary"
names = ages.keys()
print "The following people are in the dictionary:"
print names
print "and in alphabetical order:"
names.sort()
for name in names:
print " ", name, "is", ages[name], "years old"
Re: BASIC - more harmful than useful?
Posted: Thu Jan 24, 2013 1:24 am
by DavidS
I am working on that convertion, may take a couple of hours (I have to decode the meaning of the python first

, Especialy the intended data types [yuck] ). Though I will ask for a second opinion here, I did not expect it to be that dificult to understand functionaly.
The examples you gave are interesting, would you mind posting them completely as I noticed that you used some language extensions through the import sys and import pygame statements (No extension in the BBC BASIC verients).
As soon as I succeed at reerse engineering your python, and post the BASIC, there after could I ask you to tacle the examples from The Biginners guide to the wimp?
Re: BASIC - more harmful than useful?
Posted: Thu Jan 24, 2013 2:15 am
by DavidS
I have figured out your source. Your hiding a ton of it behind an class that is NOT SHOWN completely here, I have learned by teaching kids, that KIDS DO NOT LIKE IT WHEN YOU ARE HIDING THESE THINGS FROM THEM, they will ask question after question about what is making this work, basic gives enough control to prevent this until they learn enough to see assembly.
Still workig on the convertion; reimplementing the methods that you are hiding. Could I see this with its full source please (not 99% of it behind class). The only library function I am using in BBC BASIC is PRINT. You have hidden sort method (I assume implemented as a string form of QuickSort?) and has_key method and key method and the lack of any indication of data flow.
So while I finish this conversion I ask this to be a fair contest and show the full source of your hidden methods.
Heck I cold do the same trickery in BBC BASIC and use an external BASIC library. Though I am NOT going to do that unfair for this kind of contest) and since you hid yours I Have to implement my own versions of the routines.
Re: BASIC - more harmful than useful?
Posted: Thu Jan 24, 2013 2:54 am
by jojopi
DavidS wrote:The only library function I am using in BBC BASIC is PRINT.
That is a statement, not a function. And it is part of the language, not a library. Nobody would expect to see the source for the interpreter, or the MOS' VDU driver, for your program to be complete.
Dictionaries and lists are intrinsic types in Python, and sort is a built-in method of list.
Even integers in Python are more powerful than you may be used to:
Code: Select all
>>> print 2**128
340282366920938463463374607431768211456
Re: BASIC - more harmful than useful?
Posted: Thu Jan 24, 2013 4:25 am
by DavidS
Its has been years since I had given Python a serious look. And if it considers types that require large classes to manipulate to be intrinsic I will never give it another look, this makes it at least as bad as JAVA. Try teaching a young kid a language that hides so much behind "Standard" class types, and you will turn them off to programming, good luck you are going to need it with the kids that you teach.
Re: BASIC - more harmful than useful?
Posted: Thu Jan 24, 2013 5:30 am
by jojopi
DavidS wrote:Try teaching a young kid a language that hides so much behind "Standard" class types, and you will turn them off to programming,
I am not quite sure why you are putting "standard" in scare quotes. We are not talking about unusual facilities here unless you really are stuck 25 years in the past.
Of course making languages more powerful does have its downsides. But I think it would be extremely difficult to argue that sorting a list is something the programmer should be forced to spell out step by step. Interpreted bubble-sort is very inefficient.
Re: BASIC - more harmful than useful?
Posted: Thu Jan 24, 2013 6:14 am
by tufty
jojopi wrote:DavidS wrote:Try teaching a young kid a language that hides so much behind "Standard" class types, and you will turn them off to programming,
I am not quite sure why you are putting "standard" in scare quotes.
I am.
jojopi wrote:We are not talking about unusual facilities here unless you really are stuck 25 years in the past.
I think you've grasped it, actually. David believes that one should learn BASIC, then assembly. Then stop learning.
Regarding sorting, implementing different sorts /is/ useful, but only when you're starting to understand what "big O" means. Before then, you either sort (using an inbuilt sorting function), or you don't.
Re: BASIC - more harmful than useful?
Posted: Thu Jan 24, 2013 7:46 am
by rurwin
In the second example I used a library. It is one that is on every RaspPi. The BASIC uses exactly the same functions --- draw rectangle, draw circle -- but they are built in to the language. You act as if that is perfectly normal.
In the Python code I used nothing except a built-in data type. There are no imports in that program, no libraries. But suddenly I am cheating.
Why is it OK for you to hide huge complexity but not me?
Personally I'd rather teach a child to program an associative memory than Bresenham’s algorithm for lines and circles.
Re: BASIC - more harmful than useful?
Posted: Thu Jan 24, 2013 12:15 pm
by DavidS
@ruwin:
Sorry about the delay, I have been working on the USB in RISC OS, and got myself distracted. I will try to get my responce posted later today (it is 06:09 am here).
Yes I accept the library in the second example becaus simular library functions are used in the BASIC version. I do not know how long it has been since you looked at the BASIC standards, though I have the hard copy of the BASIC standard (old one [1984 printing]) and any input, output, and the standard Math and String lib functions, etc are considered to be Library functions in BASIC.
I recommend the examples from the WIMP tutorial becouse except for those that use File IO most of them do not use any library functions (not even PRINT which is defined as a library function in the BASIC standard), though call the OS directly.
Re: BASIC - more harmful than useful?
Posted: Thu Jan 24, 2013 2:21 pm
by rurwin
Here's a combination of two: The "one-line" multi-tasking app and opening a basic window.
Code: Select all
import Tkinter
def noise(widget):
widget.bell()
widget.after(1000, noise, widget)
root = Tkinter.Tk()
root.title('Demo')
root.after(1000, noise, root)
root.mainloop()
I am reminded of Doctor Johnson. He was once walking with a friend in a part of London where the houses overhung the narrow street, when they observed a couple of women leaning out of the upstairs windows of opposite houses, throwing insults and kitchen implements at each other. "They will never agree," observed the good doctor, "as they are arguing from different premises."
I see the code on the
Opening Windows chapter and am horrified at the thought of teaching kids the bit-mangling and pointer maths necessary to get a simple window on the screen. Whereas you see me using a standard, universally accessible library to render it down to the above code as hiding stuff they need to know. And to be honest, that's an argument I am never going to win because there is no screen handling at all in the Linux kernel, much less windows handling. At it's root, putting a window on the screen is done by Xlib, it's still a library, it's still in user-space, and nobody ever uses it because it is too low level.