I just dived into the world of using dispatch_queue a little bit more intensively and was wondering if there are some naming conventions that should be used just for GCD objects, so that the code of the classes is then more easily divided into GCD and other Code.
Or could it be that it is a bad idea to have separate naming conventions for GCD?
I just dived into the world of using dispatch_queue a little bit more intensively
Share
I’d suggest to simply stick to the usual Cocoa and CoreFoundation naming conventions. Extend them as needed.
Edit after comments:
First of all, you shouldn’t start variables with an underscore as this is reserved for Apple. Instead, I recommend to postfix with underscore, like
someVariable_or prefix with something else (for example, a colleague of mine usesi_for instance variables andg_for globals).Whether you want to add some kind of polish notation (like prefixing with
q_for queues) is entirely up to you, it’s a matter of taste. I think it’s more important that you can recognize what a variable is used for, likeimageProcessingQueue_instead of justqueue_.The problem is that this is entirely subjective and cannot be answered in an “this is the ultimate truth” way. Common sense and forethought are important and laziness (abbreviated names or very generic terms like simply
queue_) should be avoided.