Beefy Boxes and Bandwidth Generously Provided by pair Networks kudra
Pathologically Eclectic Rubbish Lister
 
PerlMonks  

Fundamentals Of Programming -- In 6 Hours

by Cody Pendant (Prior)
on Nov 08, 2002 at 01:21 UTC ( #211302=perlmeditation: print w/ replies, xml ) Need Help??

Fellow Monks,

This is not strictly a Perl question, but I know you'll be interested.

I'm teaching a class in JavaScript.

The class would probably be happier if I just gave them Code to Make PopUp Windows, Code To Detect Browsers and so on. But I'm determined to at least give them some idea of what's really happening, to understand what programming is, even if they're not really going to do it ever.

So, if you had six hours to do it in, and you were faced with a class who are at the level where they say "why do we need variables?", what would you attempt to cover?

I'm thinking Variables and Control Structures are the absolute fundamentals, but that's as far as I've got ...
--

($_='jjjuuusssttt annootthheer pppeeerrrlll haaaccckkeer')=~y/a-z//s;print;

Comment on Fundamentals Of Programming -- In 6 Hours
Download Code
Re: Fundamentals Of Programming -- In 6 Hours
by moxliukas (Curate) on Nov 08, 2002 at 01:42 UTC

    Hmmm...six hours is not the biggest time span to learn programming ;)

    What about functions? I think this is fairly fundamental thing in programming (at least functional one ;). Even if you do not teach them how to write their own functions, you should explain what functions are. They will be calling predefined language functions anyway, so it should be beneficial in their understanding what they are doing.

      Functions, of course. You're quite right. Because functions lead to the concept of Modularity as well.
      --
      ($_='jjjuuusssttt annootthheer pppeeerrrlll haaaccckkeer')=~y/a-z//s;print;
Re: Fundamentals Of Programming -- In 6 Hours
by bilfurd (Hermit) on Nov 08, 2002 at 02:53 UTC
    I suppose you can't help but touch on objects, so ...

    Perhaps you could impress upon them the need for some amount of code optimization? Basic stuff - "If you have seven roll-over graphics, you can control them all with ONE function" or "The pop-up will still work without the seven lines of comments the page editor macro put in to explain how it works."

    Even better - which JavaScript functions are MSIE extensions and which are Netscape extensions, and why one does not work on the other.

    BEST - Client side PerlScript! :)

Re: Fundamentals Of Programming -- In 6 Hours
by kshay (Beadle) on Nov 08, 2002 at 03:13 UTC
    Variables, control structures, and functions, definitely. Operators is another big one. In particular, I think a lot of non-programmers have trouble internalizing the distinction between assignment and comparison operators. Going over logical operators also gives people a good chance to connect with programming on an intuitive level (everyone understands what "and" and "or" and "not" mean).

    But since it's JavaScript, there are a couple of things you'll probably need to touch on that wouldn't necessarily be part of the "first six hours" if you were teaching a different language.

    For instance*, objects. Obviously you don't want to delve too deeply into object-oriented programming theory, but it's hard to accomplish much in JavaScript without a basic understanding that elements on a page (and the page itself) are treated as "objects" and to find out their characteristics you refer to their "properties" and to make them do things you use "methods."

    Also, the concept of events and event handlers is pretty fundamental.

    Those are all very handy things to know about, of course, but it does give you quite a bit more to cover. Still, I think if you don't cover that stuff, they'll come away from the class still baffled by even the most basic cut-and-paste JavaScript code they'll come across.

    --Kevin

    Update: * Pun unintentional, but I like it.

