Object Identity, Complex Objects, and Persistent Programming

Classified in Computers

Written at on English with a size of 2.77 KB.

Object Identity Types

There are three main types of object identity:

  • Asset (Data Value as Identity): This form of identity, commonly used in relational systems, utilizes a data value as the identifier. For instance, the primary key value in a tuple uniquely identifies that tuple.
  • Name (User-Defined Identity): This type of identity relies on a name assigned by the user. File systems often employ this approach, where each file has a unique name regardless of its content.
  • Incorporated (System-Generated Identity): This concept integrates identity directly into the data model or programming language, eliminating the need for user-provided identifiers. Object-oriented systems commonly use this method, automatically assigning a unique identifier to each object upon creation.

Complex Objects Explained

Complex objects are constructed from simpler objects by applying constructors to them. For example, consider a scenario where Susan and Peter are parents of the same child, John. This could be represented as:

  • Peter: (Peter, 40, ((John, 15, {})))
  • Susan: (Susan, 41, ((John, 15, {})))

Characteristics of Persistent Programming Languages

Database languages differ from traditional programming languages in their direct interaction with persistent data. Persistent data continues to exist even after the program that created it has terminated. Database relations and tuples are examples of persistent data. In contrast, traditional programming languages primarily work with non-persistent data, except for files.

Database access is just one part of real-world applications. While data processing languages like SQL are effective for data access, a programming language is necessary to implement other application components, such as user interfaces or communication with other computers. The traditional approach to interfacing databases with programming languages involves embedding SQL within the programming language.

Persistent Programming vs. Embedded SQL

Persistent programming languages differ from languages with embedded SQL in at least two key ways:

  1. Type Systems: In embedded languages, the host language's type system often differs from the data processing language's type system. Developers are responsible for managing type conversions between the host language and SQL.
  2. Data Handling: Programmers using embedded query languages must write explicit code to fetch data from the database into memory and to write updated data back to the database. In contrast, persistent programming languages allow programmers to work with persistent data without explicitly coding for data retrieval or storage.

Entradas relacionadas: