开发者

How do I compartmentalize classes in objective-c w/o namespaces?

Having worked w/ languages that utilized namespaces for the past 10 years I am trying to figure out the best approach to project structure and class开发者_JAVA技巧 names in objective-c (iOS4+). Should you simply give all your classes, view controllers, etc. unique names? It seems archaic there is not a way to encapsulate groups of functionality with something like namespaces, especially if you build libraries and have a large development team.

Is there functionality equivalent to namespaces that I am missing? If not, what is a good approach to this problem?

Thanks


Should you simply give all your classes, view controllers, etc. unique names?

Yes.


The standard approach is to prefix class names with a short code. For instance, traditional Cocoa uses NS (from NextStep), while Cocoa Touch uses UI (for user interface, I guess).

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