Closed davidyuk closed 1 year ago
In Calldata there are some classes that don't have any state, like ApiEncoder. I struggling to get the reasoning. Is it future-proof? Like when they get some state. Can be used alternatives like static methods to don't instantiate these classes?
ApiEncoder
static
In Sdk such classes are forbidden because of the rule inherited from typescript-eslint. https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-extraneous-class.md A good point from there is that wrapping classes complicate static code analysis, like doing tree shaking.
Static classes/methods are forbidden in my OOP book.
You can also export these functionalities as pure functions 🤔
In Calldata there are some classes that don't have any state, like
ApiEncoder
. I struggling to get the reasoning. Is it future-proof? Like when they get some state. Can be used alternatives likestatic
methods to don't instantiate these classes?In Sdk such classes are forbidden because of the rule inherited from typescript-eslint. https://github.com/typescript-eslint/typescript-eslint/blob/main/packages/eslint-plugin/docs/rules/no-extraneous-class.md A good point from there is that wrapping classes complicate static code analysis, like doing tree shaking.