Click here to Skip to main content
15,908,776 members
Home / Discussions / C / C++ / MFC
   

C / C++ / MFC

 
JokeRe: exception and global variable Pin
CPallini27-Jan-08 23:47
mveCPallini27-Jan-08 23:47 
GeneralRe: exception and global variable Pin
George_George27-Jan-08 23:54
George_George27-Jan-08 23:54 
GeneralRe: exception and global variable Pin
Maxwell Chen27-Jan-08 23:57
Maxwell Chen27-Jan-08 23:57 
GeneralRe: exception and global variable Pin
Cedric Moonen27-Jan-08 23:13
Cedric Moonen27-Jan-08 23:13 
GeneralRe: exception and global variable Pin
George_George27-Jan-08 23:24
George_George27-Jan-08 23:24 
GeneralRe: exception and global variable Pin
Cedric Moonen27-Jan-08 23:34
Cedric Moonen27-Jan-08 23:34 
GeneralRe: exception and global variable Pin
George_George27-Jan-08 23:53
George_George27-Jan-08 23:53 
GeneralRe: exception and global variable Pin
Cedric Moonen28-Jan-08 0:05
Cedric Moonen28-Jan-08 0:05 
George_George wrote:
Agree?


No, not at all. Suppose you use a Database class that is coming from a specific library that has been developed by a company other than yours. This database class throws an exception if it cannot be constructed.
What will you do ? Ask them to send you the source code because you want to add a specific error handling there ?

Also, if you develop such a class, you sometimes DO NOT WANT to know what to do on an error. Because it is totally bad design to have all the classes know how to manage the errors themselves.
Suppose that you develop this database class. When you use it to connect a specific database in the constructor, you want to check if the connection was successfull or not. If it failed, the only thing you would like to do is connect to another database. Sometimes later in your program, you want to use the same database class to connect another database but there, if it fails, you just want to log the information in a log file because it is not critical. Still in another part of your program, you want to reuse the same class but if the connection fails, you want to display a message box to the user and exit the program.

So, how are you gonna managing all of that in your class constructor ? That will become a big mess. It is not the purpose of the database class to manage the errors because it's simply not its job.
If you fail to understand that, you really should get out of your books and program for real because it seems you are totally disconnected from the 'real world programming'. It's not that hard to understand, is it ?

Cédric Moonen
Software developer

Charting control [v1.2]

GeneralRe: exception and global variable Pin
George_George28-Jan-08 0:26
George_George28-Jan-08 0:26 
QuestionRe: exception and global variable Pin
David Crow28-Jan-08 5:08
David Crow28-Jan-08 5:08 
GeneralRe: exception and global variable Pin
George_George28-Jan-08 13:43
George_George28-Jan-08 13:43 
GeneralRe: exception and global variable Pin
David Crow28-Jan-08 15:58
David Crow28-Jan-08 15:58 
QuestionHow to access a single object from multiple thread Pin
Ranojay27-Jan-08 21:57
Ranojay27-Jan-08 21:57 
GeneralRe: How to access a single object from multiple thread Pin
Iain Clarke, Warrior Programmer27-Jan-08 22:02
Iain Clarke, Warrior Programmer27-Jan-08 22:02 
GeneralRe: How to access a single object from multiple thread Pin
Ranojay28-Jan-08 20:20
Ranojay28-Jan-08 20:20 
GeneralRe: How to access a single object from multiple thread Pin
Iain Clarke, Warrior Programmer28-Jan-08 21:50
Iain Clarke, Warrior Programmer28-Jan-08 21:50 
GeneralRe: How to access a single object from multiple thread Pin
Ranojay30-Jan-08 20:49
Ranojay30-Jan-08 20:49 
GeneralRe: How to access a single object from multiple thread Pin
Iain Clarke, Warrior Programmer30-Jan-08 21:57
Iain Clarke, Warrior Programmer30-Jan-08 21:57 
GeneralRe: How to access a single object from multiple thread Pin
Ranojay1-Feb-08 22:03
Ranojay1-Feb-08 22:03 
QuestionNetwork detection on windows 98 Pin
Somnath_Mali27-Jan-08 20:36
Somnath_Mali27-Jan-08 20:36 
QuestionRe: Network detection on windows 98 Pin
David Crow28-Jan-08 5:11
David Crow28-Jan-08 5:11 
Question"Show Desktop" windows event? Pin
Somnath_Mali27-Jan-08 20:31
Somnath_Mali27-Jan-08 20:31 
QuestionRe: "Show Desktop" windows event? Pin
David Crow28-Jan-08 5:13
David Crow28-Jan-08 5:13 
Generalhelp [modified] Pin
gentleguy27-Jan-08 20:24
gentleguy27-Jan-08 20:24 
GeneralRe: help Pin
Iain Clarke, Warrior Programmer27-Jan-08 21:49
Iain Clarke, Warrior Programmer27-Jan-08 21:49 

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.