You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
However, we use Chain interface in our codes as the entrance, like:
We should notice that, the Router is the top abstraction. Using Chain in codes will reduce the expandability.
So I proposal to refactor the design.
Firstly, we keep the Router interface, but remove the Priority method;
Secondly, we keep Chain interface, but it will implement Router interface, which means that Chain is a Router too but it's more complicated.
Thirdly, we define PriorityRouter which is the Router interface + Priority method;
Finally, we will replace Chain with Router in our codes. The Router instance should be fetched from extension;
The class diagram is:
The benefit is that:
User can schedule many routers by their own way, not just Chain;
Only Router interface are exposed outside the Router module;
The text was updated successfully, but these errors were encountered:
Now the Router has two key interfaces:
However, we use
Chain
interface in our codes as the entrance, like:We should notice that, the Router is the top abstraction. Using
Chain
in codes will reduce the expandability.So I proposal to refactor the design.
Firstly, we keep the
Router
interface, but remove thePriority
method;Secondly, we keep
Chain
interface, but it will implementRouter
interface, which means thatChain
is aRouter
too but it's more complicated.Thirdly, we define
PriorityRouter
which is theRouter
interface +Priority
method;Finally, we will replace
Chain
withRouter
in our codes. TheRouter
instance should be fetched fromextension
;The class diagram is:
The benefit is that:
Router
interface are exposed outside the Router module;The text was updated successfully, but these errors were encountered: