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 componentsbut 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.
|