shirro
Posts: 248
Joined: Tue Jan 24, 2012 4:54 am

Re: Educational Programming Language

Thu Mar 22, 2012 1:45 am

andyl said:


1. It is easy to write bad code in Javascript.  There is a lot out there by supposedly experienced developers which is bad.  The language design is far too lax about some things.


It is easy in most languages but Javascript does have some additional things to avoid. You really need to write in a subset of Javascript. Tools like jshint help a bit. Compile to Javascript languages such as CoffeeScript get rid of many of the iffy bits but then it is harder to debug.


2. The prototype based languages seem a little off the beaten track.  The terminology is different.  Few will have had much exposure to idiomatic usage of prototype based languages.


Different isn't worse. I think class based OO has become a religion amongst some people.


3. Some quite poor books on the language.  Plus quite a poor spec.


No arguments there. Though there are really bad books on most programming languages.

Javascript wouldn't be my top recommendation based in its merits as a language though there are plenty of things it does cleanly and easily that would be a pain in a language like Java. The main reason I would suggest considering it (secondary to Python) is that it is embedded in a number of places which might make for interesting projects.

Jaseman
Posts: 302
Joined: Tue Jan 10, 2012 12:59 pm
Contact: Website

Re: Educational Programming Language

Fri Mar 23, 2012 11:51 pm

They're all educational. Pick one and get on with learning it rather than trying to convince each other which is best:

http://en.wikipedia.org/wiki/L....._languages

User avatar
abishur
Posts: 4477
Joined: Thu Jul 28, 2011 4:10 am
Location: USA
Contact: Website

Re: Educational Programming Language

Sat Mar 24, 2012 4:58 am

One thing that has always surprised me is once you learn a programming language it's infinitely easier to learn a second.  Good programming skills leapfrog across the different options so like Jaseman said, it's hard to go wrong.
Dear forum: Play nice ;-)

CarlGundel
Posts: 31
Joined: Wed Mar 21, 2012 9:53 pm
Contact: Website

Re: Educational Programming Language

Mon Mar 26, 2012 1:38 pm

"1. It is easy to write bad code in Javascript.  There is a lot out there by supposedly experienced developers which is bad.  The language design is far too lax about some things."

It's easy to write bad code in any language.

"2. The prototype based languages seem a little off the beaten track.  The terminology is different.  Few will have had much exposure to idiomatic usage of prototype based languages."

Off the beaten track can be a very, very good thing.  If you've got the cycles you should try to teach two or more very different languages.

andyl
Posts: 265
Joined: Tue Jan 10, 2012 11:05 am

Re: Educational Programming Language

Mon Mar 26, 2012 3:38 pm

CarlGundel said:


"1. It is easy to write bad code in Javascript.  There is a lot out there by supposedly experienced developers which is bad.  The language design is far too lax about some things."

It's easy to write bad code in any language.


True to an extent.  It is just that I think javascript makes it too easy to write bad code.  That some of poor choices were made during its design.


"2. The prototype based languages seem a little off the beaten track.  The terminology is different.  Few will have had much exposure to idiomatic usage of prototype based languages."

Off the beaten track can be a very, very good thing.  If you've got the cycles you should try to teach two or more very different languages.


Yes, off the beaten track can be a good thing.  However as an educational language it isn't.  Unless the teachers have access to some good sources of information, and community, for a language then teaching it is probably not going to be ideal.  Even self-directed learning will be difficult without access to good quality information.  Whilst there does exist good information for Javascript it is swamped with lots of pretty poor information.

shirro
Posts: 248
Joined: Tue Jan 24, 2012 4:54 am

Re: Educational Programming Language

Mon Mar 26, 2012 10:16 pm

If Javascript is good enough for Stanford CS101, it is probably good enough for school kids if they have the right teacher and course. There are some good pragmatic reasons to consider Javascript on the Pi, the main one being Qt and QML. You can write a complete GUI program in Javascript and run it in qmlviewer from the console with full access to the Raspberry Pi graphics capabilities without having to endure the pain of unaccelerated X windows.

