Namespace Rule of Thumb

前端 未结 5 628
暖寄归人
暖寄归人 2021-01-05 08:29

Is there a general rule of thumb as to how many classes, interfaces etc should go in to a given name space before the items should be further classfied in to a new name spac

5条回答
  •  孤街浪徒
    2021-01-05 09:27

    I have not seen any rule of thumb at any reliable source but there are a few common preferences that I haven seen while working with most developers. There are a few things that help you make the namespaces.

    1. Domain of the class
    2. Is it a class or an interface (I have seen some developers prefer namespaces like ShopApp.Model.Interfaces ). Works really well if your interfaces are some service or data contract.
    3. Dont have namespaces that are too deep, 3 (.) is enough. More than that may get annoying.
    4. Be open to reorganize namespace if at anytime u feel it has become illogical or hard to manage.
    5. Do not create namespaces just for the sake of it.

    Happy Coding!!!

提交回复
热议问题