Deutsche Welle news article on Raspberry Pi - "Raspberry Pi and the new computer science kids"

On Sat, 20 Apr 2013 13:45:19 +0000 (UTC), Gordon Henderson declaimed the following in comp.sys.raspberry-pi:

But many implementations had arrays with one extra row/column/plane...

DIM x(10)

allocated 11 elements, indexed from 0 up to and including 10

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber
Loading thread data ...

How is that an extra? DIM x(10) doesn't say how many elements, it sets the highest element. Arrays start at "0". Or at least that's what my

1983 Microsoft BASIC for the TRS-80 documentation says.

Alternatively, VAX BASIC specifically states that DIM X(10) creates an array of 10 elements numbered from 1 to 10.

UCSD Pascal's BASIC implementation starts at 0 and goes to the number in the DIM statement and is documented that way. On a bad note, it does support dynamic arrays (up to 10 elements) that do not have to be predefined. Looks like somebody didn't learn anything from Pascal.

I could look for others (I wish I knew where I put my Kemeney and Kurtz book) but I suspect they all document their behavior which means there are no "extra" array elements.

bill

--
Bill Gunshannon          |  de-moc-ra-cy (di mok' ra see) n.  Three wolves 
billg999@cs.scranton.edu |  and a sheep voting on what's for dinner. 
University of Scranton   | 
Scranton, Pennsylvania   |         #include
Reply to
Bill Gunshannon

A lot of the programs used in amateur satellite projects during the

1980s and early 90s were coded in BBC basic. They worked, and I don't recall anyone complaining that they were too slow or crash-prone.

The SuperBasic which came with the Sinclair QL was another structured basic, though not as well-implemented as BBC basic. GOTOs were never necessary in either, through the command was available.

Reply to
Hils

On 19/04/2013 19:18, Alan Adams wrote:> In message > The Natural Philosopher wrote: > >> On 19/04/13 17:07, Mark wrote: >> >> the most basic (sic!) thing is to get the idea of programming across >> quickly and easily. Basic does that. > >> Plenty of time to move on to structured approaches later when the >> deficiencies of BASIC make it perfectly clear why you should.. > > You can write good structured code in BBC BASIC. It has most of the > tools you would want. (Data structures are missing, but there are > freely available libraries which add that.)

You are joking?! BBC BASIC is just too basic to be of any use these days. It lacks objects, structures, rich types, dynamic memory and common libraries - just about everything you need from a modern language.

BBC BASIC's place was on a BBC Micro when you could write a useful text based program with a few lines of PRINTs and INPUTs to do menus, and chuck a some graphics in with MOVE and PLOT. That's when I learnt it, and it was great at the time.

But by the time we got to WIMP based systems, even those with simple APIs such as RISC OS, BASIC was inadequate. The lack of structures made every interaction with the OS a mess of indirection operators (not much better than PEEKs and POKEs), lack of dynamic memory severely limited what could be done, without going outside BASIC to implement a large swath of functionality. Anyone with any sense went the way of C and later C++.

If you use BASIC today all you'll learn is it's many failings, and wish you'd started on a modern language.

Any useful program these days is several order of magnitude larger than the BBC Micro days, it makes no sense to use a primitive language and re-invent every wheel every time, code reuse is the key. Object orientation makes for the best code reuse, and it makes sense to understand it before embarking on functional programming. Code reuse requires code, so building on top of rich set of libraries is essential, whether it is python, C++ with STL, Java, or even C# with .NET framework (mono on Linux of course).

Python on the Pi makes a lot of sense, you can start with a simple text based progams as easily as with BASIC, but it can grow with the user, with transparent dynamic memory management of arrays and list, introducing structures and objects, plus as vast set of libraries covering almost every aspect of programming you can think of.

Although it's syntax is quite different other C like languages which programmers may move on to, all the concepts learnt are readily transferable. Where as to move on from BBC BASIC, you'll be starting again from almost scratch, which is so many clinging to it despite it's unsuitability. Don't try to condemn another generation to that fate!

---druck

Reply to
druck

On 20 Apr 2013 18:47:51 GMT, snipped-for-privacy@server1.cs.uofs.edu (Bill Gunshannon) declaimed the following in comp.sys.raspberry-pi:

The "extra" is that one had to read the fine print of the implementation. Most textbooks that I'd encountered, OTOH, behave as if the DIM defined the number of elements, starting at "1". Few ever mention the possibility of zero-based indexing AND that "DIM x(1)" creates two elements (the logical extrapolation is that "DIM x(0)" should be valid and create an array of one element!). And toss a class of newbies the strangeness that "DIM x(10)" creates 11 elements from (0) to (10), and see how confused they become...

In contrast, FORTRAN would index from 1 to /n/, while C/Python and others index from 0 to /n-1/ -- the declared dimension defined the number of elements (okay, one doesn't declare dimensions in plain Python

-- but len(x) returns the count of elements, but x[len(x)] is an error as it is beyond the end of the zero-based indexing).

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

It's only strange or confusing if they don't already understand the basics. If a student can't grasp the concept of the first element being element zero then you've moved onto arrays far too soon. Go back to counting :)

