Cool Java Feature Desired in Other Languages
In the Java language exception handling, I like the way the compiler demands you to handle exceptions. You have two choices:
In the Java language exception handling, I like the way the compiler demands you to handle exceptions. You have two choices:
- Handle the exception yourself
- Declare that the method/class would throw the exception at the declaration level.
This way, I feel the code would be more disciplined. With our C#, the runtime takes the onus on the pretext of giving flexibility to the developer. But the downside is that lazy developers leave some conditions unhandled and as a result, the users would be caught unaware with dreaded yellow screens and error pages. Just thought, if there is a way at least if application frameworks could bring in this feature or if future versions of C# compiler try including a support for this throws construct.
No comments:
Post a Comment