Paul Clapham wrote: A Java class should have a description of what its instances represent, and it should preferably include comments which explain that.
Norm Radder wrote:
Paul Clapham wrote: A Java class should have a description of what its instances represent, and it should preferably include comments which explain that.
That is the first time I have seen anyone on this forum say anything positive about commenting a program.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Unfortunately, it says to record the milliseconds since 1st January 1970. That means the class has two mutually incompatible purposes, one being to record hours minutes seconds and the other to record milliseconds alone. I see Paul has already said that. We cannot blame OP for that, but whoever set the exercise. In order to record milliseconds, you would need a milliseconds fieldCarey Brown wrote:. . . Millis is probably used in the internals of some methods but should not be a member variable. . . .
Campbell Ritchie wrote:
Unfortunately, it says to record the milliseconds since 1st January 1970. That means the class has two mutually incompatible purposes, one being to record hours minutes seconds and the other to record milliseconds alone. I see Paul has already said that. We cannot blame OP for that, but whoever set the exercise. In order to record milliseconds, you would need a milliseconds fieldCarey Brown wrote:. . . Millis is probably used in the internals of some methods but should not be a member variable. . . .
Campbell Ritchie wrote:Another thing: I would remove that static method. It looks good, but it cannot do anything to your obkects, and I think it should be moved into a different class. It doesn't constitute any part of Time, but it does seem to constitute a way to test a Time object, which is different.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
What's wrong with that? It would make it too complicated to include time zones, and what we have here is a very simplified version of LocalTime. Only, as you will have seen from the Java™ Tutorials link, LocalTime is immutable and doesn't have any setXXX() methods.Tim Holloway wrote:. . . This class is designed to hold a time of no definite reference. . . .
Campbell Ritchie wrote:
What's wrong with that? It would make it too complicated to include time zones, and what we have here is a very simplified version of LocalTime. Only, as you will have seen from the Java™ Tutorials link, LocalTime is immutable and doesn't have any setXXX() methods.Tim Holloway wrote:. . . This class is designed to hold a time of no definite reference. . . .
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Yes, that is what Paul meant about apples and oranges.Tim Holloway wrote:. . . part . . . carried more information than expected.
Campbell Ritchie wrote:
Yes, that is what Paul meant about apples and oranges.Tim Holloway wrote:. . . part . . . carried more information than expected.
Education won't help those who are proudly and willfully ignorant. They'll literally rather die before changing.
Sorry for my mistake. No wonder MS told me off earlier.Tim Holloway wrote:. . . Actually, that waas me. . . .
This guy is skipping without a rope. At least, that's what this tiny ad said:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
|