I'm the sole developer on a project that, like for any software project, may be taken by somebody else in the future.
Let's say I used the pattern X to implement feature A. After developing and finishing the feature, I realize I could implement the same feature using pattern Y, which I just learned about. But feature A is working nicely, and refactoring from X to Y is time-consuming and gives little benefit.
Then it's time to implement feature B. It's similar to A, but this time I want to take this opportunity to play with pattern Y. I'm happy about the end result, better than when doing feature A, but now my code uses two different patterns, X and Y, for similar features.
But there's no real reason to use different patterns, except for the fact that when building feature A I wasn't skilled enough to use the same pattern as for feature B.
Note that this question is not about choosing the right pattern for a given problem; it's about two patterns co-existing in the code base to solve similar problems, that could be reduced to one given enough time to refactor.
- Is that code smell?
- What are the disadvantages of keeping the source code like this?
- Should I've sticked to using one pattern only? i.e. refactor A to use Y or keep using X when writing B?
- How, in the source, can I communicate that the reason why there are two different patterns for similar features is essentially no reason?
- Am I worrying too much about what the next developer thinks about my code?