The ID number or identifier is used to uniquely identify a concrete object within its context. Identification numbers are used, for example, for invoice numbers, serial numbers, to identify database entries, and the like.
Typically, requests are made to a repository or class, which then returns the instance of the corresponding object. Thus, one distinguishes different operations that are performed on the object using the ID number. Operations on objects are also called CRUD operations. CRUD stands for Create, Retrieve, Update, Delete:
- CREATE: Create an object of class X, the ID is then assigned by the repository according to the business rules.
- RETRIEVE: Deliver an instance of the object with the ID.
- UPDATE: Modify the object with the ID, with the supplied attributes.
- DELETE: Delete the object with the ID, the life cycle of the object is finished the ID is invalid afterwards.
An identifier can contain both numeric and alphanumeric characters. When defining identifiers, care should be taken that they are oversized, this excludes the possibility that they will have to be extended later. For each ID number, a pattern or algorithm for creation is also defined, which is applied in the CREATE phase. A simple and often used algorithm in databases is: Use an integer, determine the current highest ID and add it with 1.
An ID belongs to the metadata of an object, since it does not describe the object in terms of content but serves for identification. A related form of the ID is the Unique Identifier( UID). A UID is used to ensure the uniqueness of the object. For example, the name Peter Müller is certainly an ID, but it is certainly not unique. With an ID as Unique Identifier it should be expressed again that this is unique and describes exactly one instance/object.