我有一个方法用块(比如说数据库事务)执行一些操作,有4个不同的条件(2个布尔参数)。在包括Apple的许多约定中,块参数应该是最后一个但我们不应该首先放置bool参数。 您认为我应该如何命名这种方法?
- (void)performDatabaseTransactionWithSynchronously:(BOOL)synchronously
isWritterOperation:(BOOL)isWritter
transaction:(TransactionBlock)block
或
- (void)performDatabaseTransactionWithSynchronously:(BOOL)synchronously
isWritterOperation:(BOOL)isWritter
withTransaction:(TransactionBlock)block
或
- (void)performDatabaseTransaction:(TransactionBlock)block
synchronously:(BOOL)synchronously
isWritterOperation:(BOOL)isWritter
还是其他人?
答案 0 :(得分:1)
我的版本是:
- (void)performDatabaseTransactionSynchronously:(BOOL)synchronously
isWriterOperation:(BOOL)isWriter
withBlock:(TransactionBlock)block
答案 1 :(得分:1)
现在我用了
- (BOOL)performDatabaseTransactionWithDeffered:(BOOL)useDeferred
isWriterOperation:(BOOL)isWritter
error:(NSError * __autoreleasing *)error
usingBlock:(TransactionBlock)block
和
- (void)performDatabaseTransactionAsynchronouslyWithDeffered:(BOOL)useDeferred
isWriterOperation:(BOOL)isWriter
transaction:(TransactionBlock)block
completion:(CompletionBlock)completion
还有其他答案吗?