Re: Fundamentals Of Programming -- In 6 Hours
by BrowserUk (Pope) on Nov 08, 2002 at 03:52 UTC

    Following in my tradition of "carrot & stick" teaching method, I'd try for something along these lines (assuming 6 1 hour sessions):

    1. Start by showing them a js dropdown menu with nice borders and their names on them, that pops up an Alert box saying "XXXXX sucks at programming".:)

      Supply each of them with a copy of the code, which should be as badly structured as possible. Monolithic, everything hard coded etc. The sort of stuff that your average beginner turns out.

      Then let them spend half an hour trying to modify their copy so that when they click their own name, it pops up and says something really cool.

      Then ask them to try and integrate all their different versions together for the rest of that period and homework if they want to.

    2. Start the next lesson by showing them your structured version (in action rather than the source), and then ask each of them what they want their name to say, and make the changes to your version. Ie update a data structure somewhere and show them that in action. Shouldn't take more than a few minutes. As they've seen how hard it is to do it themselves they should be impressed by yours.

      You then get to spend the rest of the time explaining the differences between the unstructured and the structured versions. Why each part was changed and the benefits they get from it.

      The rest of the periods cover (for example) the following subjects with half the time spent explaining the basics and half with them trying a practical exercise.

    3. Variables and data structures.
    4. Flow control and functions.
    5. Abstraction and encapsulation (though I'd probably call it "Keeping apples with apples" or similar:)
    6. Putting it all together and if time allows, some simple debugging techniques.

    Hmmm. Just a few thoughts.



    Nah! You're thinking of Simon Templar, originally played (on UKTV) by Roger Moore and later by Ian Ogilvy
Re: Fundamentals Of Programming -- In 6 Hours
by Callum (Chaplain) on Nov 08, 2002 at 12:25 UTC
    One thing that will affect how you teach, and what you teach, will be how the six hours are spread out.

    Six hours all in one day means that the students won't have time to forget anything, but also won't be able to re-read the notes or study/practice out of class. In this format you probably want to give them extra material at the end which you don't cover in class, but which does include the cookbook-type material you say they'd be interested in; during class you focus on teaching theory and applying it to small cases.

    One hour a week for six weeks has different problems -- even though there will be plenty of time for them to reread notes and practice out of class, the first 10 minutes of each class will have to be spent recapping what was done last week, and the last 10 minutes spent describing the work they should do out of class. However, because they can apply and test their learning as they go along they are likely to get more out of the 30-45 minutes of 'productive' class time.

    My preffered format would be 3 or 4 one-and-a-half to two hour classes spread out over one or two weeks, however the formats and timetables of such classes are rarely under the teachers control enough to allow such customisation.

    I would certainly reccommend that the cookbook "Code to Make PopUp Windows"-type material, even if it's discussed in class, is left until near the end and possibly simply provided as sample code / exercise-for-the-student material at the end of the course. The students if they're interested in this will be willing and able to learn it themselves once you've provided the foundation in your classes (hoom... starting to sound like another of my posts.

Re: Fundamentals Of Programming -- In 6 Hours
by princepawn (Parson) on Nov 08, 2002 at 15:32 UTC
    'm determined to at least give them some idea of what's really happening, to understand what programming is, even if they're not really going to do it ever.
    It sounds like you want to be very analytical about this. As you may know, learning natural language can be very effective via the immersion method, where one does not learn grammar, memorize rules, or study in the abstract sense at all - you just sorta pick it up by doing.

    So, as much as I tend to want to like you, I can't help but play devil's advocate as well.

Re: (nrd) Fundamentals Of Programming -- In 6 Hours
by newrisedesigns (Curate) on Nov 08, 2002 at 16:20 UTC

    Considering you only have six hours, don't bore them with terms they'll likely forget (assuming your audience is composed of high-school/college gen-ed'ers), just show them a bunch of stupid javascript tricks™ to get them interested in programming.

    Then, at the end, talk to them about CGI and Perl... and name-drop Perl Monks. Maybe we can get a few converts...

    John J Reiser
    newrisedesigns.com

Re: Fundamentals Of Programming -- In 6 Hours
by Cody Pendant (Prior) on Nov 08, 2002 at 20:50 UTC
    Thank you all for your help. It's been very useful. I will of course be talking to them about Perl as well.

    For the record, as I didn't make myself entirely clear before, I will be showing them lots of cute JavaScript tricks in subsequent classes, but I'm setting the first six-hour lesson aside to talk about the basics.

    That way when the tricks are being taught, I can at least say something like "and see here, that's the assignment operator, remember? So we're assigning a location to the window object, in other words telling the browser where to go" and have them feel less like they're just reproducing code and more like they're understanding it.
    --

    ($_='jjjuuusssttt annootthheer pppeeerrrlll haaaccckkeer')=~y/a-z//s;print;
Re: Fundamentals Of Programming -- In 6 Hours
by hsweet (Pilgrim) on Nov 10, 2002 at 01:38 UTC

    Good luck. For my typical (high school) student, 6 hours would not amount to much. I'm happy when I can get that stuff across in 20 weeks * 5 days /week * 45 minutes /day

    It would be cool if you could come up with a small project the students could manage.

    Of course, variables, assignments, loops, methods and properties without explaining objects (whatever they are).

    How to recycle and modify existing scripts is probably a more realistic goal than writing anything serious. Modifying values inside a script could be informative and lead to an understanding of what those things are.

    Time flies like an arrow, fruit flies like banannas

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2014-04-25 02:12 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (579 votes), past polls