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

AntiPattern: Use of enum.ordinal() in DROID code #325

Closed
nishihatapalmer opened this issue Nov 22, 2019 · 0 comments
Closed

AntiPattern: Use of enum.ordinal() in DROID code #325

nishihatapalmer opened this issue Nov 22, 2019 · 0 comments
Milestone

Comments

@nishihatapalmer
Copy link
Contributor

There are lots of place in DROID which convert enums to their ordinal() value and back again. This is very fragile, as any re-ordering of these enums will break parts of DROID (at least, the parts that store the values in the SQL database and retrieve them).

Although this isn't urgent, it is something which makes DROID code unnecessarily fragile. Replacing the use of ordinal() with a fixed id for each enum value would make things much more resilient.

It's not quite as easy as just going through all the code and replacing the usage, as some of the SQL code seems to only have an enum (it doesn't know what kind of enum it is, so wouldn't be able to call special methods on it - only ordinal().

@nishihatapalmer nishihatapalmer changed the title Use of enum.ordinal() in DROID code AntiPattern: Use of enum.ordinal() in DROID code Nov 22, 2019
@jcharlet jcharlet closed this as completed Dec 6, 2019
@jcharlet jcharlet added this to the 6.5 milestone Jan 2, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants