likly commented on pull request #8587:
URL: https://github.com/apache/shardingsphere/pull/8587#issuecomment-744470387
> > > Sharding algorithms are dynamic and loaded via SPI.
> > > The enum is static config and broken OCP.
> > > So it is better to do not use enum to define sharding algorithm types.
> >
> >
> > This Enum only used for build-in sharding algorithms to manage the SPI
types easily.
> > And this enum is not broken OCP, Sharding algorithms still are dynamic
and loaded via SPI.
>
> If user custom a new sharding algorithm, do they need to update the enum?
> If yes, OCP is broken;
> If not the custom sharding algorithm is different with built-in one, we'd
like keep the customization sharding algorithm consist with built-in one.
Broken the OCI maybe appecd when the `getType()` method return type change
to a enum type.
But this enum just for replace the magic string with `enum.name()`.
The getType method just changed like this:
```java
public String getType() {
// old: return "INLINE";
// now: return the name of `INLINE` enum constant.
return ShardingAlgorithmType.INLINE.name();
}
```
The method definition is not changed.
----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
For queries about this service, please contact Infrastructure at:
[email protected]