Dry + !SRP = Maintenance nightmare

I am currently working on a piece of SQL code which is very “clever” as it is very dry (as a bone) and has abstracted the functionality to a few routines. However, it is an absolute maintenance nightmare because it absolutely doesn’t follow the Single Responsibility.

Hence these routines are taking in a huge amount of parameters and although there are hardly any conditional code in these routines, it is very difficult to follow what is going on because of the many number of nulls getting passed in. Had this been C# we could have used Named parameters to make things a bit more readable but in this case it’s SQL.As things stand, I am afraid to touch the code simply because it might have unforseen knockon effects!

So the lesson here for me is DRY is good but not at the expense of maintainability. Hence DRY + !SRP = Maintenance nightmare.

Posted in .NET

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: