× The internal search function is temporarily non-functional. The current search engine is no longer viable and we are researching alternatives.
As a stop gap measure, we are using Google's custom search engine service.
If you know of an easy to use, open source, search engine ... please contact support@midrange.com.



Thorbjoern Ravn Andersen wrote:
I was actually wondering myself when I wrote it but could not crystalize out a reason then.
And I disagree (not violently <grin> but I do disagree).
It is basically my personal experience in what gives the least resistance in the long run, where I have reached that conclusion.
And in my personal experience, while I don't use double and float for the reasons you've stated, Thorbjørn, I prefer to use int for true integer values. However, I don't find a whole lot of integers in the real world; primarily counts. If Java had a true fixed precision primitive, I would use it all the time, and this would be a bigger issue.

Primitive types are not objects so they cannot be subclassed if different behaviour is needed. They cannot be used as parameters to methods expecting an object (like slf4j which I use a lot), and ALWAYS require special treatment everywhere. They cannot have a descriptive toString method!
I don't think this is a good reason to add the overhead of an Integer. Unless I'm mistaken, you can turn anything into String by just coding ""+intValue. And class variables don't need toString; that's the job of the containing class.

But again, this is more of a personal opinion. I just try to avoid extra overhead whenever possible. I'm not saying you should spend all your time optimizing your code, but it's my personal belief that the performance problems with some Java applications come from a complete disregard of performance issues, and unnecessary objects are just one more straw on the performance camel's back.

Joe

As an Amazon Associate we earn from qualifying purchases.

This thread ...

Follow-Ups:
Replies:

Follow On AppleNews
Return to Archive home page | Return to MIDRANGE.COM home page

This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].

Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.