文件/文件夹命名和Web 应用程序的案例约定/标准
我一直在谷歌上搜索有关 Web 应用程序中文件夹中的“案例”和文件命名的约定或最佳实践的建议。
大多数时间我在 Visual Studio 中工作,开发 ASP.NET Web 应用程序。过去,我一直对所有文件和文件夹使用 PascalCase,但 Javascript 文件除外,它们往往采用驼峰式命名法。
最近,我想知道所有内容都小写是否更有意义,因此我的网址(包括域名)始终是小写,因此我的网站没有网址,例如:
http://www.mysite.com/Blog/AddPost.aspx
我也不会在其中包含任何混合大小写的网址 然后我想知道,如果我要小写项目中通过我的网站引用的所有文件/文件夹(包括图像
、CSS、脚本等),我是否会尽可能小写任何其他文件夹(例如 App_Code、Controllers、Views、Models)和文件(例如 Globals.asax)在我的项目中以防止在整个项目中混合命名约定?!
我知道这可能不是什么大问题,但我有兴趣知道是否有任何建议或最佳实践?
I've been searching google for recommendations on conventions or best practices when it comes to the 'case' and naming of files on folders within a Web Application.
Most of the time I work within Visual Studio, developing ASP.NET web applications. In the past I've always used PascalCase for all of my files and folders, with the exception of Javascript files which tended to be camelCase.
More recently I was wondering if it made more sense for everything to be lower-case so my Urls including the domain name were always lower case so my sites didn't have Url's like:
http://www.mysite.com/Blog/AddPost.aspx
I'd also then not have any mixed case url's within the page for images, css etc.
Then I wondered, if I was to lowercase ALL the files/folders that were referenced via my site (including images, css, scripts etc) within my project, would I then go as far as to lowercase any of the other folders (e.g. App_Code, Controllers, Views, Models) & files (e.g. Globals.asax), within my project to prevent having a mix of naming conventions within my project as a whole?!
I know this probably isn't exactly a big deal, but I was interested to know if there were any recommendations or best practices out there?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
像 App_Code 这样的文件夹是系统文件夹,因此您无需管它们。我通常将 ASPX 页面设为 pascal 大小写,因为它反映了类命名的约定。至于图像和脚本文件夹,我真的认为这是个人品味或内部惯例的问题。
Folders like App_Code are system folders so you leave them alone. I usually make my ASPX pages pascal case because it mirrors the convention of class naming. As for images and script folders, I really think that this is a matter of personal taste, or in-house convention.
因为这几乎没有区别,所以没有这样的标准。
这是由于
http://www.example.com
和http://WWW.EXAMPLE.COM
等域解析为同一事物。您应该使用任何让您高兴的约定,如果在团队中工作,则应使用团队同意的约定。
Because this makes little to no difference, there are no such standards.
This is due to domains like
http://www.example.com
andhttp://WWW.EXAMPLE.COM
resolve to the same thing.You should use whatever convention that makes you happy, and if working in a team, one that the team agrees on.