Objects and Classes - Assigning Value - Instance Specification

8 important questions on Objects and Classes - Assigning Value - Instance Specification

Objects are on a lower level of abstraction than ...?

objects are on a lower level of abstraction than classes.

Now, we’ll emphasize the notation, capability, and features of an object/instance specification.
Report

Let us first distinguish between objects, instances, and instances specifications.

What is an "Object"  and what is an "Instance" ?

An “object” is either an element of the real world (M1) or an element of the code/implementation (M0).


An “instance” is the same thing, with an emphasis on the fact that there is a class or a type (a classifier) involved, i.e., an “instance” of a class
Report

What is the difference between a class and an Instance Specification?

You may think that an Instance Specification is similar to a class.

A class designates a set of instances, while an Instance Specification identifies one of a potentially smaller set.
Report

What is not optional in an Instance Specification?

All the fields, except for the “:” are optional.

If you don’t indicate a class, the instance specification is indicating that the class isn’t important – and an instance of any class will do.


If you don’t indicate the name, then the name of the instance isn’t important. The name compartment can also display any relevant stereotypes.
Report

What are the slots in the name compartment?

These represent attributes from the class with optional literal values that are the values for these attributes at the current time.

The literal value must be compatible with the types of the attributes.

Often the attribute types are repeated after the slot name, as shown below.

title: String = “Tom Sawyer”
Report

An additional .... compartment can be added

There are  no ...... Or .....  compartments.

An additional constraints compartment can be added to capture any constraints on this instance.

There are no operations or signals compartments.


The elements that would be in these compartments would be captured in the class definition and do not need to be repeated.


Similarly, in the slots compartment, don’t repeat slots unless you really care about their values in this circumstance.
Report

You should distinguish between the ..... name and the ....of any particular attribute.

You should distinguish between the instance name and the value of any particular attribute.


For example:

we could have changed the class definition to have a name:String attribute and correspondingly change the title slot to be a name slot.

In such a case, the name of the instance would
still be “myBook” and the name attribute of the instance would be “Tom Sawyer.”
Report

What is the dashed arrow?

The dashed arrow we use to connect the two elements, in Figs. 6.15 and 6.16 is an optional dependency arrow indicating that the instances depend on their class or type definitions.
Report

The question on the page originate from the summary of the following study material:

  • A unique study and practice tool
  • Never study anything twice again
  • Get the grades you hope for
  • 100% sure, 100% understanding
Remember faster, study better. Scientifically proven.
Trustpilot Logo
  • Higher grades + faster learning
  • Never study anything twice
  • 100% sure, 100% understanding
Discover Study Smart