Brian H. Madsen
Computer says no

Code Reuse is Not the Villain, by Scott Reynolds

August 7th 2007 in 2104, 3022

I was doing some “house cleaning” today of my, by now, massive “Blogs” favorites folder and saw a few blogs i simply couldn’t put a “face” to.

Being curious by nature i ventured over to satisfy myself and see whatever it was that made me bookmark this blog.

The target of my curiosity was Scott Reynold’s blog and after having a brief look i saw why it’d been bookmarked…

I came across a very interesting post by the man himself – Code Reuse is Not the Villain – which factored some of the things i value very highly in development…code reuse.

i’m not just talking about cutting some code into your toolbar to drag in, or adding a snippet to your snippet library in VS.

No, i’m talking about taking that extra moment to consider not just the use, but also the place in the project where the class is going to live..

Many developers apply MVP or MVC patterns, sometimes even without knowing about it, which means there’s intuition involved (or experience?) when making that decision.

Others adhere strictly to a company wide architecture which is set in concrete and out-of-bounds for the regular developer as the architect is the owner of it.

Scott mentions a few tips which i think should be “advertised” a bit more in general.

  1. Aim for zero development for reusable code – you don’t want to have to re-write half of your class just to suit it to another project.
  2. refactoring is NOT necessarily the key to reusable libraries.

And here’s a few from me…

  • Consider heavily the “reusability” of your class before you start spending time on attempting to make it reusable.
  • Plan your code BEFORE you throw yourself into the first “private partial class”.

As Scott says, a lot of code just isn’t meant to be reusable…

Scott went out on a limb with that one, or so he claims ;) but i seriously think it’s one of the more important points…We all know that buzzwords like OOD and OOA are thrown around the floor constantly, but can you truly say that ALL your code is completely OO? I’d venture as far as to say that less than what you think is actually true to that fact.




required



required - won't be displayed


Your Comment:

*

One of the things i mentioned some time back was that i was getting tired of Gmail and was looking at alternatives. Out of the weeds came a faerie – Peter Ward from WardyIT.com – who offered to set me up with a Managed Exchange. WARDY IT Solutions is Brisbane’s leading SQL Server consulting [...]

Previous Entry

After a rough weekend and an even worse Monday and Tuesday, my wife took my youngest daughter to the doctor again today. This time there was something “nearly” definite – but yet not quite completely certain. Pneumonia was the proposed diagnosis..or rather he wanted to start her on a preventative treatment in case it flared into [...]

Next Entry