When is your code too defensive?

I had a discussion with some fellow developers a little while ago about DesignByContract and creating defensive code. The subject of being *too* defensive came up in the fact that while writing defensive code is a good thing, it’s not hard to go off the deep end and start building too many walls protecting your fort.

Any good developer has a certain level of skepticism when writing a line of code that depends on something from a related class/system. This includes checking for errors, making sure things are in an expected state, QA testing etc…, but when does this become too much of a burden?

About Sean Chambers

I am a Senior software developer from Palm Coast, Florida. An advocate of Domain Driven Design, Behavior Driven Development, creator of FluentMigrator and community activist. I am married to my beautiful wife Erin and am the proud father of two wonderful children. I currently reside at ACI, a local insurance industry/mortgage software company that excels in creating solutions using Agile methodologies.
This entry was posted in Uncategorized. Bookmark the permalink. Follow any comments here with the RSS feed for this post.