Composable Code Can Be Simple – Intro to dependency diagrams and composition
Tags: ios, swift, learning, mastery
Published: 2018-11-14 13:46:27

---
title: Composable Code Can Be Simple – Intro to dependency diagrams and composition
published: true
tags: ios, swift, learning, mastery
canonical_url: https://www.essentialdeveloper.com/articles/composable-code-can-be-simple-intro-to-dependency-diagrams-and-composition
cover_image: https://thepracticaldev.s3.amazonaws.com/i/0m07xx2qb62939t3gutk.png
---

{% youtube Mk34R-Q9-RE %} [Watch on YouTube](https://www.youtube.com/watch?v=Mk34R-Q9-RE&t=0s&list=PLyjgjmI1UzlT2jbk9WeqNrZhZyKpPPaWq)

In this episode, we continue exploring the dependency inversion principle and composition, while documenting our system's evolution in diagrams.

## Learning outcomes

- Understand basic depiction of dependencies, abstractions and concrete types in diagrams

- Understand how diagrams translate into code and vice versa

- Understand how the [SOLID principles and composition](https://www.essentialdeveloper.com/articles/clean-ios-architecture-part-3-composing-types-in-swift) are applied through the examples

- Understand differences and similarities between closures and protocols as abstractions in Swift (unnamed type signatures vs. strictly named types)

## Visualizing the dependency graph

Visualizing our code in diagrams can be a great framework to think while modeling [the design of our systems](https://www.essentialdeveloper.com/articles/clean-ios-architecture-part-2-good-architecture-traits). The early visualization of the design can make an excellent tool for communicating ideas to our colleagues and planning/coordinating a team effort. Diagrams can also help with [independent development](https://www.essentialdeveloper.com/articles/consequences-of-ineffective-communication-in-ios-teams), as the team can quickly plan new features design (5-10 minutes on a whiteboard), build them in parallel and later integrate the pieces without conflicting with the work of other developers.

Moreover, diagrams serve as a great diagnostic tool as they embody the dependency graph of components and modules, revealing tight coupling and even retain cycles that could potentially lead to rigidity and [memory leaks](https://www.essentialdeveloper.com/articles/the-minimum-you-should-do-to-prevent-memory-leaks-in-swift). Learning how to draw and read diagrams is an excellent addition in the skillset of developers that aim to create sustainable codebases.

[Subscribe now to our Youtube channel](https://www.youtube.com/essentialdeveloper?sub_confirmation=1) and catch **free new episodes every week**.

* * *

We’ve been helping dedicated developers to get from low paying jobs to **high tier roles – sometimes in a matter of weeks!** To do so, we continuously run and share free market researches on how to improve your skills with **Empathy, Integrity, and Economics** in mind. If you want to step up in your career, [access now our latest research for free](https://www.essentialdeveloper.com/courses/career-and-market-strategy-for-professional-ios-developers).

* * *

Originally published at [www.essentialdeveloper.com](https://www.essentialdeveloper.com/articles/composable-code-can-be-simple-intro-to-dependency-diagrams-and-composition).


## Let’s connect
If you enjoyed this article, visit us at [https://essentialdeveloper.com](https://essentialdeveloper.com) and get more in-depth tailored content like this.

Follow us on: [YouTube](https://youtube.com/essentialdeveloper) • [Twitter](https://twitter.com/essentialdevcom) • [Facebook](https://facebook.com/essentialdeveloper) • [GitHub](https://github.com/essentialdevelopercom)