And you can still do comp-sciencey SICP style stuff which would be impossible in older languages such as BASIC. As long as the instructor starts with reading Javascript the Good Parts it isn't that bad.

All languages have their warts. Even Python. Javascript isn't a bad pragmatic choice. If I was a teacher I would go with it over superior languages. If you have to cover browser client side eventually anyway why not get in to Javascript early and learn how to use it properly instead of swapping languages all the time.

User avatar
johnbeetem
Posts: 945
Joined: Mon Oct 17, 2011 11:18 pm
Location: The Mountains
Contact: Website

Re: Educational Programming Language

Mon Mar 26, 2012 10:45 pm

shirro said:


If Javascript is good enough for Stanford CS101, it is probably good enough for school kids if they have the right teacher and course.


FWIW, here's the description for Stanford CS101:


CS 101: Introduction to Computing Principles

Introduces the essential ideas of computing: data representation, algorithms, programming "code" [sic], computer hardware, networking, security, and social issues.  Students learn how computers work and what they can do through hands-on exercises.  In particular, students will see the capabilities and weaknesses of computer systems so they are not mysterious or intimidating. Course features many small programming exercises, although no prior programming experience is assumed or required.  CS101 is not a complete programming course such as CS106A [Introduction to the engineering of computer applications emphasizing modern software engineering principles: object-oriented design, decomposition, encapsulation, abstraction, and testing. Uses the Java programming language].  CS101 is effectively an alternative to CS105 [Introduction to Computers for non-technical majors].
CS101 is obviously not a serious programming course and not intended to foster serious interest in programming or provide the basis for it.  I have higher hopes for Razzers.  I'm particularly amused by the term "code".

User avatar
SN
Posts: 1014
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
Contact: Website

Re: Educational Programming Language

Mon Mar 26, 2012 11:28 pm

CS101 is using Java NOT Javascript - this, I can subscribe too
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?

shirro
Posts: 248
Joined: Tue Jan 24, 2012 4:54 am

Re: Educational Programming Language

Tue Mar 27, 2012 12:16 am

John Beetem said:


shirro said:


If Javascript is good enough for Stanford CS101, it is probably good enough for school kids if they have the right teacher and course.


FWIW, here's the description for Stanford CS101:


CS 101: Introduction to Computing Principles

Introduces the essential ideas of computing: data representation, algorithms, programming "code" [sic], computer hardware, networking, security, and social issues.  Students learn how computers work and what they can do through hands-on exercises.  In particular, students will see the capabilities and weaknesses of computer systems so they are not mysterious or intimidating. Course features many small programming exercises, although no prior programming experience is assumed or required.


CS101 is obviously not a serious programming course and not intended to foster serious interest in programming or provide the basis for it.


The Pi is a device for school kids. That course description sounds closer to the mark than the "serious" course for Java code monkeys.

