Click here to Skip to main content
15,915,019 members
Home / Discussions / C#
   

C#

 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
Colin Angus Mackay12-Sep-04 22:20
Colin Angus Mackay12-Sep-04 22:20 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
User 12301612-Sep-04 22:38
User 12301612-Sep-04 22:38 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
Christian Graus12-Sep-04 13:52
protectorChristian Graus12-Sep-04 13:52 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
Nicholas Cardi12-Sep-04 13:57
Nicholas Cardi12-Sep-04 13:57 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
Salil Khedkar13-Sep-04 1:26
Salil Khedkar13-Sep-04 1:26 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
Salil Khedkar13-Sep-04 1:29
Salil Khedkar13-Sep-04 1:29 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
bjoernen13-Sep-04 2:58
bjoernen13-Sep-04 2:58 
GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
elguaro12-Oct-04 14:36
elguaro12-Oct-04 14:36 
Actually I believe not enforcing exception handling is what make people code with bad habits. With
unchecked exceptions it's just too easy to ignore exception handling all together! You call a method on an object, you don't really know what exceptions it *might* throw, you don't have time to find out and you just forget exceptions even exists. The compiler won't complain, the code will run and everyone's happy.

MyObject myObject = new MyObject();
myObject.doSomething();

If I don't know what doSomething throws at me, in the best case scenario I could catch the generic Exception. But that still isn't good practice, right? Maybe I just leave it and let it propagate to my caller, who will be even more clueless about the exceptions that could generate inside doSomething.

But if you had doSomething throwing checked exceptions you wouldn't have a choice but to deal with them. And if you consider you can't do anything about it, Java will let you propagate it using the throws statement in your method declaration. The difference is it's all explicit and clearer. You know what's coming at you and you can decide to handle it or explicitly tell your caller to do it.

Cheers.

GeneralRe: i see why C# SHOULD have required to catch exceptions now Pin
bjoernen12-Oct-04 20:08
bjoernen12-Oct-04 20:08 
Generalkeypreview problem ( listview and buttons) Pin
BrownJacket12-Sep-04 10:19
BrownJacket12-Sep-04 10:19 
GeneralListView Problem Pin
Tomas Brennan12-Sep-04 8:50
Tomas Brennan12-Sep-04 8:50 
GeneralRe: ListView Problem Pin
VanesaAFESRG12-Sep-04 17:05
VanesaAFESRG12-Sep-04 17:05 
GeneralRe: ListView Problem Pin
Tomas Brennan13-Sep-04 2:07
Tomas Brennan13-Sep-04 2:07 
GeneralRe: ListView Problem Pin
VanesaAFESRG13-Sep-04 14:42
VanesaAFESRG13-Sep-04 14:42 
GeneralRe: ListView Problem Pin
Tomas Brennan17-Sep-04 5:56
Tomas Brennan17-Sep-04 5:56 
GeneralRe: ListView Problem Pin
SandeepN13-Sep-04 13:05
SandeepN13-Sep-04 13:05 
GeneralRe: ListView Problem Pin
Tomas Brennan17-Sep-04 6:00
Tomas Brennan17-Sep-04 6:00 
GeneralPerformance question Pin
BoxenBiene12-Sep-04 4:21
BoxenBiene12-Sep-04 4:21 
Generalswitch question Pin
BoxenBiene12-Sep-04 3:37
BoxenBiene12-Sep-04 3:37 
GeneralRe: switch question Pin
Dennis C. Dietrich12-Sep-04 4:02
Dennis C. Dietrich12-Sep-04 4:02 
GeneralRe: switch question Pin
BoxenBiene12-Sep-04 4:26
BoxenBiene12-Sep-04 4:26 
Generalembeding a NumericUpDown column in a datagrid Pin
BaraaSh12-Sep-04 3:30
BaraaSh12-Sep-04 3:30 
Generalnumericupdown column in datagrid Pin
BaraaSh12-Sep-04 3:18
BaraaSh12-Sep-04 3:18 
GeneralRe: numericupdown column in datagrid Pin
sreejith ss nair12-Sep-04 20:50
sreejith ss nair12-Sep-04 20:50 
GeneralC# send arraylist between forms Pin
Member 119488412-Sep-04 3:15
Member 119488412-Sep-04 3:15 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.