aeternity / aepp-calldata-js

Aeternity data serialization library
ISC License
3 stars 4 forks source link

The reasoning behind classes without state #195

Closed davidyuk closed 1 year ago

davidyuk commented 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?

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.

dincho commented 1 year ago

Static classes/methods are forbidden in my OOP book.

davidyuk commented 1 year ago

You can also export these functionalities as pure functions 🤔