# Eliran Turgeman - Taming the Nested Beast (Highlights) ![rw-book-cover|256](https://eliran-turgeman.github.io/nested-code-and-complexity-images/nested-code-comic.webp) ## Metadata **Review**:: [readwise.io](https://readwise.io/bookreview/28210694) **Source**:: #from/readwise #from/reader **Zettel**:: #zettel/fleeting **Status**:: #x **Authors**:: [[ Eliran Turgeman]] **Full Title**:: Taming the Nested Beast **Category**:: #articles #readwise/articles **Category Icon**:: 📰 **URL**:: [www.16elt.com](https://www.16elt.com/2023/03/24/nested-code-and-complexity/index.html) **Host**:: [[www.16elt.com]] **Highlighted**:: [[2023-05-26]] **Created**:: [[2023-05-28]] ## Highlights - Loss of context: When flattening code, you may end up creating multiple small functions, which can make it harder to follow the flow of logic and understand the context in which these functions are called. This might lead to a situation where developers need to jump between functions to grasp the entire process, which could decrease readability. ([View Highlight](https://read.readwise.io/read/01h1awb2g7tvsx8jmfkp4zp070)) ^536456434 - Reduce nesting by using early returns to exit loops or skip iterations when a condition isn’t met. ([View Highlight](https://read.readwise.io/read/01h1awd53bygj0m063vh4seg0t)) ^536456543 - Divide the deeply nested code into smaller, more digestible functions or components. ([View Highlight](https://read.readwise.io/read/01h1awddndhgrwa8dbytqft65r)) ^536456549 - Sometimes, a simple change in your approach can reduce nesting. For example, try using maps, filters, or reducers instead of nested loops. ([View Highlight](https://read.readwise.io/read/01h1awdsjt45ct6ypv8qhnvkbt)) ^536456579