How to Write Software Just Once

Building reusable components is just the first step—learn how to build reusable applications.
by Mike Cahn

s you work on consecutive projects, you will eventually find yourself coding the same functionality repeatedly. When you reach this stage, you're ready to explore the idea of code reuse. Most development teams already have code or component libraries that they draw on for each new project. But reusing code and components is just the first step. I'll show you how to raise reuse to the next level: reuse of an entire application.

If you create software for a particular business function or a specific vertical market, you will normally find enough overlap between customer requirements to reuse core code and components—but enough differences that you must still write the overall application anew for each customer.

Unfortunately, rewriting increases design and development time and complicates maintenance. For example, if you have multiple versions, propagating a bug fix or product enhancement requires separate changes and testing for each customer. Reusable components help; but when the core logic of all the applications is the same, wouldn't it be better if you could reuse that as well?

The answer is that you can, by developing a core product in such a way that you can hook in different customization layers, without having to change the core code.

What is a Hook?
A "hook" is a place where you hang your customization code: it is a method call from your core product to a custom component. Your core product makes these calls at any point where a customization layer (the "hook component") might need to know what is happening, or might want to modify core product behavior.

Typically, a hook method call passes data relevant to the current context to the Hook component, which processes the call and returns status information.

When designing a core product and hook component, be sure you make the pair as loosely coupled as possible, so that future changes to the core product don't require changes to hook components already deployed. You must also ensure that the hook component will behave correctly even after adding new hook calls from the core product that weren't envisioned when the hook component was deployed.

 
Identifying Core Functionality

What is a Hook? Identifying Core Functionality Defining the Hook Interface
Hook Component effects on the Core Product Practicalities  







 TALK BACK
This article shows how you can extend reusability beyond mere components into core applications. Do you write the types of applications that this article addresses—repeated variations on a theme? Do you think that the ideas apply to any other types of applications? At what point do you think it becomes worthwhile to plan and build a reusable application? After the first one? The second? The fifth? Never? Let us know what you think in the web.design discussion group.
Click here to Join
Download the code for this article

Introduction to Object-Oriented Programming and Design Patterns in Visual Basic 6 and VB.NET

Patterns and Software: Essential Concepts and Terminology





 
Sponsored Links

Advertising Info  |   Member Services  |   Contact Us  |   Help  |   Feedback  |   Site Map
Jupiterweb networks

internet.comearthweb.comDevx.comClickZ

Search Jupiterweb:

Jupitermedia Corporation has four divisions:
JupiterWeb, JupiterResearch, JupiterEvents, and JupiterImages

Copyright 2004 Jupitermedia Corporation All Rights Reserved.
Legal Notices, Licensing, Reprints, & Permissions, Privacy Policy.

Jupitermedia Corporate Info | Newsletters | Tech Jobs | E-mail Offers

Copyright Information/Privacy Statement