OOD: All classes at bottom of hierarchy contain the same field
- by My Head Hurts
I am creating a class diagram for what I thought was a fairly simple problem. However, when I get to the bottom of the hierarchy, all of the classes only contain one field and it is the same one.
This to me looks very wrong, but this field does not belong in any of the parent classes. I was wondering if there are any suggested design patterns in a situation like this?
A simplified version of the class diagram can be found below.
Note, fields named differently cannot belong to any other class
+------------------+
| ObjectA |
|------------------|
| String one |
| String two |
| |
+---------+--------+
|
+---------------+----------------+
| |
+--------|--------+ +--------|--------+
| ObjectAA | | ObjectAB |
|-----------------| |-----------------|
| String three | | String four |
| | | |
+--------+--------+ +--------+--------+
| |
| |
+--------|--------+ +--------|--------+
| ObjectAAA | | ObjectABA |
|-----------------| |-----------------|
| String five | | String five |
| | | |
+-----------------+ +-----------------+
ASCII tables drawn using http://www.asciiflow.com/