2 ms·
Did you read the article? This is the beginning of it: The other day, I saw this example on StackOverflow: Person person = dataSource.getPersonById(person
by Locke1689 13y ago
Did you read the article? This is the beginning of it:
The other day, I saw this example on StackOverflow:
Person person = dataSource.getPersonById(personId);
if (person != null) {
person.setPhoneNumber(phoneNumber);
dataSource.updatePerson(person);
}
This looks like a typical case where we need a null check.
If the canonical example under discussion is in Java, I think it is safe to assume the article is about Java.
- masklinn 13y ago> I think it is safe to assume the article is about Java. No. The article is about a pattern of explicit null-check avoidance, java is an example of "a language without blocks or lambdas" but the article is no more about java than it is about ruby, you're not even missing the forest for the trees you're missing the forest for a fallen leaf.