for example:
- A system connects three distribution platforms, namely platform A, platform B and platform C
- for upper-level business, you only need to take your own order (this part of the attribute is fixed) object as a parameter, as well as the platform to be delivered, such as platform A, to call the API .
- platform D may be added in the future. Which design pattern can be flexibly extended without modifying the interface?
- what you can think of now is that, according to this type, different platforms are called, and a lot of
if (type==A_CODE) {
/ / call platform A"s ordering interface}
else if (type==B_CODE) {
/ / call platform B"s ordering interface
} else if (type==C_CODE) {
/ / call platform C"s ordering interface
}
in this way, if you want to refactoring, is there a suitable design pattern?