So I spent all morning looking at the application block, trying to work out what it did, and what the generic terms actually meant. To use this application block in our application would have meant taking out some of it, and adding something else to it. I suggested that this wasn't really "reuse", as it changed the meaning of the original code. This was countered with the point that if the code has been written already, why rewrite it?
Having slept on it, it seems that the two extremes of reuse are:
- This existing code does exactly what we need, so we'll use it.
- This existing code does the opposite of what we need, in a different language, and on a different platform, so we won't use it.
On the other hand, if the code inside the module is well written, and easy to read and understand, it may be a trivial task to bend it into the exact requirement. Identifying quite where the tipping point is involves the skill of a talented developer.
The exception handling application block (in the context of my current project) seems to be extreme number 1, which is fantastic. It just does it. Include the assembly, set up the config file, and add a line of code in the catch block. Bish bash bosh. This is what I would call "reuse". I'm not sure what to call stuff between this extreme and the tipping point though. What is the maximum amount of change a code module can undergo and still be considered "reusable"?