• (nodebb)

    For example, let's say you saw a method called handleRSAPrivateKeyGeneration. You'd likely assume that it generates an RSA private key.

    No, I wouldn't, actually. I'd assume that it's a callback that handles (the result of) the generation of the key, so we pass it as a callback (mechanism depending on the language) to some generator function.

  • 516052 (unregistered) in reply to Steve_The_Cynic

    Same here. If I wanted a key generated I'd expect something like GenerateRSAPrivateKey or RSAPrivateKeyGenerator.Generate or PrivateKeyGenerator.GenerateRSA etc.

  • Conradus (unregistered)
    Comment held for moderation.
  • (nodebb) in reply to Steve_The_Cynic

    It would depend on what class/file it's in. If it's in a class named something like PrivateKeyGenerator, sure, you would probably expect it to be called after the key is generated. If it's in a class of HTTP request handlers, then you would expect it to be the method that's called when the user sends a RSAPrivateKeyGeneration request, which I would guess is a request to generate a key (though as mentioned, something like GenerateRSAPrivateKey would be a better name).

  • Brian (unregistered)

    So the lesson here: avoid the generic "handle" in your method names, and pick a more descriptive verb. How is your method handling the thing?

  • Jaloopa (unregistered) in reply to Brian

    I make sure as many of my methods as possible are named HandleThing. That way, if the handling behaviour or thing type change I don't need to update the method name. This is what is known as self documenting code

  • DMLou (unregistered)

    Honestly, I think the issue here is slightly different than what Remy suggests. Still not great, and perhaps I'm being a bit pedantic here. However, I think that in a lot of minds, "RSA key" has become a generic trademark for any sort of public/private key, similar to Kleenex for facial tissue, Jell-o for flavored gelatin, etc., and I think that's what's going on here. Not sure if it makes it slightly less of a WTF or not, though.

  • Argle (unregistered)
    Comment held for moderation.

Leave a comment on “A Specific Key”

Log In or post as a guest

Replying to comment #701340:

« Return to Article