

True Duplication Vs Accidental Duplication:
Be careful not to take DRY too far and really think about what you're doing.
#codenewbie


2/
True duplication is when a change made to one instance means that the same change must be made to every duplicate of that instance.
True duplication is when a change made to one instance means that the same change must be made to every duplicate of that instance.
3/
Accidental Duplication or False Duplication:
If the duplicated codes will change or eveolve along different paths at different rates or different reasons then they are not true duplicates.
Accidental Duplication or False Duplication:
If the duplicated codes will change or eveolve along different paths at different rates or different reasons then they are not true duplicates.
4/
e.g. You have a two screens that have a similar structure. You might be tempted to share the code for these screens.
Should you share the code? Probably not.
The screens will probably diverge and look very different as time goes by as they change for different reasons!
e.g. You have a two screens that have a similar structure. You might be tempted to share the code for these screens.
Should you share the code? Probably not.
The screens will probably diverge and look very different as time goes by as they change for different reasons!
5/
Before jumping straight to re-using code, stop to think if the use cases will diverge in the future and if you're going to hurt development in the long run.
Before jumping straight to re-using code, stop to think if the use cases will diverge in the future and if you're going to hurt development in the long run.
6/
This is a concept I was aware off but wasn't able to put into words as well as Bob Martin. This is part of his book Clean Architcture
This is a concept I was aware off but wasn't able to put into words as well as Bob Martin. This is part of his book Clean Architcture