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

Perl High School

by hsweet (Pilgrim)
on Feb 22, 2002 at 01:13 UTC ( #146850=perlquestion: print w/replies, xml ) Need Help??
hsweet has asked for the wisdom of the Perl Monks concerning the following question:

Hi..Looking for some feedback/ideas/advice on my programming course. I've switched to Perl from VB and so far things look good. (Except for the bit where the guidance counselor and principal ask me why students drop out of the class). I got a couple of replacement students and it looks like the kids are starting to get it.

Were doing some simple games (rock scissors paper), CGI and some cute html tricks to start. I'm thinking about what would be a good project for the second half of the course. Text adventure game, Web game, TK stuff or maybe some object game where I can get the two or three more experienced kids to write some class modules that the other's use.

If anyone has any ideas for some stuff that would be fun but not too difficult for beginners I'd love to hear from you.

Also I'm posting my course at A work in progress. Covers basic stuff and has a set of assignments.

Ignorance with Confidence

Replies are listed 'Best First'.
Re: Perl High School
by Chmrr (Vicar) on Feb 22, 2002 at 02:15 UTC

    See Teaching a class and possibly Perl in school for related discussions. And ++ for posting your materials online -- it will be a boon to others attempting this after you.

    One of my crazier ideas is to attempt to teach the introductory CS class here at MIT, called 6.001 as a seminar or something -- in Perl. Some concepts may not map overly well, but it can probably be shoehorned. Anyways, we'll see if I actually carry through on that threat.

    I certainly wish you the best of luck with your class -- and do keep us (well, at least me) updated on how it's going.

    perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^`+*^e v^#$&V"+@( NO CARRIER'

Re: Perl High School
by cLive ;-) (Prior) on Feb 22, 2002 at 07:03 UTC
    Good luck with your project - I've just taken a look and it looks like it's going in the right direction.

    A few comments to keep you on your toes:

    • 'If' should be 'if'
    • for and foreach are exactly the same - they just make reading particular statements more natural
    • "While version" - $count += 1; also works - you might also want to cover ++$count and explain the difference between that and $count++ (hint - using print)
    • obscurated => obfuscated
      my $q = new CGI;

      Or rather:

      my $q = CGI->new;

      The indirect object notation will bite you at some point - please don't use it.


      "The first rule of Perl club is you do not talk about Perl club."
      -- Chip Salzenberg

        The indirect object notation will bite you at some point - please don't use it.

        Aw c'mon. People can get bit by indirect object syntax whether or not they use it intentionally. At some point, usually in the 10th hour of a codefest, a typo is going to trigger a cryptic  Can't locate object method "foo" via package "bar"
        error message.

        The only risk of using the syntax consistently is one might come to believe that new is special.

        If people stick with the new Package form, they're going to be just fine.

        dave - can you explain in a little more detail why not? No-ones pointed this out to me before...


        cLive ;-)


      I gotta print this out to parse out all the stuff you wrote. It looks great. Thanks for taking the time.
      I printed out your post. I see I have some re-writing to do. I'm wondering when and if to introduce objects. Thanks for all the detailed suggestions. VERY helpful.
Re: Perl High School
by erikharrison (Deacon) on Feb 22, 2002 at 19:59 UTC

    If you're contemplating using Tk, I'm going to assume (improperly, perhaps) that you've introduced them to the concept of libraries, maybe writing their own object classes.

    What I would find fun is to write text adventure game, where groups of students handle different parts of the game (the parser, the database, maybe a templeting system for the printed text). I would handle this by writing the main code myself, and defining all necessarry module API's as the instructor. Then, give each group the task of building a library or a class that implements the functionality and the interface your main code deams neccessarry. Perhaps you'd have to provide them with the data - the dictionary for the parser, etc.

    I think that this would allow them to bring together everything they know, and see how modular programming allows large groups to work on a single powerful applicationn without getting in each others way. Also, I think that it would make for an interesting microcosmic view of the open source community, working together on large programs, patch by patch. They could review each others code also, giving them debugging practice.

    I'd enjoy doing that project in class!

      If you do this at a high school you will be my hero. I would have killed for such a class in high school. Now that I think more and more about it this is completly 100% doable if you made it the entire focus of the class, and everyone would learn so much from it. And if they don't get finished, they get to learn about project deadlines a bit earlier than college :)

      Wow thats amazing.


Re: Perl High School
by Ryszard (Priest) on Feb 22, 2002 at 06:18 UTC
    How about some theory on good program design, and how to write doco 101?

    I cant count how many times I've needed to find some doco and realised it turned into vapour-ware from the project plan.

    I say you can never start brainwashing too early to produce doco.. :-)

•Re: Perl High School
by merlyn (Sage) on Feb 22, 2002 at 03:27 UTC
    You aren't the one asking how to make permutations, are you? I've seen that a half dozen times in the past few days, on CLPM, perl-beginners, and here! It's got to be a homework assignment from some class.

    -- Randal L. Schwartz, Perl hacker

      I didn't ask about that here, but I we did a factoral program the other week to get used to looping. I started to think about permutations but it made my head hurt..
      what's up with the dots?
        It allows Randal to keep track of any reply in one of his threads. Instead of putting "(merlyn)", he puts a dot. Much shorter, and far more noticeable.

        Jeff[japhy]Pinyan: Perl, regex, and perl hacker, who'd like a (from-home) job
        s++=END;++y(;-P)}y js++=;shajsj<++y(p-q)}?print:??;

Re: Perl High School
by zakzebrowski (Curate) on Feb 23, 2002 at 01:29 UTC
    Fun & not too dificult ideas:

    Use GD to draw a smiley face in a 500x500 square. Then have options buttons (on a html page) to tip the face sideways, upside down, change eye color, etc.

    Install a mysql database, use dbi::mysql to select information out of a database to take a survey.

    Use GD::Chart (forgot exact name) to plot students grades...

    Use image::world (er...) to plot where the parents of the students came from...

    PS. IMHO, I've always loved classes that go slightly beyond the scope of what the course is teaching...
    PSS. Looked @ your pages... looks like a good reference! :-)

      I like the gd idea since we are doing cgi. I'll check out image::world. New to me. Is it hard to use? Ignorance with Confidence
        The link to the module is here: image-worldmap -- it *should* be relativly easy to use this module. I tried to get it working on my linux platform at work for about 5 minutes, and it looked like I didn't have the right libaries installed or something... I think it's just a array list of lat and long positions, as I recall...

Re: Perl High School
by erikharrison (Deacon) on Feb 23, 2002 at 03:21 UTC

    Using experienced students in a programming class can be useful or daunting to the uninitiated. In my only programming class (high school) we were taught BASIC. Of course, I already knew BASIC from my old Timex Sinclair and Commodore 64, and there were a few guys who learned fast. We were 'Group 2', the advanced programming group. Essentially, we got to download shareware stuff for MS QBasic and take them appart, and every week or so, we'd report to the teacher. This was fun, and we often did large projects with one person coding the main loop, and everyone else pulling together the subroutines and functions.

    Unfortuntatly, this intimidated the other students, and they shied from programming as a whole - they couldn't see how we got to where we were from where they were. But eventually we went on to become tutors for the other students - much better classroom dynamic.

    I think having the class work on a program as a group would be fun - and a text adventure would be engaging without being too difficult. I think another advantage would be that you could avoid the problem my class had and still engage the advanced students - by giving them the more complex sections of code they get to both cooperate and work at their own level. This also gives all the students a chance to proof each others code and improve it, leading to better debugging skills.

    I think also an advantage of this progect is learning code reuse AND learning not to trust anyone's code - useful if they start downloading CGI programs! Or worse, trying to learn from some of them!

Re: Perl High School
by toma (Vicar) on Feb 23, 2002 at 06:12 UTC
    There were a couple of really good assignments that I had in high school. One was to write a program that generates poetry. Say in the most stern voice you can muster, "No dirty poetry!" and the students will instantly form a deep understanding of the project. The other hint is to mention to the students is that funny poetry uses funny words. Also, there is some advanced perl code available for your more ambitious students to study.

    Another assignment is to implement the board game "Battleship." This challenge is less interesting because it stresses the book-keeping aspect of coding. If the students have enough time to create a real game-playing program, it is very interesting, but it is a difficult assignment.

    I would like to see more posts about your experiences with teaching perl to high school students. It is something that I hope to try in a year or two. Please post again or msg me if you would like to share more ideas.

    It should work perfectly the first time! - toma

      Limericks? Shouldn't be too hard. I like the poetry idea a lot. I am trying to come at this from more of a language approach than from the math end. Check the course site occasionally. I'm quite liable to make it an assignment. Programming can be intimidating for beginners as can math so math + code = I quit.

      I thought of battleship already, (except for the how to do it parts). I'll post again eventually.

      I also plan to run some of the student's cgi scripts on my website. (Anybody interested in writing a page for the site or anything else, email me at

        The only problem with using Perl to write poetry is that TheDamian has made it into a one-liner... :-)
        perl -e 'use Coy; die "Just another Perl hacker,"'
Re: Perl High School
by archen (Pilgrim) on Feb 23, 2002 at 02:25 UTC
    I think I would stay away from TK myself. While many would appreciate being able to make a gui, messing with TK and perl gets messy (and frustrating fast) - well for beginners anyway.

    I really like the idea of a text adventure game. Especially considering you could create the more complex game engine yourself and let the students interface with it - thus allowing you to control the difficulty. Another reason, is that you can give the game a personality with little effort: basically they just have to change some text to give it some flavor. But then again I was sort of known for having smart ass input prompts, and error messages in my programs in college, so I'm partial to that sort of thing ;)

      Your probably right, especially since I've never used TK. I could use VB and start out with an easy to use visual enviornment. But then I'd be back where I was a couple of years ago.

      I'm leaning toward the adventure game where I write some of the harder stuff, probably as class or regular modules they can use. It might be a challange for me. Depends on how hard I want to make it. I have a couple of kids that seem to know a lot coming in. Might use them.

Re: Perl High School
by elusion (Curate) on Feb 22, 2002 at 23:29 UTC
    Whilst unrelated to Perl, this is definetely related to programming and high school. Make mention of basic programming for calculators. Writing math programs for my TI-83+ has been one of the biggest payoffs for me from my programming skills. I've made many one hour assignments take 10-15 minutes. Right now I have a program that graphs trigometric functions from A and B, also giving me the amplitude, period, xscl, and xmax.

    elusion :

Re: Perl High School
by Parham (Friar) on Feb 23, 2002 at 14:18 UTC
    In high school when we got to our second term projects, the teacher just said one thing, "make something, and make it interesting". We got to use whatever language we wanted, and do whatever we wanted to (as long as it was reasonable). I would suggest the same idea, ask them to do whatever they want to do. Without boundaries the programs you'll see come out of your students will be interesting. You have very lucky students hsweet :)
Re: Perl High School
by erikharrison (Deacon) on Feb 24, 2002 at 03:51 UTC

    Actually, a language which resembles English more than, say, Java or C is more intuitive - Perl only starts to get confusing when you start expecting things from it based on experience.

    And, in terms of functionality, Perl is more intuitive to people who don't have the same prejudices that veterens have. Dear God - can you imagine trying to deal with the fundamental nature of an orthagonal language when the students don't understand why you can't just DO it? To a newbie, there aren't layers to a computer - why can't I just make a window? Or clear the screen? I'm programming the computer, why can't I just tell it to do things that I know it can do? (this is one of the reasons VBasic is a strong contender where Win32 systems are the norm)

    The principles of programming should be established before we explain the concept of problem domains, or building archetecture before getting to the problem. The advantage is that Perl will be a usable skill to them if they pursue programmin - as opposed to a teaching language, which you never use again. Additionally, they can go out and write CGI scripts - the only kind of application that a newbie can write and have something productive occur.


      For students starting to learn rapid positive feedback is very helpful. This is why Logo and StarLogo are such good langauges for young (elementary school) children. Perl is a good choice because you don't have to set up all that much to get something useful out of it. Kudos to hsweet for thinking of it and having the courage to run with it.

      Java is probably a really bad choice for kids, because even very trivial Java programs need a lot of stuff set up. Fortran and C are intermediate on this measure. Note that this is not a criticism of Java as a development language for computer professionals.

      There are a few other instant feedback languages. Forth and APL are both cute, but probably too hard. Mind you, Forth is probably a good introduction to computer internals. In some respects it's a readable assembler! Basic is also a good choice, although GW-basic was better for this than Visual Basic. The problem with Basic is that it's too hard to take it further. Good programming practice in Basic is not very extensible, whereas good programming practice in Perl will carry kids a very long way.

      There's at least some case to be made for exposing kids to several languages. This shows them that there is really more than one way to do it. Balancing education against total confusion I leave to more skilled teachers than I.

      -- Anthony Staines

      P.S. I learnt to program using MS-Basic on Dos 2.1, Dbase II on CP/M and PL-1 on IBM mainframes in that order :->
      I don't necessarily recommend this, but it might make a fun poll.

Re: Perl High School
by Anonymous Monk on Feb 23, 2002 at 23:34 UTC
    this is a terrible course to teach newbies. They need structure. Java is the BEST language to teach new programmers. Perl is amazing, but not a teaching language. Once students develop an understanding of Java/C++/C, then making the switch to Perl is a joke, but vice-versa is really hard.

      I'd have to learn Java to even debate this point..(and I'm sure I'm talking to someone with much greater coding experience than I have)..And then I wonder if it would scare even more kids off. These really are newbies.

      I'd put myself in the "more feedback early" school or thought. I got my class to write working code the first day without explaning about libraries, classes and all the other fun stuff you'd have to before you could do anything useful. It would depend on what you want to teach. I'd be happy if my students come out of this able to use Perl or some language to solve simple problems. One or 2 might go on an take on C or Java in college. For the rest, they will have gotten part of the way which is a lot more than the rest of their peers.

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://146850]
Approved by root
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others browsing the Monastery: (5)
As of 2018-05-23 07:55 GMT
Find Nodes?
    Voting Booth?