Replace Type Code with Class

A class has a numeric type code that does not affect its behavior.

Replace the number with a new class.

image/svg+xml Person O: intA: intB: intAB: intbloodgroup: int Blood Group O: BloodGroupA: BloodGroupB: BloodGroupAB: BloodGroup Person 1

Corrections

Privitizing the accessors for the type code

At the end of the refactoring I said that you could make those methods that use the type code, eg getCode(), private. Randy Coulman pointed out that I neglected to say that you first have to find the callers of those methods and change them to no longer use the code number.