What is the use of this ( besides the non crash part ) ? I want to know in terms of thinking process behind such design.
It's a design choice. And in Objective-C terminology, one "sends messages" to objects, instead of "calling methods". So you could say sending a message to an object that doesn't exist has simply no effect. If you address a real letter to a person that doesn't exist, no one will receive it, no one will respond or do anything.
Coming from a Java background, one of the thing I found hard to "make mine", was the total absence of the famous java.lang.NullPointerException
related to method invocation.
Once you get into it, you will find it is a total different approach and not a bad one also: you send a message, and if someone is not responding the program is not crashing.
This lead to enforce (in my opinion of course) to think about returning value, rather than to worry about something existing.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With