Naming conventions

Database

  • Use US English for naming identifiers
  • Keep names as short as possible, single words are preferred
  • Use singular tense
  • Use a noun or noun phrases, avoid the use of prepositions (at, by, for, in etc.) in names
  • Use PascalCase (LS: camelCase)
  • Avoid using the entity name as a qualifier (DAF: except for identifiers)
  • The identifier of an entity is usually the attribute “code”, “number” or “ID”, qualified with the name of the entity, where “code” is used for alphanumeric characters only, “number” is used for numeric characters only and “ID” is used for mixed alphanumeric and numeric charaters.
  • Foreign key names: Name consists of four parts. The preposition (fk), the parent (foreign) table, the child table and the column name of the referencing columns of the child table.

Example: fkDepartment_Employee_DepartmentID - foreign key in the Employee table, having the DepartmentID in the Employee table referring to the department table.

Java Method Naming Conventions

http://www.cwu.edu/~gellenbe/javastyle/method.html

Messages

Entity correctly saved: <name of entity> inserted/updated/deleted.
Error saving entity: Error inserting/updating/deleting <name of entity>.
Entity not filled in: <name of entity> required.
Entity not in the correct format: Wrong format <name of entity>.

Dutch error messages

Error in BL: Fout bij het aanmaken/aanpassen/verwijderen van de order. Meer informatie vindt u in het logbestand.
Misschien is deze order door iemand anders aangepast?
Error in GUI: Onverwachte fout bij het verwerken van de order. Meer informatie vindt u in het logbestand.

Logging

Logging in / starting
Program <xx> started with version <yy>.
User <xx> logging in.
Window / screen
Form/page <xx> opened.
Form <xx> closed.
Processes (optional)
Process <xx> started with parameters <parameters>.
Process <xx> ended.

Pressing a button
Button <xx> clicked.
string.Format("Button <{0} ({1})> clicked.", ((Button)sender).ID, ((Button)sender).Text)

Selected index changing
Selected index <gridview> changed.
string.Format("Selected index <{0}> changed.", ((GridView)sender).ID)
PageIndexChanging
Should be no logging, only for selected index changed.
RowCommand
Command <Select> selected in <gvCustomers>.
string.Format("Command <{0}> selected in <{1}>.", e.CommandName, ((GridView)sender).ID)

Database actions
<name of entity> with id <xx> inserted/updated/deleted.
Error inserting/updating/deleting <name of entity> with id <xx>.

Classes

Helper: Static class (not containing instances), with help functions
Controller: — reserve for MVC
Handler: Non static class, containing an instance of the object
Provider: Non static class, containing instances, typically providing things (not handling things).
Eg. a InvoiceProvider will provide invoices, a InvoiceHandler will handle invoices.

Buttons

New / Insert (btnNew) - Item inserted / Error inserting item
Edit / Update (btnEdit) - Item updated / Error updating item
Remove / Delete (btnRemove) - Item deleted / Error deleting item
Cancel (btnCancel)
When the button New is clicked, the button Edit is disabled. The text on the button changes to Insert.

private void btnNew_Click(object sender, EventArgs e)
{
  if (btnNew.Text == "New")
  {
    ClearFields();
    SetFieldsReadOnly(false);
    btnNew.Text = "Insert";
    btnEdit.Enabled = false;
  }
  else
  {
    btnNew.Text = "New";
    btnEdit.Enabled = false;
    SetFieldsReadOnly(true);
  }
}

private void btnEdit_Click(object sender, EventArgs e)
{
  if (btnEdit.Text == "Edit")
  {
    SetFieldsReadOnly(false);
    btnEdit.Text = "Update";
    btnNew.Enabled = false;
  }
  else
  {
    btnEdit.Text = "Edit";
    btnNew.Enabled = true;
    SetFieldsReadOnly(true);
  }
}

private void btnCancel_Click(object sender, EventArgs e)
{
  btnNew.Enabled = true;
  btnNew.Text = "New";
  btnEdit.Enabled = true;
  btnEdit.Text = "Edit";
  SetFieldsReadOnly(true);
}

private void SetFieldsReadOnly(bool value)
{
  txtxxx.ReadOnly = value;
  if (value)
  {
    txtLineTypeID.BackColor = Color.FromArgb(224,224,224);
  }
  else
  {
    txtLineTypeID.BackColor = Color.White;
  }
}

private void ClearFields()
{
  txtxxx.Text = string.Empty;
}

ISO codes

ISO 3166 Country codes
ISO 3 codes
ISO 639 Language codes

Unless otherwise stated, the content of this page is licensed under Creative Commons Attribution-ShareAlike 3.0 License