Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Introduce factory class #8

Open
larshp opened this issue Dec 4, 2016 · 0 comments
Open

Introduce factory class #8

larshp opened this issue Dec 4, 2016 · 0 comments

Comments

@larshp
Copy link
Collaborator

larshp commented Dec 4, 2016

Hi,
Another idea, what do you think about introducing a factory class eg class ZCL_AES_FACTORY with 2 methods:

CREATE_MODE returns reference to ZIF_AES_MODE

  • would implement the functinoallity from ZCL_AES_UTILITY=>GET_AES_MODE

CREATE_PADDING returns reference to new interface ZIF_AES_PADDING

  • would implement the same as methods GET_BYTE_PADDING_UTILITY + VALIDATE_PADDING_STANDARD from ZCL_BYTE_PADDING_UTILITY, making it easy to change ZCL_BYTE_PADDING_UTILITY to an interface instead
  • and the singleton functionallity from ZCL_AES_UTILITY=>GET_PADDING_UTILITY

This would also change ENCRYPT_XSTRING so it takes a reference to ZIF_AES_MODE and ZIF_AES_PADDING instead of the constants.

Advantages:

  • The responsibility for creating objects are moved to a new class
  • ZCL_BYTE_PADDING_UTILITY is changed to an interface instead of a superclass, which will make it similar to ZIF_AES_MODE
  • ENCRYPT_XSTRING will take references to objects, which will make it easier to test new padding logic and modes
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant