3 ms·
After a long time experimenting with a lot of patterns, i found the "operationqueue & operation" building blocks from objective-c the most versatile and powerfu
by bsaul 4y ago
After a long time experimenting with a lot of patterns, i found the "operationqueue & operation" building blocks from objective-c the most versatile and powerful construct. They let you do all those things the other alternatives i've tried often fall short :
- you can cancel them
- you can pass a pointer to the operation from places to places
- you can set dependencies between operations so that one doesn't start until another is finished
- you can set its execution priority (on the queue)
Syntax may not be the best, and there may be a few problems with encapsulation (an operation can do any kind of memory manipulation), yet i keep getting back to them whenever i have to do serious and robust work.