Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Suggestion: Consider alternate method name for Key generation #4

Closed
tep opened this issue Dec 24, 2017 · 1 comment
Closed

Suggestion: Consider alternate method name for Key generation #4

tep opened this issue Dec 24, 2017 · 1 comment

Comments

@tep
Copy link

tep commented Dec 24, 2017

Per your RFC in #reviews -- regarding:

func (kr *Smokering) New(id, note string, block cipher.Block, blocksize int, f func() ([]byte, error)) (*Key, error) {

A common pattern I like to use, when I have a package level constructor named New returning a factory object that itself creates some other object, is to use the child object's name as the name of the factory method that creates it.

In this case, instead of:

    func (kr *Smokering) New(...

... you'd have:

    func (kr *Smokering) Key(...

I've found that it can make things a lot clearer 6 months down the road (given that the word New is often grossly overloaded).

IngCr3at1on added a commit that referenced this issue Dec 24, 2017
Also includes some minor internal cleanup.
@IngCr3at1on
Copy link
Owner

This is implemented in cfba85f thanks @tep for the suggestion.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants