类成员组织 [英] Class member organization
问题描述
对类成员进行排序的最佳方法是什么?
我和一个团队成员发生冲突。他建议我们应该按字母顺序排列成员。
你觉得怎么样?
div class =h2_lin>解决方案我喜欢语义。按字母顺序排列似乎并没有对我有很大的意义,因为当你在寻找一个成员,你很少知道它是什么叫什么。此外,如果您使用任何类型的命名约定(例如:匈牙利语),按字母顺序将导致按类型分组,这可能不是您想要的。
What is the best way to sort class members?
I'm in conflict with a team member about this. He suggests that we should sort the members alphabetically. I think it's better to organize in a semantic manner: important attributes first, related methods together, etc.
What do you think?
I like semantic. Alphabetical doesn't seem to make a lot of sense to me, cause when you're looking for a member, you rarely know exactly what it's called. Also, if you're using any sort of naming convention (eg: Hungarian), alphabetical is going to lead to grouping by type, which may not be what you want.
这篇关于类成员组织的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!