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

Re^4: Should Modules Do I/O?

by Mugatu (Monk)
on Mar 18, 2005 at 20:57 UTC ( [id://440802]=note: print w/replies, xml ) Need Help??


in reply to Re^3: Should Modules Do I/O?
in thread Should Modules Do I/O?

As you acknowledge, these three interfaces can be implemented using eachother. The higher level methods can use the lower level methods. There is nothing redundant there.

Nobody is suggesting that the OP should make one and only one interface available, except you (unless I am misunderstanding your position). Few users will have to "work around the supplied interface" if the interface embodies the common usage scenarios. That is the value-add.

Replies are listed 'Best First'.
Re^5: Should Modules Do I/O?
by BrowserUk (Patriarch) on Mar 18, 2005 at 21:45 UTC
    As you acknowledge, these three interfaces can be implemented using eachother.

    I did not acknowledge that--I flat out contradicted it.

    Neither of the other two interfaces can be easily wrapped to provide each other, nor that which I described.

    And I'm not sure how you came to that reading from my post?

    Nobody is suggesting that the OP should make one and only one interface available, except you (unless I am misunderstanding your position).

    You are not misunderstanding my position. I think that a single flexible interface is prefereable to multiple overlapping interfaces. Adding bloat to a module is detrimental rather than value-add IMO.

    If there are common usage scenarios that would benefit from a simpler interface, these should be provided through a separate package that wraps the flexible interface in the same way that LWP::Simple wrap LWP::Useragent and XML::Simple wraps either XML::Parser or XML::SAX.

    I'm not into deeply nested hierachies, but two levels strikes a good balance between depth and breadth at all levels.

  • It allows the segregation of the code for both maintenance and use.
  • It allows the *::Simple documentation to be exactly that, rather than mixing it up with the complexities of the full interface.
  • The *::Simple module becomes an excellent "API design" test, and long-term regression test for the primary module.
  • It also serves as a "worked example" of both using the primary module and extending it.

    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    Lingua non convalesco, consenesco et abolesco.
    Rule 1 has a caveat! -- Who broke the cabal?
      As you acknowledge, these three interfaces can be implemented using eachother.
      I did not acknowledge that--I flat out contradicted it ... And I'm not sure how you came to that reading from my post?

      I was talking about this sentence:

      With the interface I describe, the other two interfaces can be trivially derived through subclassing, or just simple procedural wrappers.

      What you call trivially derived is what I meant when I said implemented using eachother. Just to make it even more clear, I meant you can make the filehandle interface, and have the other interfaces use that.

      If there are common usage scenarios that would benefit from a simpler interface, these should be provided through a separate package that wraps the flexible interface

      This is six of one or half dozen of the other. If you insist on moving the simple interfaces into a ::Simple module, so be it. But it should be made from the beginning, otherwise there will be users who end up writing code they shouldn't have to write.

      Frankly, I think that the more good interfaces there are available, the better. It can be done cleanly, and it can be done without "adding bloat to a module." Your position on this matter flies in the face of my years of experience using Perl.

      PS: I will not reply any further. I have said about all I can on this subject. Please feel free to respond, but don't expect me to.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others making s'mores by the fire in the courtyard of the Monastery: (9)
As of 2024-04-19 13:18 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found