Beefy Boxes and Bandwidth Generously Provided by pair Networks
XP is just a number
 
PerlMonks  

Re: (How) Do you document/test your private subroutines?

by dsheroh (Monsignor)
on Nov 07, 2018 at 09:47 UTC ( [id://1225349]=note: print w/replies, xml ) Need Help??


in reply to (How) Do you document/test your private subroutines?

Well, first off, I don't tend to use private methods all that much. I'll slap an underscore onto the start of a sub's name if I don't think it's likely to be useful outside of the current module, but I tend to think that hiding the internals is overrated, so I rarely do it, even at the "asking nicely" level. If I were working in a non-Perl language with a shotgun to enforce privacy, I doubt I'd ever use it.

When I do use private(ish) methods, I generally don't include them in any documentation, but "private" vs. "public" is not a factor in my testing. I test equally either way because my primary use for testing is to help me debug (present or future) problems and I find it useful to be able to localize the problem I'm debugging as quickly as possible. If A calls _B calls _C calls _D and _C breaks, I want my tests to be able to immediately tell me "there's a problem in _C", not "there's a problem in A" and then I have to manually look at A to see _B failed, then look at _B to see that _C failed, and probably also give _C a thorough going-over to be sure that _D didn't fail.

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others drinking their drinks and smoking their pipes about the Monastery: (5)
As of 2024-04-25 12:23 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found