On Thu, Oct 1, 2009 at 2:29 AM, Sean Owen <[email protected]> wrote: > This doesn't make sense when the args are ints: > Math.floor(numTrees / numMaps) > The result is already an int, rounded 'down' >
Since other languages have incoherent rounding rules for this division, this idiom can actually help readability. It certainly doesn't help performance so it should be avoided in inner loops. If it is "optimized" away, I would suggest a comment to make sure the reader remembers the rounding rule in Java. > No method should be declared 'throws Exception' except for special > cases like main() > Even then it is better to declare the specific exceptions. With a modern IDE, it costs zero effort to do a better job. > An abstract class which defines only abstract methods should likely > just be an interface, for flexibility > Unless it is an external API in which case the abstract class may be more future proof. > Lines like 'foo = foo % 10' may be improved to 'foo %= 10' > Some of us don't think that this is an improvement. -- Ted Dunning, CTO DeepDyve
