For example: I have to use the date class in my project, but i need for example easy methods to add minutes to a Date etc. Should I:
public static Date addToDate(Date date, int timeToAdd)
public Date add(int duration)
As i was looking into this issue i got interested into what the better approach might be in general, especially concerning classes from the standard library.
I would go for the first approach. One of the things I hate of some OOP degenerations, is that sometimes useless classes proliferate – often it’s a perfectionist whim that brings to an escalation of bizarre classes where there are two methods and nothing really significant, and this brings to a bunch of useless code.
Just make a
DateUtilsclass, and always check the Java Runtime doesn’t already provide something similar.