Extends
Overview
Extends is ParamML's mechanism for reusing and building upon existing objects. It implements inheritance - a core concept from Object-Oriented Programming (OOP).
What you'll learn:
Basic Extends syntax
Single and multiple inheritance
Versioning library components
Override mechanism (critical rules!)
When to use Scoped="1"
Top-level vs Group-level extends
Type inheritance and compatibility
Common patterns and best practices
What is Extends?
The Extends attribute allows an object to inherit all parameters and sub-objects from one or more parent objects.
Key concepts:
A child receives all parameters and sub-objects from its parent(s)
Children can add new parameters and objects
Children can override inherited content using
Override="1"Extends is transitive (grandparent → parent → child)
Extends supports multiple inheritance (multiple parents)
Inheritance: The Underlying Concept
Inheritance means deriving a new object from an existing one. Think of it like:
Parent = Base template
Child = Specialized version with everything from parent + additions/changes
Conceptual Example
An Engineer includes all attributes from:
Person (age, name)
Employee (working_hours, income)
Engineer (field, position)
Basic Syntax
Use the Extends attribute to inherit from another object:
Critical rule: Every object must have a T (Type) attribute, even when using Extends:
Single Inheritance
Example: Person → Employee → Engineer
Base: Person
Child: Employee extends Person
Grandchild: Engineer extends Employee
Result:
Multiple Inheritance
Use array syntax to extend from multiple parent objects:
Example: Multiple Base Classes
Best Practice: Avoid duplicate parameter names across parent objects to prevent ambiguity.
Versioning
Library components can have versions. Use ::v# syntax:
Version Syntax
Rules:
✅ Versioning applies only to library components
✅ No version = latest version
✅ Can mix versioned and non-versioned in array
❌ Cannot version local objects (in same file)
Example
Override="1"
Override="1" is used to replace content inherited from parent.
Critical Rules
Override is an object attribute - can only be applied to objects, not parameters
Two ways to override:
A) Override at Extends level (selective - only specified parameters)
B) Override named object in parent (complete replacement - all parameters)
Override at Extends Level (Selective Override)
When you use Override="1" at the Extends level, you only override the parameters you define. Other parameters are inherited as-is.
Syntax
Example
Result:
Multiple Parameter Override
Result:
Override Named Object (Complete Replacement)
When you override a named object from the parent, you must redefine all parameters - nothing is inherited from the parent's version of that object.
Syntax
Example
If you forget to redefine:
Result: Employee.Info will only have text, not status.
How to Override Parameters at Top Level
At T="Project" level, parameters cannot be overridden directly. You must:
Group parameters in the parent
Override the group in the child
Wrong Approach
Correct Approach
Override Summary Table
At Extends level
<O T="Group" Extends="Parent" Override="1">
❌ No - only what you define
Change few parameters
Named object
<O N="Config" T="Group" Override="1">
✅ Yes - all parameters
Replace entire object
Quick Decision Guide
Want to change 1-2 parameters?
Want to completely replace an object?
Scoped="1"
Scoped="1" isolates the extended object's namespace.
Rules
Simple rule:
Top level (
T="Project"): NoScoped="1"Everything else: Use
Scoped="1"
Top Level (No Scoped)
Inside Objects (Use Scoped)
Without Scoped (Top Level)
With Scoped (Inside Object)
When to Extend at Top vs Group Level
Top Level (T="Project"): True Inheritance (IS-A)
Use when child is a type of parent:
When to use:
True inheritance relationship
Child is a specialized version of parent
Type compatibility needed (see Type Inheritance and example below)
Type Compatibility Through Base Classes
A key reason for top-level inheritance is creating type compatibility - allowing input parameters to accept multiple related component types.
The Problem
The Solution: Base Class
Create a base class that both girder types extend:
Usage
Why This Works
Pattern Summary
When you need a parameter to accept multiple component types:
✅ Create a base class with common interface (exported parameters)
✅ Extend base class to specialized types
✅ Use base class as parameter type:
T="BaseClass"✅ All specialized types now accepted by parameter
Benefits:
Single parameter definition works with multiple component types
Type safety maintained (can't pass unrelated components)
Common interface guaranteed through base class exports
Easy to add new specialized types later
Group Level (T="Group"): Reusing Logic (HAS-A)
Use when object uses parent's calculations:
When to use:
Reusing calculations from library
Not a true inheritance relationship
Want to namespace the extended content
Decision Guide
Child is specialized parent
Top level
SteelBeam extends Beam
Using calculation library
Group level
Using AASHTOCode in ColumnCheck
Need type compatibility
Top level
BaseGirder accepted by Cross_Frame
Namespacing needed
Group level
Multiple calculations in same object
Transitive Inheritance
Inheritance is transitive - children inherit from entire ancestor chain.
Example
Result:
With Overrides
Result:
Process:
Base is created
Middle extends Base, applies overrides
Child extends Middle (with its overrides), applies its own overrides
Type Inheritance
A child inherits all types from its parent.
Type Chain
Why This Matters
Parameters with type constraints accept compatible types:
Rule: Child types are compatible with parent types (polymorphism).
Extending Objects Inside Other Objects
You can extend objects at any level, not just top level.
Example: Extending Inside Volume
Common Patterns
Pattern 1: Base Class with Specializations
Pattern 2: Reusing Calculation Logic
Pattern 3: Selective Parameter Override
Pattern 4: Multiple Base Classes for Modularity
Pattern 5: Version-Specific Extensions
Extends vs Instances
Critical distinction:
Purpose
Inherit structure
Create instance
Syntax
Extends="Parent"
T="ComponentName"
Use with
Core objects
Library components
Common types
T="Project", T="Group"
User components
Can combine?
❌ No
❌ No
Extends (Inheritance)
Use for:
✅ True inheritance (is-a relationship)
✅ Reusing calculation logic
✅ Core objects (
T="Project",T="Group",T="Section")
Instances (T="...")
Use for:
✅ Creating instances of library components
✅ Building compositions (has-a relationship)
✅ User-developed components
Cannot Combine
Rule: Use either Extends (inheritance) or T="ComponentName" (instance), never both.
Best Practices
1. Avoid Parameter Name Conflicts
❌ Bad - duplicate parameters:
✅ Good - unique parameters:
2. Use Scoped="1" Consistently
3. Use Versioning for Stability
4. Choose Override Strategy Wisely
5. Group Parameters for Overriding
6. Document Inheritance Chains
7. Choose Inheritance Level Wisely
8. Keep Inheritance Hierarchies Shallow
Deep hierarchies are harder to understand and maintain.
9. Remember Override Rules
Quick reference card:
Common Mistakes
❌ Mistake 1: Missing T Attribute
❌ Mistake 2: Trying to Override Parameters Directly
❌ Mistake 3: Forgetting to Redefine All When Overriding Object
❌ Mistake 4: Missing Scoped="1" Inside Objects
❌ Mistake 5: Combining Extends and Instance Creation
Summary
Key Concepts
Extends
Inherit parameters and objects from parent
Multiple
Extends="[A, B, C]" - inherit from multiple parents
Versioning
Extends="Component::v3" - use specific version
Override="1"
Replace inherited content (objects only, not parameters)
Scoped="1"
Namespace extended content (use except top level)
Transitive
Child gets everything from entire ancestor chain
Type inheritance
Child carries all parent types
Override Rules (Critical!)
Extends level
<O Extends="Parent" Override="1">
❌ No - selective
Change few parameters
Named object
<O N="Config" Override="1">
✅ Yes - complete
Replace entire object
When to Use
True inheritance
Top-level Extends
Column extends Base_Column
Reuse calculations
Group-level Extends
Using AASHTOCode
Multiple bases
Array syntax
Extends="[A, B, C]"
Specific version
Version syntax
Extends="Base::v5"
Change few params
Extends-level Override
<O Extends="X" Override="1">
Replace object
Named Override
<O N="Config" Override="1">
Rules to Remember
Must have T attribute - every object needs
T, even with ExtendsOverride is for objects - cannot override parameters directly
Two override behaviors - selective (Extends level) vs complete (named object)
Cannot combine
ExtendsandT="ComponentName"(instance)Use
Scoped="1"except at top level (T="Project")Avoid conflicts in multiple inheritance
Version for stability, latest for development
Transitive - inherit entire ancestor chain
Type compatible - child accepted where parent expected
Last updated