void/Readwise/Understanding Composition in Software Development.md
2024-09-14 17:40:32 -03:00

27 lines
2.1 KiB
Markdown
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Understanding Composition in Software Development
![rw-book-cover](https://miro.medium.com/v2/da:true/resize:fit:1200/0*2px3-S5mOYJWlt1q)
## Metadata
- Author: [[Hamida Meknassi]]
- Full Title: Understanding Composition in Software Development
- Category: #articles
- Document Tags: [[dev]] [[dev/design-patterns]]
- URL: https://medium.com/@hamida.meknassi/understanding-composition-in-software-development-74f84ab984ce
- Archive: https://web-archive.alecodes.page/bookmarks?bf=1&search=&title=Understanding%20Composition%20in%20Software%20Development
> [!tldr]
> Composition is a software development principle that emphasizes building complex systems by combining smaller, independent components rather than using inheritance. This approach offers flexibility, reusability, and easier maintenance, making it a popular choice among developers. By favoring composition, developers can create more adaptable and manageable systems.
## Highlights
At its core, composition is about constructing complex systems by piecing together smaller, distinct objects. In object-oriented programming lingo, we often describe it as a “has-a” relationship rather than the “is-a” relationship that comes with inheritance. [View Highlight](https://read.readwise.io/read/01j7jxtrsfs087rbx45dgh9skx))
Flexibility : As requirements change, its easier to swap or upgrade individual components without disrupting the entire system.
Reusability : Crafted correctly, components can be used across various parts of a project or even in entirely different projects.
Maintainability : Focused and modular components are easier to understand, test, debug, and enhance.
Reduced Side Effect : Unlike inheritance, where modifying the base can have widespread consequences, composition limits the ripple effect of changes. [View Highlight](https://read.readwise.io/read/01j7jxvsqhk5j1bzjarjrwymhr))
When facing a complex problem, ask:
- Which components make up this system?
- How can I break this down into smaller, more manageable pieces?
- Can I reuse existing components? [View Highlight](https://read.readwise.io/read/01j7jxxp9dp3sqncv2d9rewnqs))