Three things I like to separate: 1


Three things I like to separate:

1. Retrieving data
2. Transforming / formatting data
3. Displaying data

Often, when I’m dealing with code that’s confusing or hard to test, it’s because one or more of these steps are intermingled.
Benefits of separating retrieval, transformation, and display:

✅ Easier to debug
✅ Easier to understand each step because the function's name document's the developer's intent
✅ Each step is testable in isolation

View original on X