twilio-java
twilio-java copied to clipboard
Java library should not use singletons
As a followup to #430, while using global setup such as Twilio.init
is ordinary practice in some languages, it is contrary to Java standard practices and substantially interferes in standard Java application architectures.
For version 9 development, your customers would be much better served by following the standard layout of a service interface TwilioApi
and a class Twilio implements TwilioApi
; this would not impose any more significant burden on consumers (just new Twilio(username, password)
instead of Twilio.init(username, password)
) but would dramatically enhance testability and some production use cases such as multitenant implementations.
This issue has been added to our internal backlog to be prioritized. Pull requests and +1s on the issue summary will help it move up the backlog.
My group and I would like to attempt this issue as a part of our uni course, could someone assign me to the issue? Thanks!
edit: PR up, see below