Click here to Skip to main content
16,008,010 members
Home / Discussions / .NET (Core and Framework)
   

.NET (Core and Framework)

 
AnswerRe: Preference for C# over VB.NET Pin
Leah_Garrett27-Nov-06 12:23
Leah_Garrett27-Nov-06 12:23 
AnswerRe: Preference for C# over VB.NET Pin
ednrgc29-Nov-06 7:01
ednrgc29-Nov-06 7:01 
QuestionGeneral Question: A Language-Independent Design by Contract Framework--what would it be worth? Pin
Philip Laureano26-Nov-06 12:01
Philip Laureano26-Nov-06 12:01 
AnswerRe: General Question: A Language-Independent Design by Contract Framework--what would it be worth? Pin
Kevin McFarlane27-Nov-06 5:21
Kevin McFarlane27-Nov-06 5:21 
AnswerRe: General Question: A Language-Independent Design by Contract Framework--what would it be worth? Pin
PIEBALDconsult28-Nov-06 3:57
mvePIEBALDconsult28-Nov-06 3:57 
GeneralRe: General Question: A Language-Independent Design by Contract Framework--what would it be worth? Pin
Philip Laureano28-Nov-06 10:18
Philip Laureano28-Nov-06 10:18 
GeneralRe: General Question: A Language-Independent Design by Contract Framework--what would it be worth? Pin
PIEBALDconsult28-Nov-06 14:44
mvePIEBALDconsult28-Nov-06 14:44 
GeneralRe: General Question: A Language-Independent Design by Contract Framework--what would it be worth? Pin
Philip Laureano28-Nov-06 15:31
Philip Laureano28-Nov-06 15:31 
PIEBALDconsult wrote:
Philip Laureano wrote:
and check if it's valid.



It just seems poor style, unless you mean to throw InvalidCastException.


The first few versions of LinFu that I had actually allowed users to throw specific types of exceptions, but to me, it made more sense to split the process into two parts:

1.) Allow users to check the precondition/postcondition/invariant and show whether or not it passes (hence, the boolean part).
2.) And if the check fails in debug builds, the debugger will assert with the message that you write to the stdOut TextWriter. (In release builds, however, it will specifically throw a Pre/Post/InvariantViolationException.)

While it is possible to throw exceptions of your own, I strongly recommend against it.

The whole point here is that exceptions thrown from DbC checks should never be caught. IMHO, they should fail hard so that it forces the programmer to fix whatever violated the precondition/postcondition that caused the check to fail.

However, I can't completely dismiss having users throw specific types of exceptions from checks altogether--if one does throw an exception for a check (whether it is a pre/post/invariant), I could easily catch it and wrap it into the InnerException property of a Pre/post/invariantViolationException.

p.s. Thanks for the interesting feedback!
AnswerRe: General Question: A Language-Independent Design by Contract Framework--what would it be worth? Pin
PIEBALDconsult28-Nov-06 8:36
mvePIEBALDconsult28-Nov-06 8:36 
QuestionCrystalReport Pin
aPerfectCircle25-Nov-06 14:28
aPerfectCircle25-Nov-06 14:28 
AnswerRe: CrystalReport Pin
Paul Conrad26-Dec-06 17:06
professionalPaul Conrad26-Dec-06 17:06 
QuestionQuestion about MemberInfo.ReflectedType [modified] Pin
PIEBALDconsult24-Nov-06 16:09
mvePIEBALDconsult24-Nov-06 16:09 
AnswerRe: Question about MemberInfo.ReflectedType Pin
Philip Laureano28-Nov-06 10:36
Philip Laureano28-Nov-06 10:36 
GeneralRe: Question about MemberInfo.ReflectedType Pin
PIEBALDconsult28-Nov-06 14:30
mvePIEBALDconsult28-Nov-06 14:30 
GeneralRe: Question about MemberInfo.ReflectedType Pin
Philip Laureano28-Nov-06 15:15
Philip Laureano28-Nov-06 15:15 
QuestionWindoow handler Pin
indian14324-Nov-06 3:59
indian14324-Nov-06 3:59 
AnswerRe: Windoow handler Pin
Dave Kreskowiak27-Nov-06 4:55
mveDave Kreskowiak27-Nov-06 4:55 
AnswerRe: Windoow handler Pin
Dave Kreskowiak28-Nov-06 1:24
mveDave Kreskowiak28-Nov-06 1:24 
QuestionFind all descendents of a type? Pin
Senor Plankton24-Nov-06 0:51
Senor Plankton24-Nov-06 0:51 
AnswerRe: Find all descendents of a type? Pin
Guffa24-Nov-06 1:03
Guffa24-Nov-06 1:03 
GeneralRe: Find all descendents of a type? Pin
Senor Plankton27-Nov-06 0:16
Senor Plankton27-Nov-06 0:16 
QuestionJAbber Pin
Tauseef A23-Nov-06 21:48
Tauseef A23-Nov-06 21:48 
AnswerRe: JAbber Pin
ednrgc27-Nov-06 3:50
ednrgc27-Nov-06 3:50 
QuestionText box shadowing Pin
~~~Johnny~~~23-Nov-06 12:04
~~~Johnny~~~23-Nov-06 12:04 
AnswerRe: Text box shadowing Pin
Thomas Stockwell23-Nov-06 15:00
professionalThomas Stockwell23-Nov-06 15:00 

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.