[oak perl] Lexical vs. Package variables

dbkliv dbkliv at gmail.com
Fri Feb 11 08:41:59 PST 2005


On Thu, 10 Feb 2005 14:14:19 -0800, Zed Lopez <zed.lopez at gmail.com> wrote:

I was hoping Zed would chime in on this.

> 
> It is a leap to "get" OOP... it's a fundamentally different way of
> looking at programming, as being a matter of passing messages among
> objects instead of passing data among procedures.

That's a great explanation.

> 
> "A Little Ruby, a Lot of Objects" at
> 
> http://www.visibleworkings.com/little-ruby/
> 
> is a pretty good introduction to thinking in these terms (it's
> Ruby-based, but it's more about OOP with Ruby for examples than about
> Ruby.)
> 

Also, Ruby isn't a scary leap for Perl programmers.

> A lot of Perl guides to OOP suffer from an emphasis on _how_ one
> implements OOP in Perl without much content on how to think in terms
> of OOP or why it's valuable.

Yes, excellent point.

Tying threads together: istr the first 2 chapters of Conway's book gave a
forest perspective before leaping into the trees.

The "slice" example from the Golfer, Chef, and Ninja classes was particularly
illuminating for me, as was the truck example for inheritance.

> 
> And something that's easy to miss in guides on implementing OOP in a
> given language is that OOP is a part of a larger methodology of
> problem analysis, specification and design, not just an implementation
> technique. (I missed this for a long time.)
> 
> Finally, Perl's OOP implementation is kind of clunky -- the programmer
> has to think about a lot of low-level details to do things right than
> s/he would in other languages. This doesn't exactly help the OOP
> beginner to get it.

Yeah.

The clunkiness that Zed's referring to here is that in Perl, the programmer
has to "find" the object that's being used.

The nice thing about learning OOP using Perl is that you really do have
to do a lot of things yourself. When you move to other languages, and
you don't have to do those things - well, you understand what has
already happened for you.

> 
> (And while there are lots of people programming Java, I'd be willing
> to bet that a large number don't really get OOP, and are thinking
> procedurally and writing bad Java.)

Agreed. Zed++

Belden


More information about the Oakland mailing list