Scott Hanselman

Checking post-conditions in SOA as (or more) important than checking pre-conditions

October 22, '03 Comments [1] Posted in Programming
Sponsored By

I agree with Clemens on the postcondition discussion.  At the risk of using two quickie "gun/bullet" analogies in a month, I offer this one to explain why checking post-conditions is as (or more) important as checking pre-conditions.

It's better to take the bullets out of the gun, than to wear a bullet-proof vest.

Too often message validation is considered a defensive manuever to protect one's self from bad input.  I believe this "knee-jerk" style of coding is an artifact of C and C++ where engineers always check input pointers for nulls and such. 

In a system that is constrained by contracts, you certainly know as much about the outgoing messages and inherent contract as the incoming, so there's no reason not validate the outbound messages.

About Scott

Scott Hanselman is a former professor, former Chief Architect in finance, now speaker, consultant, father, diabetic, and Microsoft employee. He is a failed stand-up comic, a cornrower, and a book author.

facebook twitter subscribe
About   Newsletter
Sponsored By
Hosting By
Dedicated Windows Server Hosting by SherWeb
Wednesday, October 22, 2003 9:54:03 AM UTC
I can tell you why it's not done:

If you get a bad message and carry on regardless, you shoot yourself in the foot.
If you send out a bad message, you shoot someone else in the foot.

So naturally people are going to worry more about the first case than the second. ;)
Shane King
Comments are closed.

Disclaimer: The opinions expressed herein are my own personal opinions and do not represent my employer's view in any way.