Using Object-Oriented Development
The framework provides the basic constructs of inheritance and encapsulation from object-oriented programming and applies them to presentation layer development.
For example, components are encapsulated and their internals stay private. Consumers of the component can access the public shape (attributes and registered events) of the component, but can’t access other implementation details in the component bundle. This separation gives component authors freedom to change the internal implementation details and insulates component consumers from those changes.
Inheritance in Aura components doesn’t work the way it does in Apex or Java. Using inheritance in Aura makes your code harder to understand as the behavior isn’t always intuitive. When possible, use composition instead of inheritance.
-
Favor Composition Over Inheritance
Aura supports inheritance, but it favors composition. When possible, use composition.
-
Inherited Component Attributes
A sub component that extends a super component inherits the attributes of the super component.
-
Interfaces define a component’s shape by defining attributes, events, or methods that any implementing component contains. To use an interface, a component must implement it. An interface can’t be used directly in markup.