There's nothing "standard" in this space I'm aware of, unlike say Sun's old Java conventions. Anything you adopt will be personal/company preference.
That said, I do like prefix conventions:
t_ for table
v_ for view
idx_ for index
tx_ for text field
dt_ for date field
n_ for numeric field
id_ for identify field
nm_ for something that's specifically a name
is_ for booleans, whether 0/1, yes/no or otherwise
fk_ as an optional foreign key identifer; you may prefer to stick with id_ though, to keep the field the same as its primary key counterpart, e.g. id_customer -> id_customer, rather than an fk_customer
Naming conventions comes into play when using frameworks like Ruby on Rails or Zend that subscribe to convention over configuration. Anything that will scaffold forms for you or "auto discover" your database. Looking at these conventions could also help you decide on a naming strategy even if you are not using a framework.
发布评论
评论(2)
据我所知,这个领域没有什么“标准”,与 Sun 的旧 Java 约定不同。您采用的任何内容都将取决于个人/公司的偏好。
也就是说,我确实喜欢前缀约定:
There's nothing "standard" in this space I'm aware of, unlike say Sun's old Java conventions. Anything you adopt will be personal/company preference.
That said, I do like prefix conventions:
当使用 Ruby on Rails 或 Zend 等订阅约定优于配置。任何可以为您构建表单或“自动发现”数据库的东西。即使您不使用框架,查看这些约定也可以帮助您决定命名策略。
Naming conventions comes into play when using frameworks like Ruby on Rails or Zend that subscribe to convention over configuration. Anything that will scaffold forms for you or "auto discover" your database. Looking at these conventions could also help you decide on a naming strategy even if you are not using a framework.