Closed romach closed 3 years ago
@vaa25 , @alex-anakin review me, please
@romach There are some new Date()
in OneTimePassword, MyBatisEventService, MyBatisUserService
@AndriyBaibak 30 min
@vaa25 done
@romach
CustomDateTime.getDate()
is very similar to RealClock.getNowLocalDateTime()
. Can you explain the difference or neccessary of CustomDateTime.getDate()
existing?CustomDateTime.getLocalDateTime()
is never used.CustomDateTime
will implement.RealClock
can be final.RealClock.getNowLocalDateTime()
is redundant because method purpose is obvious.CustomDateTime
is over engineered or badly designed.
For example, how used one of it' methods:
Date yesterdayDate = new CustomDateTime() .withLocalDateTime(clock.getNowLocalDateTime().minusDays(1)).getDate();
Inside withLocalDateTime
method there is another new CustomDateTime(...)
. Why so complicated?@AndriyBaibak time tracking: 30 minutes spent
@alex-anakin
CustomDateTime
is used in RealClock
and FrozenClock
to reduce code duplication;1.
;DateTime
interface added;RealClock
and FrozenClock
classes was made final;RealClock.getNowLocalDateTime
is deleted;CustomDateTime
class immutable. So, I can't use setters to change object's state;@romach
Concerning class CustomDateTime
.
CustomDateTime
breaks the single responsibility principle. It is responsible for getting date values and for creating new instances of the class. Perhaps you should create another class and implement the factory method pattern. Or try find your own way.
@AndriyBaibak time tracking: 20 minutes spent
testing new labels
@romach after merging master to this branch, please check TODO in MyBatisUserService
connect to #172