I was pointing out that you can build an introductory course with a language like Javascript that is at about the right level for high school students. And you can cover a lot of comp science things you might in a good introductory CS teaching language like Scheme or Python. It makes a lot more sense than suggestions about BASIC, Fortran, Cobol, ADA or PHP that I see on these boards which are just crazy talk. It is arguably a better introductory language than Java, c++ or objective-c as you can reasonably cover it in the limited time allowed (not to mention closures - hello it's 2012).

I am not arguing Javascript is a great language, just that it is probably good enough if done right.

Along the same lines while I think Go is a great choice for an introductory compiled static typed language and is sort of an ideal counterpart to Python in the dynamic/scripting space it might not be the most pragmatic choice. OpenGL shader language is C-like. Most Linux libraries and the kernel are in C and the full source is available. It is a shame to waste that resource just as it would be a shame to ignore the web browser all for a bit of language snobbery.

tech_monkey
Posts: 130
Joined: Fri Mar 09, 2012 6:12 pm

Re: Educational Programming Language

Tue Mar 27, 2012 9:34 pm

Don't knock basic its a great way to start if taught properly.

I learnt Basic first on a ZX80, in those days you where kind of on your own. But with luck you would find someone else who had been doing something similar and you would compare notes etc.

I then moved to the BBC micro and loved it. Learned how to do structured programming in Basic and also how to attack the analogue to digital port with a soldering iron

At Tech I learnt assembler, and due to the BBC basic being able to handle assembler code without any hassle this wasn't that hard for me as I had been tinkering with Assembler already.

Then at Uni I learnt Pascal and more BBC basic. We where taught Pascal as it forces you to learn good habits such as structured programming. So another vote for Pascal.

With these tools I was able to pick up C pretty quickly,  but never really did a lot with it, other than convert some C programs to BBC basic. I was well into fractals and produced some pretty cool ferns. All based on C progs that I converted to BBC basic. Then once it worked in Basic I converted as much of it as I could to Assembler so it would run faster.

Then discovered VB and VBA and wrote some very complex logging and data extraction programs in Excel.

Don't knock those old programming languages. After all when you learn to drive you tend to do it on some 1litre car not some 2 litre sports car.

There are many companies that still use some very obscure computers running even more obscure OSes  and programming languages.  They will always need experts in these systems, some can't just be upgraded to newer systems.

As I have said elsewhere never under estimate flashing LED lights.  Getting kids to program the PI to flash some LED lights will get their interest. Then expand by getting them to turn it into a game.
http://www.casatech.eu

kdakin
Posts: 54
Joined: Sat Mar 24, 2012 7:20 am

Re: Educational Programming Language

Mon Apr 02, 2012 8:50 pm

I think that if you want to teach children or older students about computers it is ESSENTIAL to get them to understand how they work as early as possible.

That's a very simple and obvious concept and applies to most processes including the internal combustion engine - amongst other machines.

To demonstrate how a computer works requires the understanding of relative addressing. This is actually quite easy to teach simply using houses in a street - e.g.  the third house after the one with the green door. Now the student understands rudimentary pointer arithmetic already! Additionally the concept of variable fields can be easily taught with strings of empty boxes that can contain (to begin with), just alphanumeric characters  such as 0-9, A-Z and a few special characters.

Constants can be easily understood as boxes that are set up once and then not altered again. The boxes that can be altered endlessly are called variables.

Machine instructions - that can manipulate things in these boxes - can be numbered 0-99 (and live in "constant" or "variable" boxes themselves).

The syntax is usually right to left and the instructions do things like:-

001   0 - point to box 'n'

002   1 - set a character into the box pointed at

003   2 - point to next box

004   3 - do something else...

005   4 - repeat from 1 a number of times

etc.

Now that wasn't difficult was it?

So with an Assembler it becaomes quite simple really. What was missing in the early days was

1) the Assembler,

2) a decent line editor & an interactive I.D.E.

