Beefy Boxes and Bandwidth Generously Provided by pair Networks
Do you know where your variables are?
 
PerlMonks  

Re: Does one encapsulate a class from itself?

by guaguanco (Acolyte)
on Mar 07, 2008 at 00:22 UTC ( [id://672634]=note: print w/replies, xml ) Need Help??


in reply to Does one encapsulate a class from itself?

There's a big difference between a public API (which may do lots of argument checking and other validation) and an internal API. If your class is complex, it's perfectly reasonable to provide some internal API for changing the state of the object. This allows you to change your underlying implementation without breaking as much dependent code. But (as you have observered) the public API may be too cumbersome or slow for the internal implementation to use. So it All Depends - there's no single right answer.
  • Comment on Re: Does one encapsulate a class from itself?

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others contemplating the Monastery: (4)
As of 2026-01-21 19:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    What's your view on AI coding assistants?





    Results (125 votes). Check out past polls.

    Notices?
    hippoepoptai's answer Re: how do I set a cookie and redirect was blessed by hippo!
    erzuuliAnonymous Monks are no longer allowed to use Super Search, due to an excessive use of this resource by robots.