URL code optimization
- Dominant language
- Java
- Stars
- 41.6k
- Forks
- 26.4k
- Avg merge
- 15h 13m
- Merged PRs (30d)
- 4
Description
In the url part of dubbo, I saw some unreasonable designs, maybe we can refactor and optimize it.
For example, the most basic parent class URL should ensure the integrity of its own attributes. See #10921.
There are some others, such as:
1. Single attribute principle.

There are multiple attributes here including host and port. Do we only need one host and port? Other places use the method to obtain, so when you want to dynamically modify the ip and port, only change one place instead of traversing
2. Too much Overload does not look concise enough, although this is one of the characteristics of java
Is it better to use the builder mode and load on demand?

3. The URL should only contain necessary attributes, such as host and port (maybe more, looks a bit like the first point), and cannot be overridden. The form of an abstract class may be better (it is meaningless to use it alone), and additional interface is also necessary
@AlbumenJ PTAL
Contributor guide
Research direction
Start by reading the URL implementation in Dubbo and the related discussion in #10921. Review the existing URL attributes, overloads, and subclass or interface structure described in this issue, then seek an agreed design before making changes. Done means the URL design is simplified without breaking existing behavior, with verification for the affected usage paths.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- java
- Domain
- distributed-systems
- Issue type
- Refactor
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 20/100