0 Comments

Description

Assignment:
Relations: Links Versus Subclasses

The basis of object-oriented design and programming is the
class. The power of this approach comes from class relations or
associations. These are ways in which classes can interact with one
another. The two most important relations are inheritance and links.

Inheritance means that one class is a subset of another class.
For example, the program developed in the Benchmarks could have the
Employee class be a A child-class, often called a sub-class, is a class that inherits properties and methods directly from another class. The class it inherits from is called the parent-class. Each child-class can have only one parent-class; however, that parent-class can be the child-class of another class creating a tree class hierarchy. This structure supports modularized design and programming. As an example, a dog class might be the child of an animal class. That would give any dog object created all the characteristics of an animal as well without needing to reprogram those characteristics.

Search Terms: object-oriented child-class, object-oriented parent-class, object-oriented sub-class, object-oriented inheritance 

“>child-class of a Person class. A child-class inherits directly from the A parent-class is a class that contributes properties and methods to another class or classes. Although child-classes can have only one parent-class, parent-classes can have many children. The parent-class provides a superset for properties and methods common to all of the child-classes so that these need to be programmed only once rather than over and over for each child-class. This hierarchy of classes supports efficient, modularized programming and design. As an example, a animal class might be the parent for dog, cat, and bear classes. That would give any dog, cat or bear object created all the characteristics of an animal as well as those specific to the dog, cat, or bear class.

Search Terms: object-oriented child-class, object-oriented parent-class, object-oriented sub-class, object-oriented inheritance

“>parent-class.
A subclass structure is one in which a class will inherit from every
class above it in the hierarchy. The Person class might store name,
birthdate, address, and other similar information. The Employee class
would inherit all of that information as well as any methods and would
also add information and methods of its own like pay rate. This would
facilitate creating another child-class of Person called Customer that
would also inherit everything from Person but would be distinct from
Employee. The Discussion prompt described the possibility of making
PaidEmployee and Intern subclasses of Employee. Inheritance is shown in a
A class diagram is a diagram that shows the relationships between different classes in a system. For each class, the name, attributes, and methods are listed. In the diagram, inheritance relationships are shown with connecting arrows, and links are shown as lines. Additionally, the diagram distinguishes different types of links and their multiplicity. A class diagram is designed using unified modeling language (UML) and helps to support system design, analysis, and development.

Search Terms: class diagram, UML

“>class diagram with an open arrow pointing from the child-class to the parent-class.

Links mean that one class can pull information or methods from
another class or that another relationship exists. As an example, a
Payroll class might need to call the calculate_pay method for the
PaidEmployee class. As another example, there might be a separate
Department class, and the Employee class would have a “works in”
relationship with the Department class. Links are shown as either a
single line or as a line with diamonds on one or both ends. The form and
labeling of links helps to tell about the relationship between the
classes. You will utilize these forms in later systems courses, but for
now, just placing a line in the diagram with a brief description
describing the link is fine.

Our example results in the following class diagram. This
diagram was created in Visio, which is one of several tools useful for
creating Unified modeling language (UML) is utilized to model systems and programs. Its specifications are given by the Object Management Group (OMG). UML includes specifications for class diagrams as well as other tools like component diagrams, activity diagrams, use case diagrams, communication diagrams, and sequence diagrams. These are essential for system design and system programming.

Search Terms: UML 

“>UML diagrams. Note
that not all aspects of this class UML diagram are completed. In some
cases, not all class information is included. This shows examples of
inheritance and linking but does not show the full system which will
have far greater complexity.

  • Using one of the information systems examples explored in
    previous weeks or another example of your own choosing, describe an
    inheritance relation between two classes and show this with a class and
    subclass in a diagram.
  • Using one of the information systems examples explored in
    previous weeks or another example of your own choosing, describe a link
    relation between two classes and show this with a class diagram link. It
    is not necessary to utilize the same system as for inheritance.

For these diagrams, you may keep them simple. You will not be graded on Multiplicity defines how many objects of one class can be linked to an object of another class when the two classes share a link. As an example, a course class might link many student classes but only one teacher class. Multiplicity is direction specific; so, a teacher may teach many courses and a course may have 1 teacher would each be specified. Multiplicity is generally identified as 0 meaning that no link is made in the direction, as 1 meaning only one object may be linked to another, or as many meaning any number of objects may be linked.

Search Terms: multiplicity, class diagram

“>multiplicity, When defining a class or a variable in a program, you may identify it as Dim, Private, Public, or Global. Dim and Private both mean that only that specific class is able to access the information or method. Private is generally used for methods, and Dim is generally used for variable. Public means that other classes have access to the information or method.

Search Terms: variable specification, public private dim, public private

“>public/When defining a class or a variable in a program, you may identify it as Dim, Private, Public, or Global. Dim and Private both mean that only that specific class is able to access the information or method. Private is generally used for methods, and Dim is generally used for variable. Public means that other classes have access to the information or method.

Search Terms: variable specification, public private dim, public private

“>private
designations, or distinctions among associations, aggregations, and
composition. All you need to do for each is show two class diagrams and
describe the relationship. You will cover other aspects when you study
system analysis and system design.

Place both diagrams and the accompanying descriptions in a single document file with a cover sheet.

Order Solution Now

Categories: