Activity 15: Design Workshop
Learning Objectives
After this activity, students should be able to:
- Explain when to use an abstract class and when to use an interface
- Design a hierarchy of classes in correct UML syntax based on a text description
- List several concerns in designing systems with names
Background
One common problem in software engineering is to develop a model of a person or an entry of a person in a database. The programmer must decide how to represent the name of a person in the system. There are many ways to represent a name, but the typical first draft version in this country is to have a name attribute in a concrete class, represented as a String. As an example, Activity 10: Inheritance models a person with a single String name and a birthdate.
Names are much more complicated, however. While in the United States, the tradition is to have three names, first, middle and last, where the last name is usually a family name, this is not the case in some other countries and is not always the case even if someone is born and raised in the United States. People change their names, add to their names, have non-alphabetic characters in their names, go by their middle names and even have single word names.
As an example of a name from a Hispanic culture, read the section “Wait! Two Last Names?” in the About tab of the website of Dr. Manuel A. Pérez-Quiñones. Then read this article, Falsehoods Programmers Believe About Names.
Object Oriented Design
Now that you have a basic idea about how complex names can be, design classes to represent names using UML that takes advantage of what you now know about abstract classes, interfaces, inheritance and polymorphism. Your design should meet the specification below and will be evaluated according to the following criteria:
- Design supports required functionality.
- UML is visually organized and neatly drawn
- UML has correct syntax.
- Appropriate names for program components
- Names are meaningful.
- Method names are verbs and instance variables and classes are nouns.
- Plural nouns are only used for collections.
- Appropriate use of inheritance
- Superclasses are used to prevent code duplication.
- Subclasses meaningfully extend the functionality of superclasses
- Instance variables are not shadowed in subclasses
- Classes and methods are abstract where appropriate
- Appropriate use of polymorphism
Specification
The JMU Computer Science department is designing an application to represent all individuals (students, faculty, and staff) within the department. CS159 has been tasked with developing the portion of this application that handles names. The design should be flexible and extensible. Specifically, it should support names from a wide range of cultures and backgrounds from the outset, while also allowing new functionality to be added in the future when previously unanticipated naming conventions arise.
At a minimum, the design must support multiple names, including those with spaces and any Unicode characters. Most people have a preferred name and may have used different names throughout their lives. It is also important that individuals have control over how they are identified, while still ensuring that each person can be uniquely identified across all of their names. The design should also support printing names for use in email lists and determining whether two different names refer to the same individual.
Remember to focus on the name rather than the whole person in this assignment.