随着 Delphi XE2 的出现,类似Xml.Internal.AdomCore_4_3
或 的范围单元System.StrUtils
开始流行。
我喜欢使用此类描述性名称的能力,但我对命名约定和首选目录结构是什么感到困惑。
应该是
com.company.project.Security.Compression.ZLib.pas
就像在Java中一样
System.Security.Compression.ZLib.pas
就像在 .NET 中一样
或者是其他东西?
我应该将文件放在这样的目录结构中吗
System\Security\Compression\System.Security.Compression.ZLib.pas
或者只是System.Security.Compression.ZLib.pas
在根文件夹中?
看看 Embarcadero 组织其单元的方式,我留下的印象是他们只是保留了 Delphi 5/6/7/.../XE 中的目录结构
请指教。
考虑 Foo ID 的类:
class Fid
Run Code Online (Sandbox Code Playgroud)
这不是一个好名字,因为它掩盖了含义。
class FID
Run Code Online (Sandbox Code Playgroud)
这更好,因为它意味着 Foo ID。
Ruby 中的大多数类都是 CamelCase,那么使用全部大写是一种不好的做法吗?
JSON 类呢?
我知道如何在 Java 中命名 HashMap?,但是构建和分配键的函数的最佳名称是什么?返回的函数Map<State, County> countiesByState
可以命名为
sortToState(myCounties)
mapByState(myCounties)
getCountiesByStateMap(myCounties)
getCountiesByState(myCounties)
getMapByState(myCounties)
Run Code Online (Sandbox Code Playgroud) 应该在将要异步执行的方法名称中添加一个 Async 前缀。与在 MS EF Core 中一样,所有运行 async 的方法都有 async 前缀。但它们也有同步方法,没有同步前缀。
在某些方法设计为并行运行的情况下有什么建议。
寻求建议。
我见过在 python 变量中使用下划线字符。解释器是否在存在下划线的情况下以不同的方式解释变量,_
还是纯粹是约定问题?如果是约定,是否有关于python变量命名约定的标准文档?
我正在使用 python 3.8.5
什么是写的正式方法:Xcode
,XCode
,xcode
,...?我已经看到它写了很多方法,并希望确保我正确使用它.
(这可能是提出问题的错误地方,请告诉我).
我应该说出我的方法isStaticallyImported
还是isStaticlyImported
?(我相信它们的发音方式大致相同)
有没有办法Oracle DB
用小写字母命名我的表格,列?
我搜索了很多,一些建议说我应该在创建中使用双引号,如下所示:
CREATE TABLE "test" (a number);
Run Code Online (Sandbox Code Playgroud)
这里的问题是:
它迫使我double quotes
通过查询来装饰我的所有桌子!
如果我写:
SELECT * FROM test ;
Run Code Online (Sandbox Code Playgroud)
我会得到语法错误.
我想将我的所有表,字段命名为小写,因为我将在我的模型中使用这个ORM
(实体框架)使用(Pluralization and Singularization
)功能,所以如果我有这样的表:
CITY
根据Oracle惯例.
等效的将是CITY
实体和复数,因为导航属性将是CITies
!!
编写一个程序来解释文本文件中的一行.
想知道我是否应该将方法'parseWordData'中的局部变量命名scannedWord
为oppposed word
,因为word
它已经是一个类字段.
只要我宣布一个新变量而不是重新分配旧变量,一切都应该没问题......对吗?
public class WordData {
private String word;
private int index;
private LinkedList<Integer> list;
private boolean pathFound;
public WordData(String word, int index, LinkedList<Integer> list, boolean pathFound) {
this.word = word;
this.index = index;
this.list = list;
this.pathFound = pathFound;
}
public WordData parseWordData(String line){
Scanner scan = new Scanner(line);
int index = scan.nextInt();
String word = scan.next();
//precond and subGoal
LinkedList<Integer> list = new LinkedList<Integer>();
while(scan.hasNextInt()){
//add to LinkedList
}
return new …
Run Code Online (Sandbox Code Playgroud) 我想知道哪个更适合作为函数名称:
我一直用CN_作为常量的前缀,如下所示,但我现在正在编写接受标准的编码,我发现这个标准链接在这个网站上.标准说我应该删除CN_为我的常量.因此,通过下面的示例,如果我将CN_NetPrice更改为NetPrice,我将与同名的method属性发生冲突.显然我不能这样做所以我留下了一个问题.我是否有命名约定问题,或者我的代码一般有问题吗?
public class TicketInformation
{
private const string CN_StartDate = "StartDate";
private const string CN_EndDate = "EndDate";
private const string CN_NetPrice = "NetPrice";
private const string CN_NetTotalPrice = "NetTotalPrice";
private const string CN_Tickets = "Tickets";
public decimal NetPrice { get; set; }
public decimal NetTotalPrice { get; set; }
public decimal Tickets { get; set; }
public static TicketInformation Create(DateTime startDate, DateTime endDate)
{
try
{
TicketInformation ti = new TicketInformation();
using (DataTable dt = DAC.ExecuteDataTable(
"GetAllTicketInformationSelect",
DAC.Parameter(CN_StartDate, startDate),
DAC.Parameter(CN_EndDate, …
Run Code Online (Sandbox Code Playgroud) MySQL不会让我创建一个只有数字的数据库名称.它只在我添加字母时才有效.
如何在MySQL中创建仅使用数字的数据库名称?
CREATE DATABASE 2752054;
如何正确初始化var
类型的类?我经常看到这个版本:
var converter = new Converter();
Run Code Online (Sandbox Code Playgroud)
类的实例应该用PascalCase编写,对吧?为什么它不同var
?