文件/文件夹命名和Web 应用程序的案例约定/标准

发布于 2024-10-03 10:27:27 字数 523 浏览 6 评论 0原文

我一直在谷歌上搜索有关 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 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(2

半夏半凉 2024-10-10 10:27:27

像 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.

相守太难 2024-10-10 10:27:27

因为这几乎没有区别,所以没有这样的标准。

这是由于 http://www.example.comhttp://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 and http://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.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文