Beefy Boxes and Bandwidth Generously Provided by pair Networks
Come for the quick hacks, stay for the epiphanies.
 
PerlMonks  

Re: Re: Slurp

by chromatic (Archbishop)
on Dec 31, 2002 at 00:18 UTC ( [id://223222]=note: print w/replies, xml ) Need Help??


in reply to Re: Slurp
in thread Slurp

The issue however has to do with the level of knowledge this assumes on the part of the programmer.

I'm still not convinced. Your argument here appears to be "this is appropriate as a module because a beginning programmer would not be saavy enough to write this module."

I don't think that's a good criterion. A beginning programmer wouldn't necessarily know about localizing $/ for sure, nor about wantarray, but would said programmer attempt to write something abstract enough to handle both cases?

I'm also not convinced a beginning programmer would know enough to care about the difference between a function or a static method call. To your credit, the synopsis doesn't expose this, so you've ameliorated that somewhat.

Another consideration is that to use your code, a beginning coder would have to know about the existence of the CPAN, look for something named "slurp", install the module, and realize that error messages coming from your module are the fault of their code (if the file cannot be read).

I find it more likely that a beginning Perl programmer would be able to write the appropriate code before he figures out how to install your module.

Replies are listed 'Best First'.
Re: Re: Re: Slurp
by rob_au (Abbot) on Dec 31, 2002 at 02:55 UTC
    I'm still not convinced. Your argument here appears to be "this is appropriate as a module because a beginning programmer would not be saavy enough to write this module."

     

    The justification which I see for this module is not that a beginning programmer could not write this module, but rather to provide a very simple interface for reading files for that programmer.

    I see merit in the Slurp module in that a beginning programmer can read one or more files into memory with a simple and direct one line construct such as:

    @content = slurp("file1", "file2", ...);

    While it is entirely true that this one line could be easily written as:

    @content = do{ local( $/, @ARGV ) = ( undef, "file1", "file2", ...); <> };

    Thereby alleviating the need for any additional module, I propose that it is relatively unlikely that a beginning programmer would be comfortable with such a construct - It is thus that I see merit in the Slurp module.

     

    I'm also not convinced a beginning programmer would know enough to care about the difference between a function or a static method call. To your credit, the synopsis doesn't expose this, so you've ameliorated that somewhat.

     

    It is for this very reason, the level of knowledge which may be assumed, that some attempt has been made to permit both function and static method calls to be made without error - This is an attempt to follow the "principle of least surprise" with regard to function reference.

    The greater issue, which you rightly highlight, is the accessibility of this module to its target audience, in that it does assume knowledge of the existence of CPAN and module installation - This is a concern and perhaps the greatest problem with any module targeted at a beginning audience.

     

    perl -le 'print+unpack("N",pack("B32","00000000000000000000001000001100"))'

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others meditating upon the Monastery: (6)
As of 2024-03-28 20:02 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found