Introduction of Bridging Mode (Brief Introduction)
Bridging pattern, which separates the abstract part from its implementation, enables the abstraction and implementation to change independently.
Decouple an abstraction to implementation so this two can vary independently.
What is aggregation/combination:
Aggregation (Aggregation), when object A is added to object B and becomes part of Object B, an aggregation relationship between object B and object A. Aggregation is a kind of association relation, it is a strong relation, which emphasizes the relationship between the whole and the part.
Scene: the product and his specifications, style is the aggregation relationship.
Aggregation diagram of classes and classes
Combination (composite), object A contains object B, and object B leaves object a without practical meaning. is a stronger association relationship. A man contains his hand, and his hand leaves his body to lose its proper function.
Scene: The window form is a combination of slider slider, header header, and Workspace panel.
Combination of class and class diagram
Aggregation and synthesis principles: use aggregations or combinations as much as possible, and try not to use class inheritance.
An object's inheritance relationship is defined at compile time, so the implementation inherited from the parent class cannot be changed at run time. The implementation of a subclass has a very close dependency on its parent class, so that any change in the implementation of the parent class will inevitably result in a subclass change. When a subclass is needed, the parent class must be overridden or replaced by a more appropriate class if the integrated implementation does not meet the new problem. This dependency limits flexibility and ultimately limits reusability.
Ii. issues addressed (What to Solve)
When the system has multidimensional angle classification, and each classification is likely to change, then consider the use of bridging mode is more appropriate.
Bridging mode Analysis 1, bridging mode structure