Java library should not use singletons
Nobody has claimed this yet.
- Dominant language
- Java
- Stars
- 527
- Forks
- 453
- Avg merge
- 10h 59m
- Merged PRs (30d)
- 6
Description
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.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by reviewing the current global initialization around Twilio.init and the context from followup issue #430. Compare the existing client structure with the proposed TwilioApi interface and Twilio implementation. Done means establishing whether this architectural change is feasible for version 9 while preserving the stated consumer use cases.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- api, backend-api-design
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 25/100