On 05/28/2012 02:28 PM, Sébastien Brisard wrote:
> Hi Gilles,
> 
> 2012/5/28 Gilles Sadowski <gil...@harfang.homelinux.org>:
>> Hello.
>>
>>>
>>>>
>>>> Why do you call "valueOf"?
>>>>
>>> I have to say I do not like implicit conversions, that's why I tend to
>>> always use Integer.valueOf and the likes.
>>
>> Why?
>>
> This is going to get "philosophical": I would not dare to claim that
> I'm holding *the* truth, this is only my way of seeing things. I do
> not like things to happen implicitely, because I think that it opens a
> door to errors (this would not be true of professional programmers,
> but remember that I work in an environment where people are not real
> computer scientists... so my philosophy is "close as many doors as you
> can"...). I even think that J. Bloch has a nice example of potential
> issues with auto-boxing. However, I agree with you: calling valueOf in
> this context (that is: building a new exception) is certainly
> far-fetched.

Do not mind, I can't tell you what I have already seen at my workplace
from *professional* programmers ;-)

btw, a nice example how dangerous auto-boxing is:

Map<Short, Object> map = new HashMap<Short, Object>();
// fill the map with objects, keys in the range 1..10
...

// get the object with key 3
Object o = map.get(3);

o == null or not?

Thomas

---------------------------------------------------------------------
To unsubscribe, e-mail: dev-unsubscr...@commons.apache.org
For additional commands, e-mail: dev-h...@commons.apache.org

Reply via email to