Dale - Computer Science Illuminated 202

Dale - Computer Science Illuminated 202 - card for this...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
6.3 Object-Oriented Design 175 Class Name: SortedList (from library) Superclass: Subclasses: Responsibilities Collaborations Insert (person) Print Person Person What about the list object? Should the list keep the items in alphabetical order or should the list sort the items before printing them? Each language in which we might implement this design has a library of container classes available for use. Let’s use one of these, which keeps the list in alphabetic order. This library class should also print the list. We can create a CRC
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: card for this class, but mark that it most likely will be implemented using a library class. Responsibility Algorithms Person class There are two responsibilities to be decomposed: initialize and print. Because each of the fields of the class is a class, we can just let each initialize and print itself. Print name.Print() address.Print() telephone.Print() email.Print() Initialize name.Initialize() address.Initialize() telephone.Initialize() email.Initialize()...
View Full Document

{[ snackBarMessage ]}

Ask a homework question - tutors are online