Let's say there is a method validating user's input. This method check if there is any duplication in list, and if exists, throw some kind of exception.
In this situation, which is proper naming for this method?
Since English is not my mother language, I'm not familiar with this. I'd appreciate it if you explain me why.
Technically from convention perspective, all the methods you mentioned are correct. But naming conventions is a subjective topic and may vary from team to team. Finally it is about what as a team sounds more intuitive to all.
Having said that, nonDuplicate version sounds a little better than others to me from the given options but I would like to reword it as validateNonDuplication
. The reason it sounds better than others is because your positive flow is to make sure there is no duplication while you are throwing an exception if there is a duplicate. So expectations are more inline of having non duplicates.
Hence in my opinion, I would pick validateNonDuplication
in this case.