commons-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Thomas Neidhart <thomas.neidh...@gmail.com>
Subject Re: svn commit: r1343163 - in /commons/proper/math/trunk/src: main/java/org/apache/commons/math3/linear/ test/java/org/apache/commons/math3/linear/
Date Mon, 28 May 2012 12:37:02 GMT
On 05/28/2012 02:28 PM, S├ębastien Brisard wrote:
> Hi Gilles,
> 
> 2012/5/28 Gilles Sadowski <gilles@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-unsubscribe@commons.apache.org
For additional commands, e-mail: dev-help@commons.apache.org


Mime
View raw message