ios - 在命名类、函数和变量时使用冠词 (the/a/an) (Swift)
问题描述
英语不是我的母语,我有一个关于 Swift 命名的问题。命名任何对象或函数时是否需要使用冠词(the/a/an)?例子:
func saveObject() or saveAnObject() or saveTheObject()
最佳做法是什么?
解决方案
The first way, saveObject()
, is the best practice. The other names are unnecessarily long.
推荐阅读
- c# - 如何将 2 个字符串组合成 1 个字符串并删除重复的字符串模式?C#
- linux - 将标准输出两次传递给同一命令
- c# - 修复迁移时的外键设计错误
- azure - Powershell 错误 Remove-AzureStorageBlob Method not found: 'Void
- python - Python:for-loop + break 与 while + flag 性能
- django - Django Oscar 用户验证电子邮件
- xamarin.forms - UWP 构建并“打开”但在使用 Xamarin Form 和 MvvmCross 时不会加载
- r - 从 stan 分布线性模型中提取 sigma 的值并将其添加到数据框中
- php - 获取模型 Post Laravel 的帖子数
- javascript - MongoDB 从可调整的外部集合中聚合