DEV Community


Discussion on: Make impossible states impossible - Kotlin edition

psfeng profile image
Pin-Sho Feng Author • Edited

Interesting blog post, thanks! I like that increasingly more people are aware of this problem :)

As for the suggestion, I'd advise against doing it that way because it goes against the conventions:

  • Naming: function names should start with a lowercase letter, see here.
  • From outside it looks like a constructor and I wouldn't expect a constructor to return null.

My 2 cents.

le0nidas profile image

Both arguments are valid. Especially the second one didn't even crossed my mind. Thank you!