John (a fictional character in this story), just died.
The machine that was keeping him alive stop working properly.
The machine was controlled by an Android device.
Even do the app was wrote in Kotlin, most of the libraries related with Android were wrote in Java.
One of the nurses, just happen to try to send a report by sharing it with another app.
In that moment, the app crashed.
IT Forensics took a look into the log and found out this exception: PackageManager.NameNotFoundException
When the developer was approached, they found out that the person was new in Kotlin but had a background in Java.
Normally, when working with Java, modern IDEs would provide some warning when an exception needed to be caught:
Please notice the red line below the method sleep
, indicating to the developer that there is a problem that should be taken care of
This feature allowed the developer to cover most of the cases of things that could go wrong. Just leaving weird cases to be discover later.
However, when working with Kotlin, the IDE was quiet:
Yes. The developer could hover the mouse over the method and wait until a box would show up and read that there was an exception; howeverā¦
Why the IDE was quiet then?
Why the IDE didnāt mark the method to make it easy to spot a possible problem?
Could it be that those behind the IDE forgot to provide some mechanism to detect these exceptions and report them back to the developer as when developing with Java?
Could it be that when developing the IDE that would parsing the Kotlin code, they didnāt add the feature due Kotlinās documentation? Exceptions | Kotlin Documentation
I mean, Kotlin has a different approach as shown in the video below:
Yes. It is the fault of the developer because didnāt take the time to go over the documentation of every little thing he or she encounter and trust the IDE; however, isnāt the idea of using a smart IDE to speed up development?
Or perhaps is that Java still remain behind the scenes. Java has different rules than Kotlin and Kotlin should support them, if we insist that Java should remind behind the scenes.
Perhaps, Kotlin could actually change the paradigm related with Exceptions if would get rig of everything related with Java behind scenes?
However, until that day arrives, is it possible to provide something that could help the IDEās to notify the developers about these exceptions in an active way? How about an Annotation? Something.
Anything that could help to prevent to go over every little piece and check if there are some exceptions to take care of?
Or this is something that IDE should take care of?