twilio / twilio/twilio-java

Java library should not use singletons

Open
#650 3 comments 16 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

priority: low status: help wanted type: twilio enhancement
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

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. 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

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.