Separating Concerns With The Delegate Pattern

Separating Concerns With The Delegate Pattern

5 years ago
Anonymous $L9wC17otzH

https://medium.com/swlh/separating-concerns-with-the-delegate-pattern-93b9d3a65b71

In the previous article, we discussed the syntax of Closures and how they are used inside their receiving functions. Today, we take a look at a technique we can use to enforce separation and extensibility in our application, by making sure that our Views are as decoupled from our Controllers as possible.

The Delegate Pattern was thought of as a possible solution to deal with Separation of Concerns, the idea that any object should deal with its own, distinct problem set. For example, a Rectangle struct should not deal with calculating the area of circles, and so on. This is a pretty obvious example, but the idea of delegates is that one object should use specialized helper objects to get a task done.