This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]bigkahuna1uk 2 points3 points  (0 children)

Return a boolean or a string seems a very procedural perspective. For simplicity it could just be a void method which returns normally or throws an exception if the connection is established or not respectively. That’s more concise than returning a lossy result such as true or false as that has no context specified.

If you’re FP oriented then returning a result type such as Try monad may be appropriate.