Reply to
Guesser

And you wouldn't read the documentation for any other language you use? Do you know how many differnt (and incompatable) versions of Pascal there were?

And that would be the fault of the textbook writer and editor. Not the language or the implementation. If it didn't cost money I would look up what the ANSI Standard says about it. Not really relevant as all of the versions of BASIC I have ever used predate the ANSI standard but I would be curious.

And how would anyone know that if they didn't read the documentation? :-)

bill

--
Bill Gunshannon          |  de-moc-ra-cy (di mok' ra see) n.  Three wolves 
billg999@cs.scranton.edu |  and a sheep voting on what's for dinner. 
University of Scranton   | 
Scranton, Pennsylvania   |         #include
Reply to
Bill Gunshannon

It doesn't.

I'm saying start with a good HLL to help embed good practice. Later on look at lower-level languages to gain experience. I'll bet there are many professional programmers around now that don't even know what assembler is.

In my case it means well after computers were used in industry and well after home computers became available.

I've played with stuff but now I only have time to work with it.

Got a way to go before retirement, me :-(

--
(\__/)  M. 
(='.'=) If a man stands in a forest and no woman is around 
(")_(") is he still wrong?
Reply to
Mark

Anecdote #1; We recently "let go" our last IBM mainframe Assembler programmer. Then we needed him for something. I suggested that he come back as a contractor, charging a *lot* of money. (Think of a number, change up to the next order of magnitude & multiply by three.)

Anecdote #2: I recently went on a cell-phone hacking course which required a knowledge of ARM assembler. Only me (*) and one other person out of the 12 on the course had ever seen assembler before, much less worked with it. (* Things don't seem to have changed much since I was a PDP-11 MACRO-11 programmer.)

I would hope that the RPi would change this.

--
Today is Boomtime, the 39th day of Discord in the YOLD 3179 
           "Jesus died for somebody's sins, but not mine"
Reply to
Huge

Funny cause I did it pretty much the exact opposite way around, at least as far as "education" is concerned (I'd played with BASIC a bit but it was only playing around)

First proper programming I did was assembly language on PICs at secondary school and then C at university.

I came to programming from digital electronics rather than computer science though so my view of a computer is from the bottom up rather than the top down, maybe that makes a difference.

Reply to
Guesser

I did it this way round (formally at least)[1] and I wholeheartedly agree.

Programming concepts, methodologies, algorithms etc are best taught in a good quality HLL with lots of strict compiler flags etc to help you keep good habits[2] - so you can focus on learning the concepts.

Then once you've done that, move on to a less restrictive language like C (although these days, I think teaching C++ or Java is probably more useful if you're going to teach a C style language) with an encoragement to keep all those good habbits.

In parallel with this, some assembly language is useful from the point of view of learning how it all works under the hood (but IMHO that should also be accompanied by some material about architectures, instructionsets, pipelining etc) but outside of a few fairly niche areas (security, bios firmware, compiler design) it's not that widespread, so for a lot of students falls into the "I'm never going to use this, why should I learn it" hole.

All of the above can (and no doubt is/will be) taught with a Pi.

-Paul [1] Informally I wrote a lot of basic in various dialects, and some really noddy little 68K asm routines.

[2] I'm also an advocate for the idea that "you don't learn how to write good code, until you've maintained someone elses bad code"

If I were constructing a programming course, I'd make the first module "write something non-trivial which does X" - I'd then make the second module "now swap code with another student, and extend it to do Y"

--
http://paulseward.com
Reply to
LP

On 2013-04-22, LP wrote: keep all those good habbits.

Scheme, Prolog, SML, M4, and SQL when into that hole. Now I use SQL daily, and occasionaly regret not understanding M4 when called upon to deal with automake or sendmail.

yeah. it's also hard to write good code whrn thes specifications keep changing. (that's my excuse)

--
?? 100% natural
Reply to
Jasen Betts

;-)

