Beefy Boxes and Bandwidth Generously Provided by pair Networks
Clear questions and runnable code
get the best and fastest answer
 
PerlMonks  

Re: Perl High School Graduation

by agentv (Friar)
on May 20, 2002 at 23:09 UTC ( [id://168007]=note: print w/replies, xml ) Need Help??


in reply to Perl High School Graduation

...I'm glad you asked this, because I had to wrestle with the very same issues when I wrote the chapter on OO Perl for the Sun course for employees.

I decided that you need to give them a foundation in references first (and that does merit an entire chapter of its own) But my motivation for giving them references was this. Data in real life very seldom complies with our orderly ideas of arrays and hashes. In order to create data constructs that model our real-world things, we have to find a way to represent these irregularly shaped real-world things with a combination of scalars, hashes and arrays.

Perhaps you might ask them to imagine defining the school as a set of departments (each of which has a name), each department owning some set of classrooms (each of which has a name), and in each classroom there are 20 resources (which may be referenced by their position). One conclusion that they might reach ('specially if you help them a little) would be to build a hash of hashes of arrays.

Another good motivation to use references surrounds the problem of passing a group of three arrays to a function, and wanting the function to know which elements belong to which original array. It's a little simpler to build the rationale for this Or you might ask them to think about how we might want to pass a function a scalar, then an array, then another scalar and another array.

It's tough to get the syntax of references right when you first begin, so giving them some concrete examples will smooth the path, and get them accustomed to the syntax.

Then, when we're ready for objects, I suggest that a synopsis of Object Oriented concepts is appropriate. I don't think you have to study OO concepts in depth before you teach them. But you should explain and summarize certain key concepts before you have them trying to design objects. (The person and elevator suggestions above are apt for this.)

The concepts I would want to explain to students about to begin OO work would be these: classes, objects, instantiation, methods, accessors, constructors, encapsulation and inheritance. It should be possible to consider all of these concepts in one or two class sessions (presuming a 50 minute class).

With references, and then OO concepts in hand, they are ready to tackle an OO design as soon as you explain one more thing to them. Packages.

Good luck.

---v

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2024-04-20 02:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found