Sponsored By Aspose - File Format APIs for .NET

Aspose are the market leader of .NET APIs for file business formats – natively work with DOCX, XLSX, PPT, PDF, MSG, MPP, images formats and many more!

OO, TDD, and Agile processes are all good, but better get the basic things right too

I mostly blog about more or less abstract topics like Agile development processes, design patterns, and TDD strategies because it’s what I’m mostly interested in at the moment.  I definitely think these topics are important, but it’s often doing the basic things poorly that make a system unreliable and hard to modify and support.  There are some underlying activities that we have to do to make a system function well, and some of these things aren’t really described very well by the Agile canon. 

Case in point from a conversation I had with a colleague at lunch today, the legacy systems that my team centers around share a database that lacks some logical referential integrity checks and uniqueness constraints.  We were groaning that the database schema allows a motley collection of orphan records and duplicate data that is making our lives harder.  That’s the kind of activity that I would consider so intrinsic to building software that I wouldn’t even think to talk about it, but the effect of the missing database constraints has caused us some difficulties.  I wouldn’t say that all of us need to be experts, but I think every single enterprise developer needs to have some level of comfort with referential database theory.

Here are some other basic things that I think fall through the cracks a bit if you’re not paying attention:

  1. Database indexes.  Too much, too little, or just the wrong indexing will drag your code down
  2. The ACID rules and transactional boundaries.  I think the mass majority of systems I’ve seen do a bad job of governing their transactional boundaries.  I’m not talking about “look those jokers didn’t use the perfect transaction isolation level there,” I mean zero transactions at all.  When things blow up and go wrong, will your code and database end up in an invalid state?  Will you lose data?  Drop messages?  It’s not just important for database development either, you also need to consider the interaction with any kind of external system or messaging infrastructure as well.
  3. Database archiving.  Databases can get awfully slow when table sizes get bigger.  I watched a batch processing system implemented by a very large and prominent consulting company (here comes the script kiddies!) become almost useless in its 6th week of production due to severe performance problems.  The culprit?  A very poor database design from the software vendor was compounded by the lack of a database archiving strategy.  I got to lead a team that built a replacement a couple months later.  Our system archived records the second that the workflow was completed.  Our throughput was 2 orders of magnitude higher.
  4. File system archiving.  Weird, nasty things happen when servers run out of disk space.
  5. One of the things I love about .Net over the “Set objEverything = Nothing” nonsense in VB6 is garbage collection, but it isn’t magic.  Gotta make sure that unmanaged resources are cleaned up.
  6. Database connection discipline.  One of the many reasons I think we all need to stop writing so much ADO.Net code by hand is to eliminate the possibility of screwing up database connection usage.  I’ve been told this isn’t as big an issue with the newer Oracle and Sql Server versions as it was 5 years ago, but I wouldn’t bet the farm on the database being able to handle a couple thousand orphaned database connections.
  7. This is probably rare, but I had to fight with an XP zealot PM over this one time.  If you’re going to use some sort of offline pessimistic lock, you need to have some sort of mechanism to clear out stale locks.  Things will go wrong.
  8. Adequate tracing and auditing – that is easily accessible and useful to the production support folks.  In Agile process speak – remember that the production support organization is an important stakeholder in your project.  In my case we’re the support as well, so I think we’ll care a bit about this one.  On the other hand I detest code with too much tracing because I think it obfuscates the code and generates too much noise to be useful. 
  9. Coding standard.  Consistency is the hobgoblin of little minds but the hallmark of a smoothly running software team.  This is called out very specifically by XP as a core practice, but I think my company has done a poor job of developing and following a coding standard in the past. 

I’ve seen Agile teams screw themselves by taking a too literal approach to the XP ideals by putting on the blinders and only focusing on the functional requirements from the customer.  There are additional technical requirements that could be termed a “cost of doing business” expense for building a system.  You have to fulfil these requirements to make the system viable.  It’s our responsibility as developers and architects to communicate these issues to the project manager to insure these purely technical stories are adequately accomodated by the iteration and release plans.  Now, what to do when the PM doesn’t listen to you?  Um, run away?

About Jeremy Miller

Jeremy is the Chief Software Architect at Dovetail Software, the coolest ISV in Austin. 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 is the author of the open source StructureMap tool for Dependency Injection with .Net, StoryTeller for supercharged acceptance testing in .Net, and one of the principal developers behind FubuMVC. Jeremy's thoughts on all things software can be found at The Shade Tree Developer at http://codebetter.com/jeremymiller.
This entry was posted in Database and Persistence. Bookmark the permalink. Follow any comments here with the RSS feed for this post.
  • http://davidallen.editme.com/ David K Allen

    I agree these issues are important.
    I would offer a reason why these things “fall thru the cracks” of Agile conversations.
    TDD is the hot thing in agile conversations, and I agree totally.
    But Design By Contract is another very powerful tool that I rank right alongside test-driven design in my toolchest. And agilites seem to have only a light-weight undestanding of the theory of software contracts.

    Every time I code some code (C# or SQL schema, or whatever), I ask “What contracts can I put in here to better express what this module (class, method, database table, etc..) can and cannot do?”

    So in my philosophical world, Design-by-Contract (DbC) should pervade everything just like Test-Driven Design (TDD) should.

    If you think this way, then you have a mental bucket for where to put database constraints that is broader than just db constraints but includes preconditions on methods and stored procedures etc…

    David Kreth Allen