- Design Patterns and Best Practices in Java
- Kamalmeet Singh Adrian Ianculescu LUCIAN PAUL TORJE
- 146字
- 2021-06-25 20:52:29
Composition
As the name suggests, a class is a composition of another one. This is somewhat similar to aggregation, with the difference being that the dependent class ceases to exist when the main class ceases to exist. For example, a House is made up of a Room, but the Room ceases to exist if the House is destroyed, as shown in the following diagram:

In practice, especially in languages such as Java that have garbage collectors, the boundary between composition and aggregation is not so well defined. Objects are not destroyed manually; when they are no longer referenced, they are automatically destroyed by the garbage collector. For this reason, from a coding point of view, we should not really be concerned if we deal with a composition or an aggregation relationship, but it's important if we want to have a well-defined model in UML.
- HTML5+CSS3王者歸來
- Java Web開發學習手冊
- 從零開始:數字圖像處理的編程基礎與應用
- Git Version Control Cookbook
- Neo4j Essentials
- Learning Salesforce Einstein
- 高級語言程序設計(C語言版):基于計算思維能力培養
- Learning Python Design Patterns
- Programming with CodeIgniterMVC
- Scratch趣味編程:陪孩子像搭積木一樣學編程
- C++程序設計教程(第2版)
- 多媒體技術及應用
- Elasticsearch Blueprints
- 程序員必會的40種算法
- Getting Started with RethinkDB