Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Re^2: Abstract Packages

by Ovid (Cardinal)
on Aug 04, 2004 at 16:55 UTC ( [id://380044]=note: print w/replies, xml ) Need Help??


in reply to Re: Abstract Packages
in thread Abstract Packages

I've no problem with ref $this || $this either, but there is absolutely no consensus in the Perl community regarding expected behavior when a constructor is called on an instance. (Maybe nethack should get launched.) That's the real problem with that construct. If the programmer puts it in the code, he or she should understand why it's being put in and document it. Otherwise, why bother writing it?

Update: Now that I think about it, using this without documentation is even more problematic with an abstract base class. If I'm subclassing a module, I'm tightly coupling my subclasses behavior with that of my superclass(es). It's even more important that I understand the behavior of those classes with such coupling, therefore I would be even more inclined to ding someone for ref $proto || $proto unless that person had clear documentation. If it's not documented, it's not a contract with those who use the class and, as such, cannot be defined behavior. Using undefined behavior is a Bad Thing and subclasses should be especially vigilant not to do this (not that I would excuse this in everyday code, either.)

Cheers,
Ovid

New address of my CGI Course.

Log In?
Username:
Password:

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

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

    No recent polls found