Skip to content

Library does not follow naming convention for Async methods #200

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

Closed
roryprimrose opened this issue Feb 25, 2016 · 14 comments
Closed

Library does not follow naming convention for Async methods #200

roryprimrose opened this issue Feb 25, 2016 · 14 comments
Labels
status: help wanted requesting help from the community type: community enhancement feature request not on Twilio's roadmap

Comments

@roryprimrose
Copy link

Task based methods should use an Async suffix in their name. The current naming is misleading an implies that the code is invoked synchronously.

This would be a breaking change without overloading methods and using the ObsoleteAttribute.

@Jericho
Copy link

Jericho commented Feb 25, 2016

I agree with you: I also believe it's important to use 'Async' suffix to clearly indicate the asynchronous nature of methods.

I have forked SendGrid's repo and am working on several improvements such as ability to inject httpclient for unit testing, meaningful method names (as opposed to simply 'get', 'post', 'patch', etc.), strongly typed return values from methods, etc. In my fork I am following a naming convention where all methods have the 'Async' suffix.

You can find my fork here: https://github.com/Jericho/sendgrid-csharp

@roryprimrose
Copy link
Author

Sweet. Can you also please add CancellationToken parameters into those signatures.

@Jericho
Copy link

Jericho commented Feb 26, 2016

Excellent idea! I'll add CancellationToken to methods.

@Jericho
Copy link

Jericho commented Feb 29, 2016

done

@thinkingserious
Copy link
Contributor

@roryprimrose thanks for the feedback! I'm leaving this one open for consideration.

@Jericho thanks for your support!

@thinkingserious thinkingserious added type: community enhancement feature request not on Twilio's roadmap status: help wanted requesting help from the community labels May 19, 2016
@thinkingserious
Copy link
Contributor

@thinkingserious
Copy link
Contributor

@roryprimrose, @Jericho,

I believe I've made a proper fix, if you have a moment, please take a look:

  1. This is the client code that was modified
  2. Here is the new working example.

I'm planning to merge this one in today and then update the dependency here. It looks like this will be a breaking change, so I'll likely update the function naming as well.

@edorphy
Copy link

edorphy commented Jul 19, 2016

I might be missing something, but why is there emphasis in using dynamic objects? We lose all type safety. The v2 API that Azure still publishes an example using, was very type safe and hard to mess up. With the dynamic client, its very easy to mess up something with just a simple typo (plus there is no VS auto complete).

Azure's .Net SDK has some very clean abstractions around formatting push notification json payloads with a very strong API.

@thinkingserious
Copy link
Contributor

@edorphy,

Please take a look at the conversation here: #261 (tl;dr; we will solve the issue you describe within our helpers)

We would love for you to join in on the conversation and help us move the library forward.

@ohadschn
Copy link

While we're on the subject of naming convention, C# uses PascalCase for property names so stuff like sg.client.mail.send.post should be sg.Client.Mail.Send.Post(). And stuff like sg.client.api_keys should be sg.Client.ApiKeys. Thanks!

@thinkingserious
Copy link
Contributor

@ohadschn, correct, we have a ticket to track that fix here: #239

I've add a +1 for you internally. Thanks!

@SimonCropp
Copy link

we went through a similar process recently and decided to not have an Async suffix http://docs.particular.net/nservicebus/upgrades/5to6-async-suffix

your circumstance may be different. but thought u might find our logic useful

@ohadschn
Copy link

@SimonCropp all valid reasons but IMHO being consistent with the BCL is more important

@thinkingserious
Copy link
Contributor

This is resolved in this #303

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
status: help wanted requesting help from the community type: community enhancement feature request not on Twilio's roadmap
Projects
None yet
Development

No branches or pull requests

6 participants