Hi Gilles,

2012/5/28 Gilles Sadowski <[email protected]>:
> 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.

That was the initial reason why I moved from C++ to Java ten years
ago: too many things happened "behind my back". Again, I'm not saying
that C++ is evil. I'm just saying that I did not have the background
with C++ to be fully aware of these implicit assumptions, and their
potential consequences.

I'm pretty sure I will not convince you on this. I hope I have at
least convinced you that I have a good reason to do it this way :-)

>> However, if you think that
>> it leads to less readable code, I'm OK with your way of seeing things.
>
> Good! ;-)
>
> Gilles
>
As I said, I will remove these explicit boxings (but be warned: I've
used valueOf() in the past, and do apologize for any unwanted
occurence...).

Best regards,
Sébastien


---------------------------------------------------------------------
To unsubscribe, e-mail: [email protected]
For additional commands, e-mail: [email protected]

Reply via email to