3 added syntax-highlighting
source | link

It depends on the semantics of the method. You could possibly specify, your method accepts only "Not null". In Java you can declare that using some metadata annotations:

string ReverseString(@NotNull String stringToReverse)
string ReverseString(@NotNull String stringToReverse)

You should somehow specify the return value. If you declare, you accept only NotNull values, you are bound to return empty string (if the input was empty string too).

The second case is a little bit complicated in its semantics. If this method is to return some person by it's primary key (and the person is expected to exist), better way is to throw exception.

Person FindPerson(int personID)
Person FindPerson(int personID)

If you search person by some guessed id (which seems to me odd), you would better declare that method as @Nullable.

It depends on the semantics of the method. You could possibly specify, your method accepts only "Not null". In Java you can declare that using some metadata annotations:

string ReverseString(@NotNull String stringToReverse)

You should somehow specify the return value. If you declare, you accept only NotNull values, you are bound to return empty string (if the input was empty string too).

The second case is a little bit complicated in its semantics. If this method is to return some person by it's primary key (and the person is expected to exist), better way is to throw exception.

Person FindPerson(int personID)

If you search person by some guessed id (which seems to me odd), you would better declare that method as @Nullable.

It depends on the semantics of the method. You could possibly specify, your method accepts only "Not null". In Java you can declare that using some metadata annotations:

string ReverseString(@NotNull String stringToReverse)

You should somehow specify the return value. If you declare, you accept only NotNull values, you are bound to return empty string (if the input was empty string too).

The second case is a little bit complicated in its semantics. If this method is to return some person by it's primary key (and the person is expected to exist), better way is to throw exception.

Person FindPerson(int personID)

If you search person by some guessed id (which seems to me odd), you would better declare that method as @Nullable.

2 code formatting
source | link

It depends on the semantics of the method. You could possibly specify, your method accepts only "Not null". In Java you can declare that using some metadata annotations:

string ReverseString(@NotNull String stringToReverse)

string ReverseString(@NotNull String stringToReverse)

You should somehow specify the return value. If you declare, you accept only NotNull values, you are bound to return empty string (if the input was empty string too).

The second case is a little bit complicated in its semantics. If this method is to return some person by it's primary key (and the person is expected to exist), better way is to throw exception.

Person FindPerson(int personID)

Person FindPerson(int personID)

If you search person by some guessed id (which seems to me odd), you would better declare that method as @Nullable.

It depends on the semantics of the method. You could possibly specify, your method accepts only "Not null". In Java you can declare that using some metadata annotations:

string ReverseString(@NotNull String stringToReverse)

You should somehow specify the return value. If you declare, you accept only NotNull values, you are bound to return empty string (if the input was empty string too).

The second case is a little bit complicated in its semantics. If this method is to return some person by it's primary key (and the person is expected to exist), better way is to throw exception.

Person FindPerson(int personID)

If you search person by some guessed id (which seems to me odd), you would better declare that method as @Nullable.

It depends on the semantics of the method. You could possibly specify, your method accepts only "Not null". In Java you can declare that using some metadata annotations:

string ReverseString(@NotNull String stringToReverse)

You should somehow specify the return value. If you declare, you accept only NotNull values, you are bound to return empty string (if the input was empty string too).

The second case is a little bit complicated in its semantics. If this method is to return some person by it's primary key (and the person is expected to exist), better way is to throw exception.

Person FindPerson(int personID)

If you search person by some guessed id (which seems to me odd), you would better declare that method as @Nullable.

1
source | link

It depends on the semantics of the method. You could possibly specify, your method accepts only "Not null". In Java you can declare that using some metadata annotations:

string ReverseString(@NotNull String stringToReverse)

You should somehow specify the return value. If you declare, you accept only NotNull values, you are bound to return empty string (if the input was empty string too).

The second case is a little bit complicated in its semantics. If this method is to return some person by it's primary key (and the person is expected to exist), better way is to throw exception.

Person FindPerson(int personID)

If you search person by some guessed id (which seems to me odd), you would better declare that method as @Nullable.