中文网站
  Advanced Search
Read the latest Blogs from IT professionals in the field. Read and write community created documents. Need IT help? Ask our staff. Connect with your peers. Check our Tech Shop for posters, books and software tools. Home

8.2.1 Database Systems: Object Structure

1. The object-oriented paradigm is based on encapsulating code and data into a single unit. Conceptually, all interactions between an object and the rest of the system are via messages. Thus, the interface between an object and the rest of the system is defined by a set of allowed messages.

2. In general, an object has associated with it:

  • A set of variables that contain the data for the object. The value of each variable is itself an object.
  • A set of messages to which the object responds.
  • A set of methods, each of which is a body of code to implement each message; a method returns a value as the response to the message.

3. Motivation of using messages and methods.

All employee objects respond to the annual-salary message but in di erent computations for managers,tellers, etc. By encapsulation within the employee object itself the information about how to compute the annual salary, all employee objects present the same interface.
Since the only external interface presented by an object is the set of messages to which it responds, it is possible to (i) modify the de nition of methods and variables without a ecting the rest of the system, and (ii) replace a variable with the method that computes a value, e.g., age from birth date. The ability to modify the de nition of an object without a ecting the rest of the system is considered to be one of the major advantages of the OO programming paradigm.

4. Methods of an object may be classified as either read-only or update. Message can also be classified as read-only or update. Derived attributes of an entity in the ER model can be expressed as read-only messages.

Database System Structure: