-
Notifications
You must be signed in to change notification settings - Fork 1
Consider Simplifying Code by Merging Key-Value Pairs into One Class #4
Description
It occurs to me now while looking at the code base that there is a certain amount of unnecessary complexity created by us separating FieldMap.Key from FieldMap.Value and separating MethodMap.Key from MethodMap.Value.
Suppose that we had all of the information that's in both classes of a Key-Value pair in a single object. On this single object we could implement two different notions of similarity:
- strictly similar, whose semantics would be like those we have already implemented for the keys.
- loosely similar, whose semantics would be like those we had intended implemented for the values.
(I'm not set on the names or anything. I'm just using these terms to make the distinction.)
Examples
The following two field declarations would be strictly similar (because they have the same type and identifier) but not loosely similar (because they have different sets of modifiers):
public static int i;
private int i;The following two field declarations would be both strictly similar and loosely similar:
public static int i;
static public int i;Consequences
I think that this could simplify the codebase in a number of ways. Two that I can think of are
- We cut down on the number of types.
- We remove the need to have maps, and we can instead use lists.
Practicality
While I think this change is a good idea, I think we should not try to do it for the assignment. We are far enough along with this strategy that I'd say we should just try to finish and submit this assignment.