Typescript style guide for interfaces

前端 未结 4 662
臣服心动
臣服心动 2020-12-30 11:02

this is a question that may not have a single correct answer, as I do realise coding styles are quite varied, especially between different languages, eg camel case function

4条回答
  •  再見小時候
    2020-12-30 11:22

    Two more reasons

    Modularization As the code base grows, the code starts to be modularized. The usual design goal with modules is to expose contracts and hides the internals. Contracts are best expressed by interfaces and after a while most if not all exposed artifacts are interfaces and factories. For consumers of these modules it is nicer to work with Userss and Credentials rather than IUsers and ICredentials

    Alphabetic order For instance quick access to Interfaces and Classes in lists sorted in alphabetic order in a File navigator. When working with Users, it is best to have User, UserService and UserImpl next to each other in the list, rather than having to go though the I entries, then the C entries then the Service entries

提交回复
热议问题