Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.java.programmer > #6428

Re: Needs help in editing

Date 2011-07-22 18:13 -0400
From Arne Vajhøj <arne@vajhoej.dk>
Newsgroups comp.lang.java.programmer
Subject Re: Needs help in editing
References (1 earlier) <4e03bfb7$0$23665$426a34cc@news.free.fr> <4e03c0a3$0$23665$426a34cc@news.free.fr> <4389af7c-3124-42ea-b092-54999cff42c2@z7g2000prh.googlegroups.com> <4e04e54a$0$6275$426a34cc@news.free.fr> <iu7qcd$g7l$1@news.albasani.net>
Message-ID <4e29f5f1$0$304$14726298@news.sunsite.dk> (permalink)
Organization SunSITE.dk - Supporting Open source

Show all headers | View raw


On 6/26/2011 1:30 PM, Lew wrote:
> Aéris wrote:
>> lewbloch a écrit :
>>> Reflection is an elephant gun for
>>> shooting fleas; simple polymorphism suffices in most cases.
>
>> I totally aggree.
>>
>> But with this (craps) code and because constructors with different
>> prototype, reflection is unavoidable?
>>
>
> Reflection is mostly avoidable. A little light use of
> 'Class#newInstance()' with package-private builders called by a factory
> method isn't very risky and avoids the typical mad craziness of looking
> up 'Method' or 'Constructor' instances. If you're going down that latter
> route, leave programming to those better equipped for it.
>
> If you think heavy use of reflection will fix crappy code, boy are you
> ever wrong. Shit piled on top of shit only smells worse.

It depends a little bit about what you are doing.

I would not want to implement a Java EE 6 server without being
allowed to use reflection.

Even some business code can use some reflection even though in
most cases it is better to hide the reflection via some DI
framework.

Reflection is a very useful tool and a very powerful tool. One
should just limit its use to where it is necesarry.

A B-52 bomber is also pretty powerful if you want to engage in a war.
It is not the correct tool for getting rid of the mosquitos in the
house.

Arne




Back to comp.lang.java.programmer | Previous | NextNext in thread | Find similar


Thread

Re: Needs help in editing Arne Vajhøj <arne@vajhoej.dk> - 2011-07-22 18:13 -0400
  Re: Needs help in editing lewbloch <lewbloch@gmail.com> - 2011-07-22 15:52 -0700

csiph-web