Beefy Boxes and Bandwidth Generously Provided by pair Networks
Welcome to the Monastery
 
PerlMonks  

Re: Re: Perl as a teaching aid

by Vynce (Friar)
on Jun 25, 2001 at 12:02 UTC ( [id://91209]=note: print w/replies, xml ) Need Help??


in reply to Re: Perl as a teaching aid
in thread Perl as a teaching aid

If this script is intended to teach perl, or programming in general, then i agree that there are things here the students should not learn. I also think that, in that case, the for(;;) loop should be made legible. However, i got the idea that this perl was for something else; he did, after all, say it was a teaching aid, not an aid for teaching perl.

Spacewarp's script is much more readable for a student, i think. As such, it is better for making a point that can be easily followed about the nature of binary mathematics. If the algorithm was, in fact, presented in class as he coded it, then it is an accurate representation of the algorithm the teacher picked; since representing that algorithm was one of the stated goals, that's a good thing, even if the algorithm was bad. After all, you don't teach someone the french for "I went to the store" is "J'irai au cinéma" just because they should go to a movie instead. (This may seem like a nitpick, but i was given a few such programs to "learn" from and they drove me up a wall, because they did things totally unlike what they were said to do.)

And, really, if we're talking about a better algorithm, you should start with whatever power of two is the first one under the target number IMO. (int (log($n)/log(2)))

But to return to my point, i think his perl was not to teach perl, but to introduce them to the basic idea of programming. Actually, it might be a neat recurring theme for the class; take this bit of code and change it as they learn more code concepts, to include subroutines and be able to split things into different bases (ord(A) in trinary looks very different than ord(A )in binary...)

just my take.

thanks to OeufMayo for the french snippet.

.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: note [id://91209]
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others goofing around in the Monastery: (2)
As of 2024-04-24 23:28 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found