When an object references another object in memory a reference counting is initiated for memory management. This is handled for you by ARC, automatic reference counting. Increasing and decreasing on the count of references when one object is referred or the relation is nil and this makes ARC release it from memory (deinit). By doing this references, there are known cases where a reference cycle might occur never calling deinit on both objects, therefore never being released from memory.
Memento Pattern captures the current state of an object and store it in such a way that you can retrieve it at a later time when you would like to return to the previous state.
Strategy Pattern consists of defining different objects that conform to a strategy protocol and can be set or be interchangeable at runtime while being used by an object.
Motivation: While designing a scalable architecture we have to keep so many things in mind. To make this learning process easier (and in a incremental manner) I’ll be summarizing books/courses I start reading and writing from personal experience.
Welcome to the next part of solving ‘Sliding Window’ problems part II! I’ll continue at the same level as the previous post and gradually increase complexity.
The following pattern evaluates slidding windows within an array/string/linked-list.
We keep a sub-window of evaluation and when a condition is met, it ‘slides’ to the right.