CodeBetter.Com
CodeBetter.Com
RSS 2.0 via Feedburner
           Do you Twitter? Follow us @CodeBetter

Jeremy D. Miller -- The Shade Tree Developer

Under the hood and working with .Net, TDD, Software Design, and Agile Stuff

Relearning Lessons

It's never fun relearning something you already knew...

  • Last year I worked a lot against a database that was missing a lot of referential integrity and even a few uniqueness checks.  You know how the old timers say that's a really bad thing, but you've never actually seen it happen because you don't ever leave off the integrity?  Orphan records and duplicate records and other things that go bump in the night that you've heard campfire stories about?  Bad, bad stuff.  You can fix bugs in your code, but invalid data in the production database can be awfully dicey to clean up.
  • The doozy for me this week.   When you have performance problems, you profile the code because the performance problem may not be where you would expect it.  We have a performance problem in some new code inside a brand spanking new architecture.  We did a few (minor, it wasn't that bad) changes for performance that didn't help that much.  Then one of my coworkers used the JetBrains profiler on it and found that a 3rd party component in the mix was throwing and swallowing an exception on every single data record going through that component.  In one fell swoop we identified our performance problem.  A quick support request and we've got a patched version of the component to correct the problem.
  • Oh yeah, you know how they tell you that throwing and catching exceptions is expensive in CPU time?  Believe you me, that one's true.


Comments

jokiz said:

hi sir,

is this a custom exception that you're talking about meaning an unexpected result worked around through exception handling?

# December 13, 2006 8:07 PM

jokiz said:

oops.  i mean an "expected" right there

# December 13, 2006 8:12 PM

Jeremy D. Miller said:

jokiz, I don't know what the component code is doing and it's a case where I'd really like to pretend that the component doesn't exist.  If it's using an exception for flow control I think I'll be pretty irritated.  Strange you should ask though.  We're having to do some interoperability with Java code and the Java guys seem to be much more inclined towards using exceptions as simple flow control.   Besides the performance implications, I could do without that.

# December 13, 2006 8:23 PM

Fregas said:

I agree that Exceptions should NOT be  used for flow control.  However, I will throw custom exceptions when there is some critical thing that happens and I want the user to actually see an error.  This sounds non-intuitive but it usually prevents things like bad data or bad application state because you see the custom error in development and QA and figure out how to avoid it.

# December 15, 2006 1:04 PM

Leave a Comment

(required)  
(optional)
(required)  

Enter the numbers above:
Add

About Jeremy D. Miller

Jeremy began his IT career writing "Shadow IT" applications to automate his engineering documentation, then wandered into software development because it looked like more fun. Jeremy previously worked as a systems architect building mission critical supply chain software for a Fortune 100 company and learned agile development practices as a .Net consultant at ThoughtWorks, one of the pioneers of agile development. Jeremy is the author of the open source StructureMap (http://structuremap.sourceforge.net) tool for Dependency Injection with .Net and the forthcoming StoryTeller (http://storyteller.tigris.org) tool for supercharged FIT testing in .Net. Jeremy's thoughts on just about everything software related can be found on his weblog "The Shade Tree Developer" at http://codebetter.com/blogs/jeremy.miller, part of the popular CodeBetter site. Jeremy is a Microsoft MVP for C#. Check out Devlicio.us!

This Blog

Syndication

News

All opinions expressed here constitute my (Jeremy D. Miller's) personal opinion, and do not necessarily represent the opinion of any other organization or person, including (but not limited to) my fellow employees, my employer, its clients or their agents.

About Me

"Best Of" Compendium

StructureMap (Dependency Injection for .Net)

StoryTeller (Supercharged Fit)

Build your own Cab

TestDriven

MVP