Beefy Boxes and Bandwidth Generously Provided by pair Networks
Don't ask to ask, just ask
 
PerlMonks  

A New Lesson For My CGI Course

by Ovid (Cardinal)
on Jan 09, 2005 at 22:27 UTC ( #420760=perlmeditation: print w/ replies, xml ) Need Help??

It's probably too hubristic to put this in "Perl News" and it's not exactly a question, so "Meditations" it is.

It's been sitting on my hard drive for a while, just waiting to get uploaded, but Lesson 6 of my CGI course is now online (after a long, long wait.) This lesson has two complete (albeit small) CGI programs -- dice rolling and RPG character generation -- for the student to work through. Unfortunately, I'm close enough to the material that, as usual, I can't tell if it's organized as well as it can be. Plus, I've glossed over stuff (such as complex data structures) that I've tried to minimize the pain on, so it's tough to know if I've done a good job.

I've also cleaned up the presentation so, hopefully, it will be easier to see what's going on. Criticism and suggestions welcome, particularly regarding the "role playing" aspects of the lesson. Is this too obscure? I assume most geeks have an idea of what RPGs are.

Note: for any who were expecting a lesson about cookies, yes, that was going to be the next one. In fact, it's partially written. However, I felt the time was right in the course to take a little detour and get some "hands on" experience and have a little fun at the same time.

Cheers,
Ovid

New address of my CGI Course.

Comment on A New Lesson For My CGI Course
Re: A New Lesson For My CGI Course
by trammell (Priest) on Jan 09, 2005 at 23:14 UTC
    s/We're we're/We're/;
    And in
    my @stats = (qw/ Strength Intelligence Wisdom Constitution Dexterity Charisma /);
    I'd lose the parens, but maybe you have them in there for a reason?

      Thanks. Those are fixed now. The parens were there because of a refactoring I did and I wound up overlooking them.

      Cheers,
      Ovid

      New address of my CGI Course.

Re: A New Lesson For My CGI Course
by duff (Vicar) on Jan 10, 2005 at 00:43 UTC

    My random commentary:

    • In the first paragraph you use the phrase "HERE documents" and later on you use the same phrase but put the word "HERE" in double quotes (as I have just done). I've always found the all-caps version of that phrase rather strange. Usually, I just use a hyphenated form: here-documents.
    • I didn't see anything in a casual glance through the lessons, but might you explain your code such that the lesson can stand on its own? For instance, if I didn't know anything, I'd have questions like: What's the -T option for? Why use strict; use warnings;? etc. One of the things I've always liked about merlyn's articles is that he almost always starts off explaining the code with "As usual, I have blah blah blah at the top of my program because of blah blah blah". Anyway, a small paragraph explaining that stuff immediately after the code and giving pointers to docs would be an improvement IMHO (perhaps in a call-out box like your debugging tips (I'd factor the -T discussion out of debugging tips probably)).
    • The text right before the code for the form says "The form looks something like this". Well, really it's the code that implements the form, not the form itself that you're illustrating.
    • When you talk about the roll and roll_dice subroutines, you write &roll and &roll_dice; respectively. I'd forego the ampersands and semicolon.
    • I didn't scrutinize the code closely, but it looked good to me. (Though I did find the sublty of why you didn't use the fat comma for %races a little distracting. But if you wanted to make that a "sublesson", you could add an exercise for it)

    Sorry if my comments sound nit-picky, these are just the things that occured to me as I looked over the lesson.

    Anyway, it's nice to know that I can point people at your lessons whenever they ask for a CGI course. Keep up the good work!

      Thanks. I made a few minor changes based upon your feedback. I also didn't like my discussion of the "fat comma", but I was struggling between how I would normally write the code and how I would write it so a beginner can understand it. That's the simplest way that I came up with, aside from the "fat comma" distraction. It did bug the heck out of me, though, and you're quite right to point it out.

      And as for why I don't explain each lesson in such a way that the code can stand on its own: each lesson would take five times as much space and be that much longer to write. And how far back would I go? In order to make this reasonable, I went a fairly standard pedagogical route and assumed that for each lesson, the student had X amount of knowledge coming in and if they get to a particular lesson, anything they didn't know is either explained in a previous lesson, falls under the rubric of "required knowledge to study this" or I have links and suggestions for where they can acquire the knowledge. I'd love to have each lesson stand on its own, but it would just be too much work.

      Thanks for the input!

      Cheers,
      Ovid

      New address of my CGI Course.

Re: A New Lesson For My CGI Course
by dragonchild (Archbishop) on Jan 10, 2005 at 14:05 UTC
    • Copyright symbols, AFAIK, should be superscripted. (When you speak of AD&D, for instance)
    • Why should you remove fatalsToBrowser in production? I didn't immediately make the connection when I first heard it and I'd been programming webapps for over a year by then ...
    • Instead of &roll, I'd say roll(). That's how I see functions described in texts about other languages.
    • I usually see a hash-of-hashes is referred to as a HoH, not hoh.

    Being right, does not endow the right to be rude; politeness costs nothing.
    Being unknowing, is not the same as being stupid.
    Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
    Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

      "Why should you remove fatalsToBrowser in production? I didn't immediately make the connection when I first heard it and I'd been programming webapps for over a year by then ..." What I've always heard is "because an error message may give an 'evil hacker type' too much information". Someone else can probably elaborate as to how valid that is, I don't do much CGI/web stuff. (A rails app every now and then, that's it).
        That is the exact reason, but it's a reason that isn't immediately obvious to many people. That's why I'm suggesting Brother Ovid make it explicitly clear as to the benefit.

        Being right, does not endow the right to be rude; politeness costs nothing.
        Being unknowing, is not the same as being stupid.
        Expressing a contrary opinion, whether to the individual or the group, is more often a sign of deeper thought than of cantankerous belligerence.
        Do not mistake your goals as the only goals; your opinion as the only opinion; your confidence as correctness. Saying you know better is not the same as explaining you know better.

      Thanks for the feedback. I'll get some of that fixed.

      As for "fatalsToBrowser", that's part of the reason why there's a (limited) search box in the upper right corner. Enter 'fatalsToBrowser', select "users.easystreet.com" and click enter. The very first link it displays is for my third lesson. In that lessson I cover security and I discuss that very issue. My course really is a course just like you would have in school: lessons are progressive and build on one another. I suppose that should be more clear.

      Update: Those are fixed, with the exception of how to refer back to my previous information regarding fatalsToBrowser. I'll have to give that some thought.

      Cheers,
      Ovid

      New address of my CGI Course.

        The search box, topright, and the LeftSideBar links to previous lessons seem to me to be adequate, but -- FWIW -- perhaps in-line links to specific previous discussion might have occasional merit?

        Hard to know, of course, what criteria to use for backrefs of that sort. Too many = clutter and additional filesize + writing time for you.

        Observations from one who owes much of his understanding of CGI to your course. ++!

Re: A New Lesson For My CGI Course
by kutsu (Priest) on Jan 10, 2005 at 15:34 UTC

    Since I learned much of the basics of CGI programming from your course, which eventually lead me to the docs and several books, I was excited to see a new lesson. Very nicely done, I have only two problems with it (aside from those already meantioned): a reminder that one can use the OO form of CGI.pm might help some and a remind that not only can one type "perldoc CGI" but "perldoc -f <function here>" (for example, "perldoc -f exists" or "perldoc -f return"). On the whole though, great job and very helpful course.

    "Cogito cogito ergo cogito sum - I think that I think, therefore I think that I am." Ambrose Bierce

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlmeditation [id://420760]
Approved by Arunbear
Front-paged by saskaqueer
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (6)
As of 2014-07-26 03:43 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (175 votes), past polls