Human above all, with pathos, weaknesses and grumpy at times. Speak for myself; think out loud. Direct, seemingly hard faced. Urged to fix things. Am fortunate.
It's About Software Design - IASD
Find it amazing how a single method interface can be the inspiration to a good software design.
Here is the culprit.
The idea is that you can apply a condition to any type and see if it adheres to that.
Notice how the usage of generics elevates the design. Using an Object instead would have made the
code vulnerable to ClassCastException and fragile to piece together with other classes. An
interface instead would force client code to implement it, pose a limit on the conditions you can
apply and is rather stiff.
Then came the Filter allowing you to extract the types that satisfy the conditions of yours.
Then the requirement to apply a list of Conditions.
Without differentiating from the Condition interface thus being able to accomodate for it in the
With implementations providing public methods to specific conditions that make sense on the type
It’s your turn now to DRY the design by introducing a class that encapsulates the implementation
of the methods related to the ConditionChain thus increasing cohesion and lowering coupling
for creating specific conditions without abusing inheritance.
While doing so you get to win a postcard from Edinburgh.