Simplifying Component Inheritance

When you want one component to extend another, if the parent component is in the same package (directory) as the child component, you don’t have to specify a fully-qualified name. For instance, if both components were in the directory “/myApp/components/handlers” rather than doing this…

<cfcomponent name="myComponent" extends="myApp.components.somePackage.Parent">

…you can do this…

<cfcomponent name="myComponent" extends="Parent">

This is particularly useful when you want your component path to be dynamic or configurable since if you hard-code the entire path, and you want to move your components or your entire application to a different directly, all your component inheritance would be broken.

2 Responses to Simplifying Component Inheritance

  1. This also applies to calls to other cfcs in the same package as well, ie you can use cfinvoke name=”foo” instead of name=”fullqualified etc”

  2. says:

    Raymond, I think you’re mistaken