User Defined Types  «Prev  Next»
Lesson 11

Class Construction Conclusion

This module discussed how to create compound data types from smaller types using classes. You learned that classes are user-defined data types, and that objects are instances of those classes.
In general, there may be zero, one, or more instances of any given class. Classes have attributes, and objects provide particular values for each attribute.
You also learned how to represent classes, objects, and their attributes in Unified Modeling Language (UML)-style diagrams, and how to draw a diagram that represents the relationships among classes.

Composition syntax

You simply create objects of your existing class inside the new class. This is called composition because the new class is composed of objects of existing classes.


This module introduced you to the following terms:
  1. Anonymous object: An anonymous object is essentially a value that has no name. Because the object has no name, there is no way to refer to them beyond the point where they are created. Consequently, they have "expression scope", meaning they are created, evaluated, and destroyed all within a single expression.
  2. Attribute: Components of a class, also known as a field or member variable. Often determined in the design phase by asking the question "what does the class know, track, record, or maintain?"
  3. Boolean: An expression or variable that can have only a true or false value. Java provides a Boolean type and the literal values True and False.
  4. Class diagram:A method of displaying a class and its attributes in a reasonably language-independent fashion.
  5. Composition over inheritance:Composition over inheritance (or composite reuse principle) in object-oriented programming is the principle that classes should achieve polymorphic behavior and code reuse by their composition (by containing instances of other classes that implement the desired functionality) rather than inheritance from a base or parent class
  6. Field: A member variable that can be properites of the class.
  7. Function:
  8. Member variable: In object-oriented programming, a member variable (sometimes called a member field) is a variable that is associated with a specific object, and accessible for all its methods (member functions).
  9. Method
  10. Object diagram: An object diagram shows this relation between the instantiated classes and the defined class, and the relation between these objects in the system.
  11. Primitive: A data type that is not an object.
  12. UML:Unified Modeling Language, an industry-standard modeling language used to diagram the relationship of elements to oneanother, interrelated processes within a project, and code architecture.

The next module will discuss the characteristics of operations and methods in classes and how to diagram them.

UserDefined Data Types - Quiz

Click the Quiz link below to review the concepts introduced in this module.
UserDefined Data Types - Quiz