{ by david linsin }

October 09, 2007

Code reusability is hard...

... as anyone who has tried to herd the cats (developers) all together towards some form of reusability or core technology will tell you. Every developer will loudly proclaim that code must be reused. They will immediately follow this up by demanding to work in a core technology group that will produce the greatest code for sharing since sliced bread. What they’re really saying is, “Everyone should reuse code, but it has to be my code they reuse.” ... In 99 out of 100 cases, the recipient (developer) will loudly proclaim that the code is completely unusable and will have to be rewritten.
I love this kind of statements, cause they are a reality check for me. I noticed that I do reuse code without any objection, if it's a small portion or a class. As soon as it's a framework or a component, I start looking for javadocs or other kinds of documentation. If there are no resources or examples to work with, I won't touch the thing. I simply don't want to spend hours looking at undocumented code, trying to understand it.

I took over the project I'm working on right now about two years ago and I guess I refactored about 90% of it since then. Notice the term "refactored" not rewritten. However, I had to rewrite portions of it. Requirements changed, use cases changed, well almost everything changed. Still, there are parts of the application which were written more than two years ago, still in production and I'm still reusing them in new code I'm implementing right now.

So I guess as long as the code doesn't exceed a certain amount of complexity, I'm willing to touch it. That doesn't mean I'm not gonna refactor it!


Anonymous said...

Refactoring can repurpose or even improve code. But, it can also be a great way to become familiar with a piece of code. Making a change to the code that is relatively minor, but touches a fair amount of it is a way to establish familiarity and start to make the code your own.

Bravo for your open mindedness to use at least a bit of someone else's code. It's actually a very difficult thing to do.




  • mail(dlinsin@gmail.com)
  • jabber(dlinsin@gmail.com)
  • skype(dlinsin)