I just read the Clean Architecture book of Uncle Bob and I’m attempting to apply it in a training project on dart.
Here’s my dummy app idea : a tracker for your body mensurations (biceps, belly, legs…).
I’m at the very starting point and only defined a single interface entity Mensuration
:
abstract class Mensuration {
abstract DateTime measureDate;
abstract double sizeInCm;
DateTime getMeasureDate();
double getSizeInCm();
double getDifferenceWith(Mensuration otherMeasure);
}
However I’m already struggling : I was thinking of creating many classes implementing this interface (such as RightBicepsMensuration
, ChestMensuration
…), but I would already be breaking the LSP since I’d have to check on the type of otherMeasure
in getDifferenceWith
in all the implementations : I wanna check the evolution of measures of the same kind in time, not to compare between legs and arms.
So should I avoid having an interface ?
I have a few ideas to do otherwise, but I’m not sure of what’s the best thing to do :
- should I get rid of this interface and
- either implement classes right away
- or have a single class for all mensurations with an enum as property for the body part
- should I keep the interface but not to declare the
getDifferenceWith
method in it and only declare it in all the implementing classes with the appropriate type ?
I feel like none of the choices is clean in fine.