- 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.
- iOS Game Programming Cookbook
- .NET之美:.NET關鍵技術深入解析
- Learning Docker
- 跟老齊學Python:輕松入門
- Java Web應用開發技術與案例教程(第2版)
- C++程序設計基礎教程
- Mastering Apache Maven 3
- Python Web數據分析可視化:基于Django框架的開發實戰
- Access 2010數據庫應用技術實驗指導與習題選解(第2版)
- Learning Ionic
- Learning Grunt
- Java高并發編程詳解:深入理解并發核心庫
- Robot Framework Test Automation
- 計算機應用基礎案例教程(第二版)
- Java EE框架開發技術與案例教程