3) W.Y.S.I.W.Y.G. debugging & tracing tools (that show what's happening to the "boxes" step-by-step in response to the instructions).

That's the real reason why people mistakenly think Assembler is "hard" and why 90% of programmers today struggle because they don't really understand even the basics. Learning a HIgh level language first is a fundamental mistake.

Additionally, many high level languages use Math-like syntax which is much harder for non-mathematicians to grasp and (unless you already know the language and syntax, is harder to understand "at a glance" and is often quite "cryptic" in it's various attempts to reduce language keystrokes).

Object oriented languages are also not the best start for programmers as there are too many terms and concepts to acquire before programming can really begin ("hiding" various processes can hardly be conducive to learning either!)

When you have learned one Assembler language, conceptually you have really learned them all and can understand better how compiler's work.

In the early 1970's - as soon as computer monitors became generally available - I wrote a full-screen WYSIWIG debugger, complete with dynamic dis-assembler -  because I knew it made sense. It had step-by-step instruction mode, "pause" (breakpoints) and many of the features found on modern IDE's and eliminated memory "dumps" and all program "crashes" at a stroke. It also gave complete memory protection avoiding earlier "buffer overflow" problems that plague some systems even today. It supported many high level languages and I experienced first hand how most high level programmers struggled to understand what their programs were doing at a fundamental level. This is sadly still largely true.

I am just completing the testing of an integrated I.D.E. & emulator that allows any .NET supported machine (including Mono supported) to execute IBM S/390 application programs. This means that owners of the Pi will be able to effectively run IBM mainframe programs on the Pi with Linux (as well as on Windows Operating Systems for instance). They will be able to use a fully compliant / compatible IBM HLASM Assembler (directly on the Pi or on a Windows system)  to create IBM Assembler programs that execute at close to native speed on the Pi. These Assembler programs will additionally be able to invoke .NET library functions, using a "standard" API call and will be fully protected against memory overwrites.

Why am I doing this? Partly to assist a new wave of young programmers to really understand what's really going on in the machine - because it purposefully incorporates many automatic "visualizers" that show actual relationships  between low level instructions, variables and the internal representation of data items (and of course, the processes that make them do things).

I am able to do all this because I learned Assembler language in 1968 and can still remember each and every instruction on all the evolving IBM machines ever since. It was excellent grounding for me and it didn't stop me learning a host of other languages along the way and appreciating the differences between them all.

So what will this emulator program be called ? Answer : "PI-ZZA" and you will be able to get a slice of it very soon!

kdakin
Posts: 54
Joined: Sat Mar 24, 2012 7:20 am

Re: Educational Programming Language

Tue Apr 03, 2012 7:47 pm

tech_monkey said:


As I have said elsewhere never under estimate flashing LED lights.  Getting kids to program the PI to flash some LED lights will get their interest. Then expand by getting them to turn it into a game.


I couldn't agree more. I suggested this in another post here and it was poo-poo'ed as "fluff". It is not fluff, it is the nearest thing to something "tangible" that you are likely to get (cheaply) from a $35 device. Look at the vast number of LED's they pack onto even the cheapest torches these days! The price per LED must be truly miniscule.

I was attracted by flashing lights on mainframe computers and I guess I was not the only one! I was also immediately frustrated by the fact that I couldnt "see" the computer executing - so I "invented" (software) step-by-step instruction stepping and other debugging techniques  so I could watch it execute (necessity is the mother of invention after all).

It was observing the physical "head thrashing" on old (westminster) hard disks that made me realize that performance optimization was very important. They literally almost moved across the floor (just like overloaded or misbalanced washing machines do today. Come to think of it, the 2314 and 3330 disk cabinets looked very much like washing machines anyway).

This led to me always looking at ways to minimze head movement with consequent dramatic improvements to run times (and reduced wear and tear on the disks!). I don't suppose you get much "head movement" in SD cards today though - so we will have to look for other "less tactile" methods for speeding up the Pi.

Incidentally, a sure way to notice tight "loops" on mainframe software was to observe all the lights on the console to suddenly go "solid". I guess this could still apply to the Pi if it was 100% CPU bound? It would at least show kids it was doing something that made it think hard!

User avatar
gordon@drogon.net
Posts: 2022
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website Twitter

Re: Educational Programming Language

Thu Apr 05, 2012 6:22 pm

kdakin said:


tech_monkey said:


As I have said elsewhere never under estimate flashing LED lights.  Getting kids to program the PI to flash some LED lights will get their interest. Then expand by getting them to turn it into a game.


I couldn't agree more. I suggested this in another post here and it was poo-poo'ed as "fluff". It is not fluff, it is the nearest thing to something "tangible" that you are likely to get (cheaply) from a $35 device. Look at the vast number of LED's they pack onto even the cheapest torches these days! The price per LED must be truly miniscule.



Sorry … couldn't resist

//
// Flashing Led Technology...
//
PROC setup
delay = 0.1
//
// Knight rider/Cylon
//
CYCLE
PROC led(1, TRUE)
WAIT (delay)
PROC led(2, TRUE)
WAIT (delay)
FOR i = 3 TO 8 CYCLE
PROC led(i, TRUE)
PROC led(i - 2, FALSE)
WAIT (delay)
REPEAT
PROC led(7, FALSE)
WAIT (delay)
PROC led(8, FALSE)
WAIT (delay)
//
// and back again
PROC led(8, TRUE)
WAIT (delay)
PROC led(7, TRUE)
WAIT (delay)
FOR i = 6 TO 1 STEP -1 CYCLE
PROC led(i, TRUE)
PROC led(i + 2, FALSE)
WAIT (delay)
REPEAT
PROC led(2, FALSE)
WAIT (delay)
PROC led(1, FALSE)
WAIT (delay)
REPEAT
END
//
// PROC setup:
// Clear the screen and put up the LEDs
//
DEF PROC setup
HGR
col0 = Black // Off Colour
col1 = Red // On Colour
rdius0 = GWIDTH / 16 - 18 // Outer
rdius1 = GWIDTH / 16 - 20 // Inner
hStep = GWIDTH / 8
hOff = hStep / 2
vPos = GHEIGHT / 2 // Vertical middle of the screen
FOR i = 1 TO 8 CYCLE
PROC led(i, FALSE)
REPEAT
ENDPROC
//
// PROC led:
// Turn an LED on or off
//
DEF PROC led(led, state)
IF state THEN // Turn it ON
COLOUR = col1
CIRCLE (hStep * led - hOff, vPos, rdius1, TRUE)
ELSE
COLOUR = col1
CIRCLE (hStep * led - hOff, vPos, rdius0, TRUE)
COLOUR = col0
CIRCLE (hStep * led - hOff, vPos, rdius1, TRUE)
ENDIF
UPDATE
ENDPROC

Screenshot (one day I'll work out how to do a video!)



Edit - well found out how to record windows so there's a video here, but I don't know if it'll display. Youtube next, I guess!
--
Gordons projects: https://projects.drogon.net/

User avatar
gordon@drogon.net
Posts: 2022
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website Twitter

Re: Educational Programming Language

Fri Apr 06, 2012 3:39 pm

GordonH said:


Youtube next, I guess!


So I got my old camera out (and I mean old – 10 years, maybe time to treat myself to some thing new!) and made a video. Adapted the program a little – then run it and hooked it up to an arduino using my own remote control protocol from BASIC to control a bank of 10 proper LEDs!

Video Here

I re-wrote it to read is some DATA to represent the sequence. (Yes, it has been a dull bank holiday Friday!)

(sorry for the multiple edits - I seem to be failing to be able to insert a video )-:

This is what I"m going to do on my RPi when I get it – the BASIC will just work and I"ve no doubt that the remote control of an Arduino will just work too (it all already works via QEMU)

Cheers,

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

tritonium
Posts: 79
Joined: Tue Jan 03, 2012 7:10 pm

Re: Educational Programming Language

Fri Apr 06, 2012 11:10 pm

@GordonH

When can we get our hands on your  'Return to BASIC | Version 1.0' ?

It looks good - can you compile it to run on a PC? (for the time being)

Dave

(I hope thats not a stupid question...)

User avatar
gordon@drogon.net
Posts: 2022
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website Twitter

Re: Educational Programming Language

Sat Apr 07, 2012 8:38 am

tritonium said:


@GordonH

When can we get our hands on your  'Return to BASIC | Version 1.0' ?

It looks good - can you compile it to run on a PC? (for the time being)

Dave

(I hope thats not a stupid question...)



Hi,

Right now, it's x86 and ARM Linux only. I am looking into making it cross platform, possibly even this afternoon if I have time, so hopefully I'll have Win and maybe even Mac versions soon - I can test the Win version locally but will be relying on friends for the Mac version. (It's all fairly standard C with the SDL libraries, but I imagine the serial port stuff will be the tricky part, so I may just leave it out initially for the Win & Mac versions)

If you want to have a look, then start at http://unicorn.drogon.net/rtb/readme.txt but ultimately I'll be moving it all to my projects site (see link in signature block at bottom of page) My plan is to release the sources too - once I've stopped adding all the bits & pieces the people who're helping me test it keep on suggesting! (Associative arrays - in BASIC? Oh well, if you must...)

Cheers,

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

Chris.Rowland
Posts: 239
Joined: Thu Jan 12, 2012 5:45 pm

Re: Educational Programming Language

Fri Apr 13, 2012 9:45 am

What features of a language that makes it good for writing real-world applications would make it bad for educational purposes?

For application development I'm looking for things that make it easy for me to express the code structure clearly and obviously.  This apply to an educational language as well don't they?

And the converse, what features of a language that makes it good for teaching would make it bad for real-world development?

My feeling is that there's no difference.

User avatar
gordon@drogon.net
Posts: 2022
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website Twitter

Re: Educational Programming Language

Fri Apr 13, 2012 10:25 am

One of the things I was looking at was the "entry level" to get people interested in programming. More than than the language - to an extent.

So - BASIC - turn it on and its there. Type in a 10-line program with line numbers and it's relatively easy and easy to explain to people.

Almost anything else requires "more". So Python/PHP - although they have an interactive mode, it's not quite an environment where you can store programs, list, edit and run them. (at least not that I'm aware of!)

The next step up might be to use an editor to edit a file, then a compiler/interpreter, but that then needs more knowledge of the system, the filing system, commands or buttons to push.

I also feel that an IDE is just "too much". At least some of the main-line ones I've seen. Your presented with a screen with many windows - possibly a bit overwhelming for a complete newbie, however at the bottom IDE end is the thing the Arduino runs under - it's just an editor with a "run" button - and that "run" button does the compile, download for you.

So where do you start?

Or where do you take a complete newbie?

I think you need an environment where you can very quickly see if they have the "knack" or "aptitude". If they have then great - they'll pick up other environments very quickly, but if not, then you've not really wasted much time with them, and they've not gotten so fed-up that they become bored and disruptive.

But if this enviroment also helps to teach the basics of programming - procedures/functions and structured flow-control, then so much the better. Pascal was hailed as a great teaching languge when I was at school/uny, but I actually found it very limiting as traditional Pascal's IO was horrible. However Pascal needed the environmet to go with it - the editor, compiler (linker) and so on.

I also feel that an environment with lots of seemingly arcane symbols can also be a bit overwhelming for newbies too. Even python being promoted as a teaching language - forcing a newbie who can barely type to indent things in a particular way or that the dot is significant because it separates objects (what?) and so on.

Possibly I'm underestimating todays newbies though - I don't know, but I do know that if I was presented with Python or C as my first programming language 35 years ago, I'd probably not be a programmer today.

So I think there's space for an introductory language, one that is capable of writing big applciations in (if desired, but discouraged), but one that encompasses modern programming techniques, making the transition from that to "production" languages easier.

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

User avatar
johnbeetem
Posts: 945
Joined: Mon Oct 17, 2011 11:18 pm
Location: The Mountains
Contact: Website

Re: Educational Programming Language

Fri Apr 13, 2012 3:14 pm

Chris Rowland said:


What features of a language that makes it good for writing real-world applications would make it bad for educational purposes?

For application development I'm looking for things that make it easy for me to express the code structure clearly and obviously.  They apply to an educational language as well don't they?

And the converse, what features of a language that makes it good for teaching would make it bad for real-world development?

My feeling is that there's no difference.


I'd immediately compare C and Pascal.  Pascal IMO has a much friendlier, more conversational syntax "if <condition> then begin <bunch of statements> end else begin <bunch of statements> end".  C has a much more concise syntax, better suited to people who don't type fast: "if (<condition>) {<bunch of statements>} else {<bunch of statements>}".  But the real power of C comes from idioms like:

while (*s++ = *t++) /*nop*/;

Very concise, except for explaining the syntax and semantics to the learner: (1) That semicolon is necessary, in fact syntactically it's a [null] statement.  What's a null statement?, I hear you cry.  (2) The assignment expression has a value which is used as the condition.  What's an assignment expression and why isn't it a statement?  I'm confused.

In real-world applications, an experienced C programmer can use the elegant expression notations to write very compact, very efficient code, but it takes a lot of experience to get there.  IMO it's best to get some of that experience from a language better suited to teaching before tackling the intricacies of C.

Orchard
Posts: 2
Joined: Fri Apr 13, 2012 2:26 pm
Contact: Website

Re: Educational Programming Language

Fri Apr 13, 2012 4:38 pm

From what I can see the Pi environment is not the same as the ZX80, Vic20 etc that I cut my teeth on. Switch those on and all you get is a flashing cursor. You had to learn absolutely everything to get it to be anything other than a doorstop. I am sure we can now come in at a higher level and still be modern newbie level. My kids understand iPhones, Google, YouTube etc, whereas I had TV with 3 channels (by permission!) and not everyone I knew had a phone at home. Things have changed a bit.

It's the WOW factor that's important. The thing that hooked me into computers was a program my uncle wrote that could write your name in random locations around the screen on a ZX80. How cool was that! You need instant results - turn on a light, make a motor spin, play a song - who cares what it is, as long as the kids can say "I did that".

The point is you want to capture their imagination and get them to understand simple concepts like decision making, repetition etc. Once they discover their love of programming THEN they can go on and find out if Python is better than Ada, or whatever.

So, whilst my kids have more technology within reach than I could ever have dreamed of, they have no clue how it works at anything other than "You type this and click the UPLOAD button". That's the point behind the Pi - to spark interest and enthusiasm. I expect you could get any language on Pi, if you wanted it, but a first educational language must be simple to program simply with tangible results.

I am SOOOO looking forward to getting my Pi - it is going to be ace!

User avatar
gordon@drogon.net
Posts: 2022
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website Twitter

Re: Educational Programming Language

Fri Apr 13, 2012 6:22 pm

Orchard said:



It's the WOW factor that's important. The thing that hooked me into computers was a program my uncle wrote that could write your name in random locations around the screen on a ZX80. How cool was that! You need instant results - turn on a light, make a motor spin, play a song - who cares what it is, as long as the kids can say "I did that".


I think that's very important - it'll get them intersted very quickly in thinking that the computer is something that they can control rather than something they can just use. Sure, the technology behind swiping a screen/thing on a modern smartphone is pretty cool in it's own right, but just that first 'hello' program is good too.

100 CLS
110 CYCLE
120 HTAB = RND (TWIDTH)
130 VTAB = RND (THEIGHT - 1)
140 TCOLOUR = RND (16) + 1
150 PRINT "Gordon"
160 REPEAT


Ok, save a line by using a GOTO, sosueme

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

Chris.Rowland
Posts: 239
Joined: Thu Jan 12, 2012 5:45 pm

Re: Educational Programming Language

Sat Apr 14, 2012 10:54 am


John Beetem said: But the real power of C comes from idioms like:

while (*s++ = *t++) /*nop*/;


I'd forgotten about pointers in C

I would avoid that sort of pattern in real world applications because it's barely maintainable. It assumes a really experienced C developer, I'm not sure I know when it stops.

I'd only use that in a really time critical place where it's worth the extra time it will take to get it just right.

My first language was Algol and even as a first language I found it's verbose nature to be a nuisance. My second was FORTRAN and it was a great day when I got my hands on ratfor and could use curly brackets and abandon line numbers and GOTO!

What seems to be coming out from this is that the important thing for education is not so much the language as the development environment.

It needs to be quick to write simple code fragments and get instant feedback - the WOW factor.

It needs good feedback when there are errors.

It needs good, easily available, descriptions of the language, expressed in ways that make sense to the beginner.

It needs to be easy to save and load programs so they can be kept and extended easily.

Stepping, breakpoints and examining variables are very useful, especially as things get bigger.

The big difference I see with real world development is that applications tend to be much bigger, have more interlocking parts and have a longer lifetime - thus requiring maintenance.

An IDE I find really nice, but lightweight is for the PICAXE. It's a free download and has a simulator so people can try it without having to buy the chips.

http://www.picaxe.com/Software.....ng-Editor/

I'm not trying to push a rival here, I think there's virtually no overlap.

User avatar
gordon@drogon.net
Posts: 2022
Joined: Tue Feb 07, 2012 2:14 pm
Location: Devon, UK
Contact: Website Twitter

Re: Educational Programming Language

Sat Apr 14, 2012 11:20 am

Chris Rowland said:



John Beetem said: But the real power of C comes from idioms like:

while (*s++ = *t++) /*nop*/;


I'd forgotten about pointers in C

I would avoid that sort of pattern in real world applications because it's barely maintainable. It assumes a really experienced C developer, I'm not sure I know when it stops.


As a long-time C programmer, it's obvious to me that it's a copy of some sort, but without knowing the size of *s & *t it could be copying anything. It stops when the expression evaluates to zero which is when the last item copied is zero.

The issue I have with that is that s and t read (to me) as 'source' and 'to', so it's the wrong way round, but I suspect John wasn't really thinking of that when he typed it in as an example!


I'd only use that in a really time critical place where it's worth the extra time it will take to get it just right.


I'd probably use strcpy() if it's a string being copied - e.g. it might be quicker to copy words at a time, then do the initial & last 1,2 or 3 bytes via character pointers - using the system functions hopefully helps make use of architechure specific stuff like that which you often don't really care about!


My first language was Algol and even as a first language I found it's verbose nature to be a nuisance. My second was FORTRAN and it was a great day when I got my hands on ratfor and could use curly brackets and abandon line numbers and GOTO!


Oddly enough I looked at Algol (briefly) after BASIC, and another Algol derived language called IMP... But after being force-fed Pascal (& FORTRAN & COBOL) and then finding out about C, I sort of didn't look back and abandoned everything after that

Actually not quite as I didn't have the means to write the stuff I was working on at the time (30 years ago) in C, but I did do a huge amount in BCPL on the BBC Micro...


What seems to be coming out from this is that the important thing for education is not so much the language as the development environment.

It needs to be quick to write simple code fragments and get instant feedback - the WOW factor.

It needs good feedback when there are errors.

It needs good, easily available, descriptions of the language, expressed in ways that make sense to the beginner.

It needs to be easy to save and load programs so they can be kept and extended easily.

Stepping, breakpoints and examining variables are very useful, especially as things get bigger.


So you've just described BASIC


The big difference I see with real world development is that applications tend to be much bigger, have more interlocking parts and have a longer lifetime - thus requiring maintenance.

An IDE I find really nice, but lightweight is for the PICAXE. It's a free download and has a simulator so people can try it without having to buy the chips.

http://www.picaxe.com/Software.....ng-Editor/

I'm not trying to push a rival here, I think there's virtually no overlap.


Intersting. Looks like it's a glorified macro assembler with BASIC-like instructions..

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

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

Re: Educational Programming Language

Sat Apr 14, 2012 12:14 pm

GordonH said:


Chris Rowland said:



John Beetem said: But the real power of C comes from idioms like:

while (*s++ = *t++) /*nop*/;


I'd forgotten about pointers in C

I would avoid that sort of pattern in real world applications because it's barely maintainable. It assumes a really experienced C developer, I'm not sure I know when it stops.


I'd probably use strcpy() if it's a string being copied - e.g. it might be quicker to copy words at a time, then do the initial & last 1,2 or 3 bytes via character pointers - using the system functions hopefully helps make use of architechure specific stuff like that which you often don't really care about!


I can read that pattern without any confusion, but the issue I would have with it is that it is dangerous; if that zero terminator is missing for some reason it will zoom off into who knows where.

There's a lot of rubbish talked about how efficient C is. It has the language constructions, but that has almost no effect on the executable code that is produced, and, as Gordon says, even if it did it isn't necessarily the most efficient way to write it on a given machine.

I once wrote something like the following statement:


x[<expr1>] += <expr2>;


and found that the compiler planted code to evaluate <expr1> and the address of the array element twice. If I  remember correctly this was on MS C version 6 (the one before it became Visual C) and optimisation was switched off. It proves not that MS write bad compilers, they don't, but that the C syntax does not lead to efficient programs; good compilers lead to efficient programs. The sorts of idioms that C allows are only a small fraction of the sorts of optimisations that any compiler has to make in any program. Without those optimisations even a C program would compile to be more than twice the size and less than half the speed. When it makes those optimisations the compiler is not looking at your terse C code, it is looking at an abstracted representation of the operations to be carried out which has only a vaguest similarity to what you wrote. Being able to express an algorithm in compact form helps the programmer, not the compiler.

And of course it does not help the programmer. Take a look at this code:

    while (s[i++] =  t) /*nop*/;

Do you fancy finding that bug, which of course only manifests on the third machine you port the code to?

Return to “General programming discussion”