enums wherever applicable instead of string

rajeshgalla
for example status,transactionType in order could've been enums, there are many other places where enums could've been used. This is a double edged sword, if the api has a new value for an enum it throws exception, but we can change versions if new enums are added or we can update the enums in clients, since most people use build tools anyway to download the latest client
Tagged:
  • sujith
    If we use enums then users won't be able to pass new values that are newly added. That's why we use string constants.
    This will make sure the existing library will work for new types also and we can add these new constants any time.
Sign In or Register to comment.