-
Notifications
You must be signed in to change notification settings - Fork 35
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
Do we want ServiceObject#get()
?
#234
Comments
Personally I usually wouldn't name a method |
I think semantically e.g. const PubSub = require('@google-cloud/pubsub');
const pubsub = new PubSub();
const topic = pubsub.topic('my-topic');
const subscription = await topic.getSubscription('my-sub', { autoCreate: true }); |
@callmehiphop yes, that sounds like what I was thinking. |
I might have gone a little overboard, but taking this into consideration I put together a gist with some improvements that I think could be made in PubSub, and well, most of the Node.js clients. https://gist.github.com/callmehiphop/d81491fa89b86f688f07d68f2ccd61cb IMO this would be a pretty hefty change, but I think it would help drive closing some core issues
I'm curious on what everyone's thoughts are! |
That's awesome! I have some thoughts, but it might be easier if it could be converted to a public Google Doc. Would you mind doing that? |
Adding in @bcoe because this is a really interesting discussion. |
👋 hey just catching up on this conversation. I like @callmehiphop's suggestion, as much as possible I've tried to avoid having state in objects that are data wrappers -- better that you fetch a new version of the same subscription right? and then there's no concern that something out of band might have reloaded the contents of your subscription object. My other thought, is that in general we should avoid the method |
Greetings, we're closing this due to inactivity. Please let us know if the issue needs to be reopened. |
@jganetsk has some concerns, pasted below:
The
get()
method currently serves two purposes:metadata
property on the ServiceObject instanceget({ autoCreate: true })
optionReferences back to when this method was conceived:
get()
by @jgeewaxI share the view that
ServiceObject.get()
is backwards from our standard hierarchy, which is, Service -> ServiceObject. I'm not familiar with other patterns that may exist in other libraries or languages, although I don't think that's necessary. I'd be interested in exploring a better way to support that feature, however, I'm not excited to remove this 3 year old, all-API method.@callmehiphop @JustinBeckwith @ofrobots Thoughts are very appreciated, and please feel free to tag others.
The text was updated successfully, but these errors were encountered: