course mod topic first name date completed
cit-130 inheritance computing history
module learning objectives
  • Java.inheritance.1: Generate a class diagram from existing Java code
  • Java.inheritance.1: Analyze existing Java code for weaknesses in its use of the principles of inheritance and describe those weaknesses using proper terminology
early computer modems like the one pictured converted binary data to sound pulses and transmitted them using speaker and microphone on a regular old telephone receivers designed to be held up to a human head. image from The Wikipedia: Rama [CC BY-SA 2.0 fr], via Wikimedia Commons
java master sequence > inheritance non-example

Inheritance hierarchy non-example

Using our CIT-115 class's computer history timeline, we're learning the essentials of Java's inheritance mechanism. Follow these steps and thoughtfully respond to these questions:

STEP 1: Diagram

Using LIANG9: Chapter 11 as your guide, create a class inheritance diagram of the non-example code. Be sure to show class names, member variables, and method headers in each of your classes in the diagram. Create this diagram on separate paper and include in this Hamburger when you're ready for it to be reviewed.

STEP 2: Identify weaknesses

In the space below, generate a list of at least three elements or dimensions of this non-example that demonstrate poor object design and inheritance choices. (There are many more than three weaknesses!) Strive to use formal Java language to describe the weaknesses, please.

STEP 3: Create a better hierarchy

Grab more paper (or a new program file) and carefully design a new class inheritance diagram to encode the data that's currently on the timeline into a Java program. Consider the "is a" relationship versus "is able to (be)" class relationship.

Your class diagram should include the following object design principles:

  1. Superclasses and subclasses (via the extends keyword)
  2. Custom object composition (storing an object of a custom type in a member variable of a different object of a custom type)
  3. Private member variables with public "getter" and "setter" methods to control access to them by other classes
  4. Thoughtfully designed methods that operate on your private member variables
  5. Private method: At least one private method in one of your classes (meaning: a method that is used ONLY by that class's own methods and cannot ever be accessed by another class directly

STEP 4: Analysis

Improving or critiquing a tool is a fantastically productive way to master the essential components in any learning process. In the space below, create a list of at least three concrete ways your class hierarchy and demo code improves on the non-example. Cite line numbers or, better yet, write the most important lines of your response and then digest it.