In my current employment I sometimes have to fix bugs in other's poorly written code, sometime lacking any comments at all. Some of the code is so old that no-one can even remember what it is supposed to do!

--
(\__/)  M. 
(='.'=) If a man stands in a forest and no woman is around 
(")_(") is he still wrong?
Reply to
Mark

For me, Ada, scheme and lisp tick the "exposed to at university, never since" list, but each of those taught me another approach to solve a problem so they weren't all completely lost, even if I didn't understand that at the time.

But which dialect, because the wonderful thing about SQL is that almost every relational database does at least several things Its Own Way.

(Oracle, MySql, Postgres and MS SQL here, with a spattering of SQLLite. I hate them all, but in very different ways)

I'm not sure anyone *really* understands M4. Many claim to, but they're bluffing. Or deluded. I'm not sure which.

-Paul

--
http://paulseward.com
Reply to
LP

Back in the day, there was a really nice book: _Software Tools_ by Brian Kernighan and P.J.Plauger. In the days before personal GUIs it dealt with the major text-based tools that computers needed. A macro processor very much like M4 was one of them, and another was a pre-processor called Ratfor which accepted FORTRAN augmented by C-like control structures and output FORTRAN code to be compiled and run. All the programs in the book came with Ratfor source code and deep discussion of how the programs were developed.

After personal computers matured a bit, and a Pascal compiler was widely available, the authors wrote a follow-up _Software Tools in Pascal_ which included everything except the Ratfor.

Mel.

Reply to
Mel Wilson

A lot of my work requires the same SQL to work on more than one database vendor. Mostly this isn't too difficult to achieve.

LOL! I find the same thing with Perl - but then I haven't really tried very hard to learn it.

--
(\__/)  M. 
(='.'=) If a man stands in a forest and no woman is around 
(")_(") is he still wrong?
Reply to
Mark

Positively Egregious Religious Language.

-- Ineptocracy

(in-ep-toc?-ra-cy) ? a system of government where the least capable to lead are elected by the least capable of producing, and where the members of society least likely to sustain themselves or succeed, are rewarded with goods and services paid for by the confiscated wealth of a diminishing number of producers.

Reply to
The Natural Philosopher

Heh. The biggest headache I have when it comes to context switching my brain between SQL dialects is date handling (top tips gratefully received!)

Although you can use ANSI stuff for things like CURRENT_DATE instead of now() or SYSDATE, remembering what DATEPART elements are supported by which rdbms is a pain, and even when I can remember I invariably end up working on code where people have used things like TO_STRING() in oracle or DATE_FORMAT() in mysql

Bah. Stick it all in as epoch and let the application sort it out ;)

-Paul

--
http://paulseward.com
Reply to
LP

..and a very useful book that turned out to be, especially the education it provided in designing code modules for reuse (and then re-using them). I re-implemented virtually all of it in PL/9, a derivative of PL/M for the Flex09 OS, which ran on 6809 chips.

About the only books I've found that approach that in general usefulness are:

- "The Practise of Programming" (Plauger & Pike), which is excellent on designing programs for ease of understanding, debugging and maintenance.

- and "Algorithms" (Sedgewick), an excellent algorithmic cookbook that covers more material than "Algorithms + Data Structures = Programs" (Djikstra) while being a lot smaller than "The Art of Computer Programming" (Knuth).

--
martin@   | Martin Gregorie 
gregorie. | Essex, UK 
org       |
Reply to
Martin Gregorie

On Mon, 22 Apr 2013 11:02:22 -0400, Mel Wilson declaimed the following in comp.sys.raspberry-pi:

My college introduced a similar thing, TextFor (as I recall), to introduce structured programming on top of FORTRAN-IV. I was fortunate enough to have passed intro and advanced FORTRAN before this experiment.

TextFor lasted one year (if that much). It turned out that the use of the TextFor translator was sucking up more CPU time in one trimester than the entire year of COBOL-74 classes.

Oh, BTW, I still have my copy of that book... Along with Ledgard's Programming Proverbs...

--
	Wulfraed                 Dennis Lee Bieber         AF6VN 
        wlfraed@ix.netcom.com    HTTP://wlfraed.home.netcom.com/
Reply to
Dennis Lee Bieber

ElectronDepot website is not affiliated with any of the manufacturers or service providers discussed here. All logos and trade names are the property of their respective owners.