3 ms·
Not something I had considered. So for example a UI component that might load 3 different versions based on a string identifier, should instead use an enum whic
by soiler 4y ago
Not something I had considered. So for example a UI component that might load 3 different versions based on a string identifier, should instead use an enum which maps to integers? I say an enum because this would preserve readability of the code.
- coldpie 4y agoDo you mean an API entirely internal to your application? In that case, yes, you probably want to use integers (enums), not Strings, to choose what to display. If you are interfacing with other APIs that use Strings, it may make sense to just pass those through. For example loading files from disk or pulling up UI classes from the OS library using some String identifier or something. It's hard to say without more context.
- soiler 4y agoYes I was referring to internal APIs. Thanks