Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl-Sensitive Sunglasses
 
PerlMonks  

Re^6: How should named paramater keys be named?

by DeadPoet (Scribe)
on Jul 03, 2011 at 14:45 UTC ( #912542=note: print w/ replies, xml ) Need Help??


in reply to Re^5: How should named paramater keys be named?
in thread How should named paramater keys be named?

I hear your arguments, and did state that this is just an example of what can be done. I also do not think I have ignored your argument of parameter checking, as I stated early on that there is no excuse for not checking parameters and return codes. I also stated that not always can a value be defaulted--this example just provided a way of showing setting a default value. Poorly chosen or not, this is a simple example to illustrate.

I always enjoy conversing with you on matters, as I enjoy the different point of view. But let us remember, Examine what is being said, not who is saying.... This was just a quick example, and all I have said is that named parameters can have value. If it is your stance that they can have no value, then I respectfully disagree.

There is a product called PowerKeeper that implements a programmatic interface much as you have described-- foo( opt1, opt2, opt3, optn ). Let's just look at the AddSystem API for a moment:

AddSystem System,['][ReservedParameter],[NewSystemName], NetworkAddress,[PrimaryEmail],PlatformName, [ChangeFreq],[ReleaseDuration],[SystemAutoFl], [\"][FunctionalAccount][\"], [FunctionalAcctCredentials],[ChangeTime], [PasswordRule],[PropagateFlag],[PortNumber], [EnablePassword],[AlternateIP],[Description], [DomainFunctionalAccount],[BoksServerOS],[LineDef], [Timeout],[DomainName],[OracleType],[OracleSIDSN], [CheckFl],[ResetFl],[ReleaseChgFl],[NetBIOSName], [MaxReleaseDuration],[PropagateToAliasesFlag], [SecretPassUsedFl],[ParentSystem] [,LDAPServer,ConnectionEncryption, \"SearchBase\",[AccountNameAttributeName], [PasswordAttributeName],PasswordReadability, [LDAPPort],[MultiValuedPasswordFl],[StoreClearTextFl], [StoreCryptFl],[StoreMD5Fl],[StoreSHAFl], [StoreSMD5Fl],[StoreSSHAFl]][']

There are 47 options, and none named. Moreover, all parameters are position dependent. So by your logic, it is easier to remember that the 'CheckFl' belongs in field 26? I think this is the spirit of the PBP when it comes to when to use named parameters.

To exclude possibility is to limit oneself, to blindly accept is to subjugate ones mind, to explore is to learn. --Poet


Comment on Re^6: How should named paramater keys be named?
Download Code
Re^7: How should named paramater keys be named?
by BrowserUk (Pope) on Jul 04, 2011 at 01:11 UTC
    If it is your stance that they can have no value, ...

    To exclude possibility is to limit oneself, to blindly accept is to subjugate ones mind, to explore is to learn.

    I'll just point out that I said: "There *is* utility in using named parameters for sub/methods that (usefully) take large numbers of optional parameters..

    There is a product called PowerKeeper that implements a ... the AddSystem API ... There are 47 options

    And that "47 options" is as close to the perfect fit for "take large numbers of optional parameters." as I have ever seen.


    Examine what is said, not who speaks -- Silence betokens consent -- Love the truth but pardon error.
    "Science is about questioning the status quo. Questioning authority".
    In the absence of evidence, opinion is indistinguishable from prejudice.

Log In?
Username:
Password:

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

How do I use this? | Other CB clients
Other Users?
Others musing on the Monastery: (7)
As of 2014-07-24 07:24 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    My favorite superfluous repetitious redundant duplicative phrase is:









    Results (158 votes), past polls