vjousse/toomler — comment on commit b47c490b3f3fc166fa646d4da37ff836fed799b9
File: app/model/BaseTournament.scala line 10
By ornicar:

looks bad indeed.

A solution is to make the classes constructor private. And use a companion object apply method to create instances. This method will do the checks and return a Some(object) or Success(object) if the conditions are met.

Example: https://github.com/ornicar/scala-paginator/blob/master/core/src/main/scala/Paginator.scala#L7 / https://github.com/ornicar/scala-paginator/blob/master/core/src/main/scala/Paginator.scala#L50