Saturday, August 20, 2005
The Case For Code Reuse
The case for code reuse is multiple, and we have tried to do so since the early days of programming. In procedural languages, we used functions / procedures as a means of reuse; then there was include tags in asp scripts. Rather rudimentary, if you ask me. These means did work to a certain extent, but also introduced many issues of their own.
This article 'Code Reuse in the Enterprise' states reuse as beyond reusing of code, and I quote:
"... reuse has move beyond 'code reuse' to include a wide range of assets that can be used in multiple applications and projects. An organization's software assets could include any artifact related to the software development life cycle such as code components, Web services, patterns, models, frameworks, architectural guidelines, and process templates"
Yes, and in fact, that is the true value of reuse; not only at the code level, but in the way we go about architecting and designing applications also; The benefits that I see are threefold:
This article 'Code Reuse in the Enterprise' states reuse as beyond reusing of code, and I quote:
"... reuse has move beyond 'code reuse' to include a wide range of assets that can be used in multiple applications and projects. An organization's software assets could include any artifact related to the software development life cycle such as code components, Web services, patterns, models, frameworks, architectural guidelines, and process templates"
Yes, and in fact, that is the true value of reuse; not only at the code level, but in the way we go about architecting and designing applications also; The benefits that I see are threefold:
- Increased development speed - as the development team overcomes the initial steep learning curve in adopting any architecture frameworks, it becomes easier for them to 'reuse' these knowledge onto subsequent projects to achieve the same functionalities e.g. security, logging etc. In fact, the .NET Framework is such a case, albeit on a more general and broader context. Enterprises or software vendors can come up with the own frameworks, building on the .NET Framework, customizing it into their context of application. An example of such a framework would be the MS Enterprise Library.
- Product stability - as the frameworks matures over time, reuse will ensure that the functionalities they provide are 'tried-and-tested', making sure bugs and issues are already identified and rectified. This results in lesser-bugs per line of code and yet lesser time for development.
- Consistency and Standardization - As design patterns are applied over and over again across projects, it becomes 2nd nature for developers to adhere to a consistent coding standards, which then forms a de-facto enterprise level coding guideline. This consistency makes it easier for new developers to take over existing projects, and increase the maintainability of the programs. Again, the .NET Framework does a very good work of applying these design patterns that developers building applications on top of the framework finds it easy to adopt knowledge from using one part of the framework onto another part. A good example as highlighted in
'Discover the Design Patterns You're Already Using in the .NET Framework', is the Observer Pattern which is applied throughout the framework, allowing the decoupling of the event source and the event handler. It is consistently used in event handling behind UI triggers, both for Windows and Web applications.
I guess there are more benefits, but these are some that are most striking to me. However, be mindful that reuse is no 'silver bullet' to the software developments woes; overrun projects, late delivery, requirements mismatch etc. Nonetheless, adoption of reuse is necessarily one of the key driver in many of the success stories of software projects.