开发者

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

开发者 https://www.devze.com 2023-03-15 14:04 出处:网络
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 inobjective-c (iOS4+). Should

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

精彩评论

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

关注公众号