- 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.
- Microsoft Exchange Server PowerShell Cookbook(Third Edition)
- Python數據分析基礎
- Boost C++ Application Development Cookbook(Second Edition)
- arc42 by Example
- Java加密與解密的藝術
- 重學Java設計模式
- 劍指MySQL:架構、調優與運維
- Python算法指南:程序員經典算法分析與實現
- ActionScript 3.0從入門到精通(視頻實戰版)
- Mudbox 2013 Cookbook
- Learning Kotlin by building Android Applications
- Swift Essentials(Second Edition)
- 面向物聯網的Android應用開發與實踐
- Boost.Asio C++ Network Programming Cookbook
- 亮劍ASP.NET項目開發案例導航