Showing content from https://github.com/pmd/pmd/issues/971 below:
[apex][plsql][java] Deprecate overly specific base rule classes · Issue #971 · pmd/pmd · GitHub
I think base rule classes other than AbstractJavaRule should disappear, for the following reasons:
- Java's single inheritance makes them very inflexible. If Java had mixins, then they could be justified better, but they're just committing the developer to a rule type, and adding us some binary compatibility debts we're compelled to support
- They usually only contain a few methods to shorten some operations on the nodes their subclasses operate on, so that it doesn't mean anything to refer to one of the subclasses by the abstract classes' type. I mean, what does it mean to be an AbstractOptimizationRule ? There's no added API, no significant or useful shared behaviour. No abstraction in short -> classification mistake
- They usually share code with only a few rules (eg 3 for AbstractOptimizationRule), even though the behaviour could be better factorised and abstracted if they were eg on the relevant AST nodes, or symbol table classes. It could then be used by every rule, and provide a useful and maintainable api, instead of a bunch of hacky shortcuts. See eg AbstractSunSecureRule, and its absurdly specific methods...
- Finally, all other arguments from the classic inheritance vs composition debate hold for these base classes.
I think all these base rule classes should be deprecated and their code moved out to the AST or symbol table if it can be useful
RetroSearch is an open source project built by @garambo
| Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4